|
9 | 9 | }, |
10 | 10 | { |
11 | 11 | "cell_type": "code", |
12 | | - "execution_count": 80, |
| 12 | + "execution_count": 30, |
13 | 13 | "metadata": {}, |
14 | 14 | "outputs": [ |
15 | 15 | { |
|
29 | 29 | }, |
30 | 30 | { |
31 | 31 | "cell_type": "code", |
32 | | - "execution_count": 81, |
| 32 | + "execution_count": 31, |
33 | 33 | "metadata": {}, |
34 | 34 | "outputs": [], |
35 | 35 | "source": [ |
36 | | - "from rocketpy.simulation.multivariate_rejection_sampler import MultivariateRejectionSampler\n", |
| 36 | + "from rocketpy.simulation.multivariate_rejection_sampler import (\n", |
| 37 | + " MultivariateRejectionSampler,\n", |
| 38 | + ")\n", |
37 | 39 | "from rocketpy import MonteCarlo\n", |
38 | 40 | "from scipy.stats import norm\n", |
39 | 41 | "import numpy as np" |
40 | 42 | ] |
41 | 43 | }, |
42 | 44 | { |
43 | 45 | "cell_type": "code", |
44 | | - "execution_count": 88, |
| 46 | + "execution_count": 32, |
45 | 47 | "metadata": {}, |
46 | 48 | "outputs": [], |
47 | 49 | "source": [ |
48 | | - "montecarlo_filepath = \"docs/notebooks/monte_carlo_analysis/monte_carlo_analysis_outputs/monte_carlo_class_example\"\n", |
49 | | - "mrs_filepath = \"mrs\"\n", |
| 50 | + "monte_carlo_filepath = (\n", |
| 51 | + " \"monte_carlo_analysis/monte_carlo_analysis_outputs/monte_carlo_class_example\"\n", |
| 52 | + ")\n", |
| 53 | + "mrs_filepath = \"monte_carlo_analysis/monte_carlo_analysis_outputs/mrs\"\n", |
50 | 54 | "old_mass_pdf = norm(15.426, 0.5).pdf\n", |
51 | | - "new_mass_pdf = norm(15, 0.5) .pdf\n", |
| 55 | + "new_mass_pdf = norm(15, 0.5).pdf\n", |
52 | 56 | "distribution_dict = {\n", |
53 | 57 | " \"mass\": (old_mass_pdf, new_mass_pdf),\n", |
54 | 58 | "}\n", |
55 | 59 | "mrs = MultivariateRejectionSampler(\n", |
56 | | - " montecarlo_filepath=montecarlo_filepath,\n", |
| 60 | + " monte_carlo_filepath=monte_carlo_filepath,\n", |
57 | 61 | " mrs_filepath=mrs_filepath,\n", |
58 | | - " distribution_dict=distribution_dict,\n", |
59 | 62 | ")" |
60 | 63 | ] |
61 | 64 | }, |
62 | 65 | { |
63 | 66 | "cell_type": "code", |
64 | | - "execution_count": 89, |
65 | | - "metadata": {}, |
66 | | - "outputs": [ |
67 | | - { |
68 | | - "data": { |
69 | | - "text/plain": [ |
70 | | - "107.0" |
71 | | - ] |
72 | | - }, |
73 | | - "execution_count": 89, |
74 | | - "metadata": {}, |
75 | | - "output_type": "execute_result" |
76 | | - } |
77 | | - ], |
78 | | - "source": [ |
79 | | - "mrs.expected_sample_size" |
80 | | - ] |
81 | | - }, |
82 | | - { |
83 | | - "cell_type": "code", |
84 | | - "execution_count": 90, |
| 67 | + "execution_count": 33, |
85 | 68 | "metadata": {}, |
86 | 69 | "outputs": [], |
87 | 70 | "source": [ |
88 | | - "mrs.sample()" |
| 71 | + "mrs.sample(distribution_dict=distribution_dict)" |
89 | 72 | ] |
90 | 73 | }, |
91 | 74 | { |
92 | 75 | "cell_type": "code", |
93 | | - "execution_count": 91, |
| 76 | + "execution_count": 34, |
94 | 77 | "metadata": {}, |
95 | 78 | "outputs": [ |
96 | 79 | { |
97 | 80 | "name": "stdout", |
98 | 81 | "output_type": "stream", |
99 | 82 | "text": [ |
100 | | - "The following input file was imported: mrs.inputs.txt\n", |
101 | | - "A total of 109 simulations results were loaded from the following output file: mrs.outputs.txt\n", |
| 83 | + "The following input file was imported: monte_carlo_analysis/monte_carlo_analysis_outputs/mrs.inputs.txt\n", |
| 84 | + "A total of 116 simulations results were loaded from the following output file: monte_carlo_analysis/monte_carlo_analysis_outputs/mrs.outputs.txt\n", |
102 | 85 | "\n", |
103 | | - "The following error file was imported: mrs.errors.txt\n" |
| 86 | + "The following error file was imported: monte_carlo_analysis/monte_carlo_analysis_outputs/mrs.errors.txt\n" |
104 | 87 | ] |
105 | 88 | } |
106 | 89 | ], |
|
110 | 93 | }, |
111 | 94 | { |
112 | 95 | "cell_type": "code", |
113 | | - "execution_count": 92, |
| 96 | + "execution_count": 35, |
114 | 97 | "metadata": {}, |
115 | 98 | "outputs": [ |
116 | 99 | { |
117 | 100 | "name": "stdout", |
118 | 101 | "output_type": "stream", |
119 | 102 | "text": [ |
120 | | - "A total of 109 simulations results were loaded from the following output file: mrs.outputs.txt\n", |
| 103 | + "A total of 116 simulations results were loaded from the following output file: monte_carlo_analysis/monte_carlo_analysis_outputs/mrs.outputs.txt\n", |
121 | 104 | "\n", |
122 | | - "The following input file was imported: mrs.inputs.txt\n", |
123 | | - "The following error file was imported: mrs.errors.txt\n" |
| 105 | + "The following input file was imported: monte_carlo_analysis/monte_carlo_analysis_outputs/mrs.inputs.txt\n", |
| 106 | + "The following error file was imported: monte_carlo_analysis/monte_carlo_analysis_outputs/mrs.errors.txt\n" |
124 | 107 | ] |
125 | 108 | } |
126 | 109 | ], |
|
130 | 113 | }, |
131 | 114 | { |
132 | 115 | "cell_type": "code", |
133 | | - "execution_count": null, |
| 116 | + "execution_count": 36, |
134 | 117 | "metadata": {}, |
135 | 118 | "outputs": [ |
136 | 119 | { |
137 | 120 | "name": "stdout", |
138 | 121 | "output_type": "stream", |
139 | 122 | "text": [ |
140 | | - "MRS mass mean after resample: 15.029610376989238\n", |
141 | | - "MRS mass std after resample: 0.5213162519453568\n" |
| 123 | + "MRS mass mean after resample: 15.041934326472004\n", |
| 124 | + "MRS mass std after resample: 0.48924085702427966\n" |
142 | 125 | ] |
143 | 126 | } |
144 | 127 | ], |
|
150 | 133 | "print(f\"MRS mass mean after resample: {np.mean(mrs_mass_list)}\")\n", |
151 | 134 | "print(f\"MRS mass std after resample: {np.std(mrs_mass_list)}\")" |
152 | 135 | ] |
| 136 | + }, |
| 137 | + { |
| 138 | + "cell_type": "code", |
| 139 | + "execution_count": 37, |
| 140 | + "metadata": {}, |
| 141 | + "outputs": [ |
| 142 | + { |
| 143 | + "data": { |
| 144 | + "text/plain": [ |
| 145 | + "107.0" |
| 146 | + ] |
| 147 | + }, |
| 148 | + "execution_count": 37, |
| 149 | + "metadata": {}, |
| 150 | + "output_type": "execute_result" |
| 151 | + } |
| 152 | + ], |
| 153 | + "source": [ |
| 154 | + "mrs.expected_sample_size" |
| 155 | + ] |
| 156 | + }, |
| 157 | + { |
| 158 | + "cell_type": "code", |
| 159 | + "execution_count": null, |
| 160 | + "metadata": {}, |
| 161 | + "outputs": [], |
| 162 | + "source": [] |
153 | 163 | } |
154 | 164 | ], |
155 | 165 | "metadata": { |
156 | 166 | "kernelspec": { |
157 | | - "display_name": "testnotebook", |
| 167 | + "display_name": "Python 3", |
158 | 168 | "language": "python", |
159 | 169 | "name": "python3" |
160 | 170 | }, |
|
168 | 178 | "name": "python", |
169 | 179 | "nbconvert_exporter": "python", |
170 | 180 | "pygments_lexer": "ipython3", |
171 | | - "version": "3.12.2" |
| 181 | + "version": "3.10.12" |
172 | 182 | } |
173 | 183 | }, |
174 | 184 | "nbformat": 4, |
|
0 commit comments