Skip to content

Commit 6ea6ef8

Browse files
committed
Style changes
1 parent 46f5f00 commit 6ea6ef8

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

docs/notebooks/monte_carlo_analysis/mc_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,5 +187,5 @@
187187
)
188188

189189
test_dispersion.simulate(
190-
number_of_simulations=10, append=False, light_mode=False, parallel=True
190+
number_of_simulations=1000, append=False, light_mode=True, parallel=True
191191
)

rocketpy/simulation/monte_carlo.py

+11-15
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@
1515
from rocketpy.plots.monte_carlo_plots import _MonteCarloPlots
1616
from rocketpy.prints.monte_carlo_prints import _MonteCarloPrints
1717
from rocketpy.simulation.flight import Flight
18-
from rocketpy.simulation.sim_config.flight2serializer import flightv1_serializer
18+
from rocketpy.simulation.sim_config.flight2serializer import \
19+
flightv1_serializer
1920
from rocketpy.simulation.sim_config.serializer import function_serializer
20-
from rocketpy.stochastic import (
21-
StochasticEnvironment,
22-
StochasticFlight,
23-
StochasticRocket,
24-
)
25-
from rocketpy.tools import (
26-
generate_monte_carlo_ellipses,
27-
generate_monte_carlo_ellipses_coordinates,
28-
)
21+
from rocketpy.stochastic import (StochasticEnvironment, StochasticFlight,
22+
StochasticRocket)
23+
from rocketpy.tools import (generate_monte_carlo_ellipses,
24+
generate_monte_carlo_ellipses_coordinates)
2925

3026
# TODO: Let Functions and Flights be json serializable
3127
# TODO: Create evolution plots to analyze convergence
@@ -184,10 +180,8 @@ def simulate(
184180
None
185181
"""
186182
if append and light_mode is False:
187-
raise ValueError(
188-
"Append mode is not available when light_mode is False."
189-
)
190-
183+
raise ValueError("Append mode is not available when light_mode is False.")
184+
191185
# initialize counters
192186
self.number_of_simulations = number_of_simulations
193187
self.iteration_count = self.num_of_loaded_sims if append else 0
@@ -237,7 +231,9 @@ def _run_in_serial(self, append, light_mode):
237231
self.__close_files(input_file, output_file, error_file)
238232
raise error
239233

240-
self.__finalize_simulation(input_file, output_file, error_file, light_mode=light_mode)
234+
self.__finalize_simulation(
235+
input_file, output_file, error_file, light_mode=light_mode
236+
)
241237

242238
def _run_in_parallel(self, append, light_mode, n_workers=None):
243239
"""Runs the monte carlo simulation in parallel."""

0 commit comments

Comments
 (0)