@@ -145,14 +145,13 @@ def __init__(
145145 self .import_outputs (self .filename .with_suffix (".outputs.txt" ))
146146 self .import_errors (self .filename .with_suffix (".errors.txt" ))
147147
148- # pylint: disable=consider-using-with
149148 def simulate (
150149 self ,
151150 number_of_simulations ,
152151 append = False ,
153152 parallel = False ,
154153 n_workers = None ,
155- ): # pylint: disable=too-many-statements
154+ ):
156155 """
157156 Runs the Monte Carlo simulation and saves all data.
158157
@@ -191,13 +190,10 @@ def simulate(
191190 self .number_of_simulations = number_of_simulations
192191 self ._initial_sim_idx = self .num_of_loaded_sims if append else 0
193192
194- # Begin display
195193 _SimMonitor .reprint ("Starting Monte Carlo analysis" )
196194
197- # Setup files
198195 self .__setup_files (append )
199196
200- # Run simulations
201197 if parallel :
202198 self .__run_in_parallel (n_workers )
203199 else :
@@ -241,11 +237,6 @@ def __run_in_serial(self):
241237 """
242238 Runs the monte carlo simulation in serial mode.
243239
244- Parameters
245- ----------
246- start_index : int
247- The index of the first simulation to be run.
248-
249240 Returns
250241 -------
251242 None
@@ -303,9 +294,9 @@ def __run_in_parallel(self, n_workers=None):
303294 if n_workers < 2 :
304295 raise ValueError ("Number of workers must be at least 2 for parallel mode." )
305296
306- multiprocess , managers = import_multiprocess ()
297+ multiprocess , managers = _import_multiprocess ()
307298
308- with create_multiprocess_manager (multiprocess , managers ) as manager :
299+ with _create_multiprocess_manager (multiprocess , managers ) as manager :
309300 export_queue = manager .Queue ()
310301 mutex = manager .Lock ()
311302 consumer_stop_event = manager .Event ()
@@ -442,10 +433,6 @@ def __sim_consumer(
442433 ----------
443434 export_queue : multiprocess.Queue
444435 The queue to export the results.
445- inputs_file : str
446- The file path to write the inputs.
447- outputs_file : str
448- The file path to write the outputs.
449436 mutex : multiprocess.Lock
450437 The mutex to lock access to critical regions.
451438 stop_event : multiprocess.Event
@@ -1041,7 +1028,7 @@ def all_info(self):
10411028 self .plots .all ()
10421029
10431030
1044- def import_multiprocess ():
1031+ def _import_multiprocess ():
10451032 """Import the necessary modules and submodules for the
10461033 multiprocess library.
10471034
@@ -1056,7 +1043,7 @@ def import_multiprocess():
10561043 return multiprocess , managers
10571044
10581045
1059- def create_multiprocess_manager (multiprocess , managers ):
1046+ def _create_multiprocess_manager (multiprocess , managers ):
10601047 """Creates a manager for the multiprocess control of the
10611048 Monte Carlo simulation.
10621049
@@ -1150,7 +1137,7 @@ def reprint(msg, end="\n", flush=True):
11501137 end : str, optional
11511138 String appended after the message. Default is a new line.
11521139 flush : bool, optional
1153- If True, the output is flushed. Default is False .
1140+ If True, the output is flushed. Default is True .
11541141
11551142 Returns
11561143 -------
0 commit comments