32
32
33
33
import inspect
34
34
import os
35
+ import sys
35
36
36
37
import matplotlib .pyplot as plt
37
38
import numpy as np
56
57
sNavTransName = "sNavTransMsg"
57
58
attGuidName = "attGuidMsg"
58
59
59
- def run (show_plots ):
60
+ def run (show_plots , execution_count = 4 , thread_count = 2 ):
60
61
"""This function is called by the py.test environment."""
61
62
62
63
# A MonteCarlo simulation can be created using the `MonteCarlo` module.
@@ -65,11 +66,11 @@ def run(show_plots):
65
66
monteCarlo = Controller ()
66
67
monteCarlo .setSimulationFunction (scenario_AttFeedback .scenario_AttFeedback ) # Required: function that configures the base scenario
67
68
monteCarlo .setExecutionFunction (scenario_AttFeedback .runScenario ) # Required: function that runs the scenario
68
- monteCarlo .setExecutionCount (4 ) # Required: Number of MCs to run
69
+ monteCarlo .setExecutionCount (execution_count ) # Required: Number of MCs to run
69
70
70
71
monteCarlo .setArchiveDir (path + "/scenario_AttFeedbackMC" ) # Optional: If/where to save retained data.
71
72
monteCarlo .setShouldDisperseSeeds (True ) # Optional: Randomize the seed for each module
72
- monteCarlo .setThreadCount (2 ) # Optional: Number of processes to spawn MCs on
73
+ monteCarlo .setThreadCount (thread_count ) # Optional: Number of processes to spawn MCs on
73
74
monteCarlo .setVerbose (True ) # Optional: Produce supplemental text output in console describing status
74
75
monteCarlo .setVarCast ('float' ) # Optional: Downcast the retained numbers to float32 to save on storage space
75
76
monteCarlo .setDispMagnitudeFile (True ) # Optional: Produce a .txt file that shows dispersion in std dev units
@@ -117,4 +118,12 @@ def displayPlots(data, retentionPolicy):
117
118
118
119
119
120
if __name__ == "__main__" :
120
- run (True )
121
+ if len (sys .argv ) == 1 :
122
+ run (True )
123
+ elif len (sys .argv ) == 2 :
124
+ execution_count = int (sys .argv [1 ])
125
+ run (True , execution_count )
126
+ elif len (sys .argv ) > 3 :
127
+ execution_count = int (sys .argv [1 ])
128
+ thread_count = int (sys .argv [2 ])
129
+ run (True , execution_count , thread_count )
0 commit comments