Skip to content

Commit e7b730a

Browse files
Merge pull request #232 from RocketPy-Team/enh/class_dispersion
ENH: Introducing the Monte Carlo class
2 parents 1e17549 + 209434f commit e7b730a

File tree

78 files changed

+8197
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+8197
-24
lines changed

docs/notebooks/dispersion_analysis/dispersion_analysis.ipynb renamed to docs/notebooks/monte_carlo_analysis/monte_carlo_analysis.ipynb

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
"We hope you enjoy the flight(s) in this notebook just like everyone in LASC19 did it in real-time!"
2121
]
2222
},
23+
{
24+
"cell_type": "markdown",
25+
"metadata": {},
26+
"source": [
27+
"**NOTE:** There is a new `MonteCarlo` class in RocketPy v1.2.0. This notebook is still here just for reference, but it is recommended to use the new class. See the `Monte Carlo class usage` page in the documentation for more information."
28+
]
29+
},
2330
{
2431
"attachments": {},
2532
"cell_type": "markdown",
@@ -384,7 +391,7 @@
384391
],
385392
"source": [
386393
"# Basic analysis info\n",
387-
"filename = \"dispersion_analysis_outputs/valetudo_rocket_v0\"\n",
394+
"filename = \"monte_carlo_analysis_outputs/valetudo_rocket_v0\"\n",
388395
"number_of_simulations = 100\n",
389396
"\n",
390397
"# Create data files for inputs, outputs and error logging\n",
@@ -404,7 +411,7 @@
404411
"Env.max_expected_height = 1500\n",
405412
"Env.set_atmospheric_model(\n",
406413
" type=\"Ensemble\",\n",
407-
" file=\"dispersion_analysis_inputs/LASC2019_reanalysis.nc\",\n",
414+
" file=\"monte_carlo_analysis_inputs/LASC2019_reanalysis.nc\",\n",
408415
" dictionary=\"ECMWF\",\n",
409416
")\n",
410417
"\n",
@@ -428,7 +435,7 @@
428435
"\n",
429436
" # Create motor\n",
430437
" Keron = SolidMotor(\n",
431-
" thrust_source=\"dispersion_analysis_inputs/thrustCurve.csv\",\n",
438+
" thrust_source=\"monte_carlo_analysis_inputs/thrustCurve.csv\",\n",
432439
" burn_time=5.274,\n",
433440
" reshape_thrust_curve=(setting[\"burn_time\"], setting[\"impulse\"]),\n",
434441
" nozzle_radius=setting[\"nozzle_radius\"],\n",
@@ -460,8 +467,8 @@
460467
" setting[\"rocket_inertia_11\"],\n",
461468
" setting[\"rocket_inertia_33\"],\n",
462469
" ),\n",
463-
" power_off_drag=\"dispersion_analysis_inputs/Cd_PowerOff.csv\",\n",
464-
" power_on_drag=\"dispersion_analysis_inputs/Cd_PowerOn.csv\",\n",
470+
" power_off_drag=\"monte_carlo_analysis_inputs/Cd_PowerOff.csv\",\n",
471+
" power_on_drag=\"monte_carlo_analysis_inputs/Cd_PowerOn.csv\",\n",
465472
" center_of_mass_without_motor=0,\n",
466473
" coordinate_system_orientation=\"tail_to_nose\",\n",
467474
" )\n",
@@ -574,7 +581,7 @@
574581
}
575582
],
576583
"source": [
577-
"filename = \"dispersion_analysis_outputs/valetudo_rocket_v0\"\n",
584+
"filename = \"monte_carlo_analysis_outputs/valetudo_rocket_v0\"\n",
578585
"\n",
579586
"# Initialize variable to store all results\n",
580587
"dispersion_general_results = []\n",
@@ -20354,7 +20361,7 @@
2035420361
"from matplotlib.patches import Ellipse\n",
2035520362
"\n",
2035620363
"# Import background map\n",
20357-
"img = imread(\"dispersion_analysis_inputs/Valetudo_basemap_final.jpg\")\n",
20364+
"img = imread(\"monte_carlo_analysis_inputs/Valetudo_basemap_final.jpg\")\n",
2035820365
"\n",
2035920366
"# Retrieve dispersion data por apogee and impact XY position\n",
2036020367
"apogee_x = np.array(dispersion_results[\"apogee_x\"])\n",

docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/Cd_PowerOff.csv renamed to docs/notebooks/monte_carlo_analysis/monte_carlo_analysis_inputs/Cd_PowerOff.csv

File renamed without changes.

docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/Cd_PowerOn.csv renamed to docs/notebooks/monte_carlo_analysis/monte_carlo_analysis_inputs/Cd_PowerOn.csv

File renamed without changes.

docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/LASC2019_reanalysis.nc renamed to docs/notebooks/monte_carlo_analysis/monte_carlo_analysis_inputs/LASC2019_reanalysis.nc

File renamed without changes.

docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/Valetudo_basemap_final.jpg renamed to docs/notebooks/monte_carlo_analysis/monte_carlo_analysis_inputs/Valetudo_basemap_final.jpg

File renamed without changes.

docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/thrustCurve.csv renamed to docs/notebooks/monte_carlo_analysis/monte_carlo_analysis_inputs/thrustCurve.csv

File renamed without changes.

docs/notebooks/monte_carlo_analysis/monte_carlo_analysis_outputs/monte_carlo_class_example.errors.txt

Whitespace-only changes.

docs/notebooks/monte_carlo_analysis/monte_carlo_analysis_outputs/monte_carlo_class_example.inputs.txt

Lines changed: 1000 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
3+
<Document id="1">
4+
<Style id="8">
5+
<LineStyle id="9">
6+
<color>ff0000ff</color>
7+
<colorMode>normal</colorMode>
8+
<width>3</width>
9+
</LineStyle>
10+
<PolyStyle id="10">
11+
<color>64ff0000</color>
12+
<colorMode>normal</colorMode>
13+
<fill>1</fill>
14+
<outline>1</outline>
15+
</PolyStyle>
16+
</Style>
17+
<Style id="17">
18+
<LineStyle id="18">
19+
<color>ff0000ff</color>
20+
<colorMode>normal</colorMode>
21+
<width>3</width>
22+
</LineStyle>
23+
<PolyStyle id="19">
24+
<color>64ff0000</color>
25+
<colorMode>normal</colorMode>
26+
<fill>1</fill>
27+
<outline>1</outline>
28+
</PolyStyle>
29+
</Style>
30+
<Style id="26">
31+
<LineStyle id="27">
32+
<color>ff0000ff</color>
33+
<colorMode>normal</colorMode>
34+
<width>3</width>
35+
</LineStyle>
36+
<PolyStyle id="28">
37+
<color>64ff0000</color>
38+
<colorMode>normal</colorMode>
39+
<fill>1</fill>
40+
<outline>1</outline>
41+
</PolyStyle>
42+
</Style>
43+
<Placemark id="3">
44+
<name>Impact σ1</name>
45+
<visibility>1</visibility>
46+
<styleUrl>#8</styleUrl>
47+
<MultiGeometry id="2">
48+
<Polygon id="4">
49+
<outerBoundaryIs>
50+
<LinearRing id="6">
51+
<coordinates>1103.1172286537246,1837.8024088917573,0.0 1094.9984810133226,1842.5556499782087,0.0 1087.949600575892,1849.883623456037,0.0 1081.998406052192,1859.7574091617566,0.0 1077.168384088166,1872.1380397740918,0.0 1073.4785965738781,1886.9766546001874,0.0 1070.9436054149444,1904.214692406443,0.0 1069.5734150633416,1923.7841225329475,0.0 1069.3734330344068,1945.6077133794142,0.0 1070.3444485658454,1969.599337203022,0.0 1072.4826295029695,1995.6643100252697,0.0 1075.7795374224625,2023.699765306381,0.0 1080.2221609349797,2053.5950599125426,0.0 1085.792967035159,2085.2322107738055,0.0 1092.4699702963821,2118.486360509359,0.0 1100.22681963721,2153.226270182573,0.0 1109.0329023170614,2189.3148372411224,0.0 1118.8534647507154,2226.609636598125,0.0 1129.6497496648349,2264.9634827188916,0.0 1141.3791490552169,2304.2250104949894,0.0 1153.9953723411206,2344.239272613172,0.0 1167.4486290530408,2384.8483510616365,0.0 1181.6858253329438,2425.89198036027,0.0 1196.650773471469,2467.2081800552805,0.0 1212.2844136551482,2508.6338939820494,0.0 1228.5250470485075,2550.005633773316,0.0 1245.3085792911825,2591.1601240730724,0.0 1262.5687734490782,2631.9349469098056,0.0 1280.237511421286,2672.1691826860233,0.0 1298.2450627711078,2711.70404525439,0.0 1316.5203599202337,2750.383508574109,0.0 1334.9912786200055,2788.054922474424,0.0 1353.5849225928748,2824.569615095102,0.0 1372.2279112207088,2859.783479626345,0.0 1390.8466691445649,2893.5575430325334,0.0 1409.3677166330187,2925.7585145153043,0.0 1427.7179595730954,2956.2593115514396,0.0 1445.8249779393389,2984.939561429527,0.0 1463.617311602567,3011.6860763060567,0.0 1481.0247423503558,3036.393299906132,0.0 1497.9785710062422,3058.96372410586,0.0 1514.411888553988,3079.3082737523705,0.0 1530.2598401969026,3097.3466582027486,0.0 1545.4598813100906,3113.007688194524,0.0 1559.9520242755168,3126.2295567971614,0.0 1573.6790752257268,3136.9600833357854,0.0 1586.5868597619135,3145.156919324457,0.0 1598.6244367555187,3150.787715596309,0.0 1609.7442993895934,3153.830249970922,0.0 1619.9025626465038,3154.2725149551206,0.0 1629.0591365020434,3152.1127651310644,0.0 1637.1778841424455,3147.359524044613,0.0 1644.226764579876,3140.0315505667845,0.0 1650.1779591035759,3130.157764861065,0.0 1655.007981067602,3117.77713424873,0.0 1658.6977685818897,3102.9385194226343,0.0 1661.2327597408237,3085.700481616379,0.0 1662.6029500924267,3066.1310514898746,0.0 1662.8029321213612,3044.3074606434075,0.0 1661.8319165899227,3020.3158368197996,0.0 1659.6937356527985,2994.250863997552,0.0 1656.3968277333056,2966.2154087164404,0.0 1651.9542042207884,2936.320114110279,0.0 1646.383398120609,2904.682963249016,0.0 1639.7063948593857,2871.4288135134625,0.0 1631.9495455185581,2836.6889038402487,0.0 1623.143462838707,2800.6003367816993,0.0 1613.3229004050527,2763.305537424697,0.0 1602.5266154909332,2724.9516913039297,0.0 1590.7972161005512,2685.6901635278323,0.0 1578.1809928146474,2645.6759014096497,0.0 1564.727736102727,2605.0668229611847,0.0 1550.4905398228243,2564.0231936625514,0.0 1535.5255916842991,2522.706993967541,0.0 1519.8919515006196,2481.281280040772,0.0 1503.6513181072605,2439.909540249506,0.0 1486.8677858645856,2398.7550499497493,0.0 1469.6075917066898,2357.980227113016,0.0 1451.9388537344823,2317.7459913367984,0.0 1433.9313023846603,2278.2111287684315,0.0 1415.6560052355344,2239.531665448713,0.0 1397.1850865357628,2201.860251548398,0.0 1378.5914425628937,2165.34555892772,0.0 1359.9484539350592,2130.131694396476,0.0 1341.3296960112032,2096.3576309902883,0.0 1322.8086485227493,2064.1566595075174,0.0 1304.4584055826729,2033.655862471382,0.0 1286.3513872164294,2004.9756125932952,0.0 1268.5590535532012,1978.229097716765,0.0 1251.151622805412,1953.5218741166893,0.0 1234.1977941495259,1930.9514499169616,0.0 1217.76447660178,1910.6069002704514,0.0 1201.9165249588657,1892.568515820073,0.0 1186.7164838456777,1876.9074858282981,0.0 1172.2243408802512,1863.68561722566,0.0 1158.4972899300412,1852.9550906870368,0.0 1145.5895053938546,1844.7582546983645,0.0 1133.5519284002494,1839.1274584265125,0.0 1122.4320657661747,1836.0849240518999,0.0 -8.267624328036598,39.399689834676806,0.0</coordinates>
52+
</LinearRing>
53+
</outerBoundaryIs>
54+
</Polygon>
55+
</MultiGeometry>
56+
</Placemark>
57+
<Placemark id="12">
58+
<name>Impact σ2</name>
59+
<visibility>1</visibility>
60+
<styleUrl>#17</styleUrl>
61+
<MultiGeometry id="11">
62+
<Polygon id="13">
63+
<outerBoundaryIs>
64+
<LinearRing id="15">
65+
<coordinates>1103.1172286537246,1837.8024088917573,0.0 1094.9984810133226,1842.5556499782087,0.0 1087.949600575892,1849.883623456037,0.0 1081.998406052192,1859.7574091617566,0.0 1077.168384088166,1872.1380397740918,0.0 1073.4785965738781,1886.9766546001874,0.0 1070.9436054149444,1904.214692406443,0.0 1069.5734150633416,1923.7841225329475,0.0 1069.3734330344068,1945.6077133794142,0.0 1070.3444485658454,1969.599337203022,0.0 1072.4826295029695,1995.6643100252697,0.0 1075.7795374224625,2023.699765306381,0.0 1080.2221609349797,2053.5950599125426,0.0 1085.792967035159,2085.2322107738055,0.0 1092.4699702963821,2118.486360509359,0.0 1100.22681963721,2153.226270182573,0.0 1109.0329023170614,2189.3148372411224,0.0 1118.8534647507154,2226.609636598125,0.0 1129.6497496648349,2264.9634827188916,0.0 1141.3791490552169,2304.2250104949894,0.0 1153.9953723411206,2344.239272613172,0.0 1167.4486290530408,2384.8483510616365,0.0 1181.6858253329438,2425.89198036027,0.0 1196.650773471469,2467.2081800552805,0.0 1212.2844136551482,2508.6338939820494,0.0 1228.5250470485075,2550.005633773316,0.0 1245.3085792911825,2591.1601240730724,0.0 1262.5687734490782,2631.9349469098056,0.0 1280.237511421286,2672.1691826860233,0.0 1298.2450627711078,2711.70404525439,0.0 1316.5203599202337,2750.383508574109,0.0 1334.9912786200055,2788.054922474424,0.0 1353.5849225928748,2824.569615095102,0.0 1372.2279112207088,2859.783479626345,0.0 1390.8466691445649,2893.5575430325334,0.0 1409.3677166330187,2925.7585145153043,0.0 1427.7179595730954,2956.2593115514396,0.0 1445.8249779393389,2984.939561429527,0.0 1463.617311602567,3011.6860763060567,0.0 1481.0247423503558,3036.393299906132,0.0 1497.9785710062422,3058.96372410586,0.0 1514.411888553988,3079.3082737523705,0.0 1530.2598401969026,3097.3466582027486,0.0 1545.4598813100906,3113.007688194524,0.0 1559.9520242755168,3126.2295567971614,0.0 1573.6790752257268,3136.9600833357854,0.0 1586.5868597619135,3145.156919324457,0.0 1598.6244367555187,3150.787715596309,0.0 1609.7442993895934,3153.830249970922,0.0 1619.9025626465038,3154.2725149551206,0.0 1629.0591365020434,3152.1127651310644,0.0 1637.1778841424455,3147.359524044613,0.0 1644.226764579876,3140.0315505667845,0.0 1650.1779591035759,3130.157764861065,0.0 1655.007981067602,3117.77713424873,0.0 1658.6977685818897,3102.9385194226343,0.0 1661.2327597408237,3085.700481616379,0.0 1662.6029500924267,3066.1310514898746,0.0 1662.8029321213612,3044.3074606434075,0.0 1661.8319165899227,3020.3158368197996,0.0 1659.6937356527985,2994.250863997552,0.0 1656.3968277333056,2966.2154087164404,0.0 1651.9542042207884,2936.320114110279,0.0 1646.383398120609,2904.682963249016,0.0 1639.7063948593857,2871.4288135134625,0.0 1631.9495455185581,2836.6889038402487,0.0 1623.143462838707,2800.6003367816993,0.0 1613.3229004050527,2763.305537424697,0.0 1602.5266154909332,2724.9516913039297,0.0 1590.7972161005512,2685.6901635278323,0.0 1578.1809928146474,2645.6759014096497,0.0 1564.727736102727,2605.0668229611847,0.0 1550.4905398228243,2564.0231936625514,0.0 1535.5255916842991,2522.706993967541,0.0 1519.8919515006196,2481.281280040772,0.0 1503.6513181072605,2439.909540249506,0.0 1486.8677858645856,2398.7550499497493,0.0 1469.6075917066898,2357.980227113016,0.0 1451.9388537344823,2317.7459913367984,0.0 1433.9313023846603,2278.2111287684315,0.0 1415.6560052355344,2239.531665448713,0.0 1397.1850865357628,2201.860251548398,0.0 1378.5914425628937,2165.34555892772,0.0 1359.9484539350592,2130.131694396476,0.0 1341.3296960112032,2096.3576309902883,0.0 1322.8086485227493,2064.1566595075174,0.0 1304.4584055826729,2033.655862471382,0.0 1286.3513872164294,2004.9756125932952,0.0 1268.5590535532012,1978.229097716765,0.0 1251.151622805412,1953.5218741166893,0.0 1234.1977941495259,1930.9514499169616,0.0 1217.76447660178,1910.6069002704514,0.0 1201.9165249588657,1892.568515820073,0.0 1186.7164838456777,1876.9074858282981,0.0 1172.2243408802512,1863.68561722566,0.0 1158.4972899300412,1852.9550906870368,0.0 1145.5895053938546,1844.7582546983645,0.0 1133.5519284002494,1839.1274584265125,0.0 1122.4320657661747,1836.0849240518999,0.0 -8.267624328036598,39.399689834676806,0.0</coordinates>
66+
</LinearRing>
67+
</outerBoundaryIs>
68+
</Polygon>
69+
</MultiGeometry>
70+
</Placemark>
71+
<Placemark id="21">
72+
<name>Impact σ3</name>
73+
<visibility>1</visibility>
74+
<styleUrl>#26</styleUrl>
75+
<MultiGeometry id="20">
76+
<Polygon id="22">
77+
<outerBoundaryIs>
78+
<LinearRing id="24">
79+
<coordinates>1103.1172286537246,1837.8024088917573,0.0 1094.9984810133226,1842.5556499782087,0.0 1087.949600575892,1849.883623456037,0.0 1081.998406052192,1859.7574091617566,0.0 1077.168384088166,1872.1380397740918,0.0 1073.4785965738781,1886.9766546001874,0.0 1070.9436054149444,1904.214692406443,0.0 1069.5734150633416,1923.7841225329475,0.0 1069.3734330344068,1945.6077133794142,0.0 1070.3444485658454,1969.599337203022,0.0 1072.4826295029695,1995.6643100252697,0.0 1075.7795374224625,2023.699765306381,0.0 1080.2221609349797,2053.5950599125426,0.0 1085.792967035159,2085.2322107738055,0.0 1092.4699702963821,2118.486360509359,0.0 1100.22681963721,2153.226270182573,0.0 1109.0329023170614,2189.3148372411224,0.0 1118.8534647507154,2226.609636598125,0.0 1129.6497496648349,2264.9634827188916,0.0 1141.3791490552169,2304.2250104949894,0.0 1153.9953723411206,2344.239272613172,0.0 1167.4486290530408,2384.8483510616365,0.0 1181.6858253329438,2425.89198036027,0.0 1196.650773471469,2467.2081800552805,0.0 1212.2844136551482,2508.6338939820494,0.0 1228.5250470485075,2550.005633773316,0.0 1245.3085792911825,2591.1601240730724,0.0 1262.5687734490782,2631.9349469098056,0.0 1280.237511421286,2672.1691826860233,0.0 1298.2450627711078,2711.70404525439,0.0 1316.5203599202337,2750.383508574109,0.0 1334.9912786200055,2788.054922474424,0.0 1353.5849225928748,2824.569615095102,0.0 1372.2279112207088,2859.783479626345,0.0 1390.8466691445649,2893.5575430325334,0.0 1409.3677166330187,2925.7585145153043,0.0 1427.7179595730954,2956.2593115514396,0.0 1445.8249779393389,2984.939561429527,0.0 1463.617311602567,3011.6860763060567,0.0 1481.0247423503558,3036.393299906132,0.0 1497.9785710062422,3058.96372410586,0.0 1514.411888553988,3079.3082737523705,0.0 1530.2598401969026,3097.3466582027486,0.0 1545.4598813100906,3113.007688194524,0.0 1559.9520242755168,3126.2295567971614,0.0 1573.6790752257268,3136.9600833357854,0.0 1586.5868597619135,3145.156919324457,0.0 1598.6244367555187,3150.787715596309,0.0 1609.7442993895934,3153.830249970922,0.0 1619.9025626465038,3154.2725149551206,0.0 1629.0591365020434,3152.1127651310644,0.0 1637.1778841424455,3147.359524044613,0.0 1644.226764579876,3140.0315505667845,0.0 1650.1779591035759,3130.157764861065,0.0 1655.007981067602,3117.77713424873,0.0 1658.6977685818897,3102.9385194226343,0.0 1661.2327597408237,3085.700481616379,0.0 1662.6029500924267,3066.1310514898746,0.0 1662.8029321213612,3044.3074606434075,0.0 1661.8319165899227,3020.3158368197996,0.0 1659.6937356527985,2994.250863997552,0.0 1656.3968277333056,2966.2154087164404,0.0 1651.9542042207884,2936.320114110279,0.0 1646.383398120609,2904.682963249016,0.0 1639.7063948593857,2871.4288135134625,0.0 1631.9495455185581,2836.6889038402487,0.0 1623.143462838707,2800.6003367816993,0.0 1613.3229004050527,2763.305537424697,0.0 1602.5266154909332,2724.9516913039297,0.0 1590.7972161005512,2685.6901635278323,0.0 1578.1809928146474,2645.6759014096497,0.0 1564.727736102727,2605.0668229611847,0.0 1550.4905398228243,2564.0231936625514,0.0 1535.5255916842991,2522.706993967541,0.0 1519.8919515006196,2481.281280040772,0.0 1503.6513181072605,2439.909540249506,0.0 1486.8677858645856,2398.7550499497493,0.0 1469.6075917066898,2357.980227113016,0.0 1451.9388537344823,2317.7459913367984,0.0 1433.9313023846603,2278.2111287684315,0.0 1415.6560052355344,2239.531665448713,0.0 1397.1850865357628,2201.860251548398,0.0 1378.5914425628937,2165.34555892772,0.0 1359.9484539350592,2130.131694396476,0.0 1341.3296960112032,2096.3576309902883,0.0 1322.8086485227493,2064.1566595075174,0.0 1304.4584055826729,2033.655862471382,0.0 1286.3513872164294,2004.9756125932952,0.0 1268.5590535532012,1978.229097716765,0.0 1251.151622805412,1953.5218741166893,0.0 1234.1977941495259,1930.9514499169616,0.0 1217.76447660178,1910.6069002704514,0.0 1201.9165249588657,1892.568515820073,0.0 1186.7164838456777,1876.9074858282981,0.0 1172.2243408802512,1863.68561722566,0.0 1158.4972899300412,1852.9550906870368,0.0 1145.5895053938546,1844.7582546983645,0.0 1133.5519284002494,1839.1274584265125,0.0 1122.4320657661747,1836.0849240518999,0.0 -8.267624328036598,39.399689834676806,0.0</coordinates>
80+
</LinearRing>
81+
</outerBoundaryIs>
82+
</Polygon>
83+
</MultiGeometry>
84+
</Placemark>
85+
</Document>
86+
</kml>

0 commit comments

Comments
 (0)