1
- from pathlib import Path
2
-
3
1
import matplotlib .pyplot as plt
4
2
import numpy as np
5
3
from matplotlib .patches import Ellipse
6
4
7
- from rocketpy .stochastic .post_processing .stochastic_cache import \
8
- SimulationCache
5
+ from rocketpy .stochastic .post_processing .stochastic_cache import SimulationCache
9
6
10
7
# 1-3 sigma
11
8
lower_percentiles = [0.16 , 0.03 , 0.003 ]
@@ -19,11 +16,9 @@ def eigsorted(cov):
19
16
return vals [order ], vecs [:, order ]
20
17
21
18
22
- def compute_impact (file_name , batch_path , save , show ):
23
- cache = SimulationCache (
24
- file_name ,
25
- batch_path ,
26
- )
19
+ def compute_impact (cache , save , show ):
20
+ batch_path = cache .batch_path
21
+
27
22
x_impact = cache .read_outputs ('x_impact' )
28
23
y_impact = cache .read_outputs ('y_impact' )
29
24
@@ -68,20 +63,21 @@ def compute_impact(file_name, batch_path, save, show):
68
63
ax .grid ()
69
64
70
65
if save :
71
- plt .savefig (batch_path / 'mean_impact_distribution.png' )
66
+ plt .savefig (batch_path / "Figures" / 'mean_impact_distribution.png' )
72
67
73
68
if show :
74
69
plt .show ()
75
- plt .show ()
76
70
77
71
78
- def run (file_name , batch_path , save , show ):
79
- compute_impact (file_name , batch_path , save , show )
72
+ def run (cache , save , show ):
73
+ compute_impact (cache , save , show )
80
74
81
75
82
76
if __name__ == '__main__' :
83
- # import easygui
77
+ import easygui
84
78
85
- batch_path = Path ( "mc_simulations/" )
79
+ # configuration
86
80
file_name = 'monte_carlo_class_example'
87
- run (file_name , batch_path , save = True , show = True )
81
+ batch_path = easygui .diropenbox (title = "Select the batch path" )
82
+ cache = SimulationCache (file_name , batch_path )
83
+ run (cache , save = True , show = True )
0 commit comments