Skip to content

Commit

Permalink
MNT: notebooks and some docs renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
MateusStano committed Feb 8, 2024
1 parent 15c8219 commit c60bbab
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"!git clone https://github.com/RocketPy-Team/RocketPy.git\n",
"import os\n",
"\n",
"os.chdir(\"RocketPy/docs/notebooks/dispersion_analysis\")"
"os.chdir(\"RocketPy/docs/notebooks/monte_carlo_analysis\")"
]
},
{
Expand Down Expand Up @@ -382,7 +382,7 @@
],
"source": [
"# Basic analysis info\n",
"filename = \"dispersion_analysis_outputs/valetudo_rocket_v0\"\n",
"filename = \"monte_carlo_analysis_outputs/valetudo_rocket_v0\"\n",
"number_of_simulations = 100\n",
"\n",
"# Create data files for inputs, outputs and error logging\n",
Expand All @@ -402,7 +402,7 @@
"Env.max_expected_height = 1500\n",
"Env.set_atmospheric_model(\n",
" type=\"Ensemble\",\n",
" file=\"dispersion_analysis_inputs/LASC2019_reanalysis.nc\",\n",
" file=\"monte_carlo_analysis_inputs/LASC2019_reanalysis.nc\",\n",
" dictionary=\"ECMWF\",\n",
")\n",
"\n",
Expand All @@ -426,7 +426,7 @@
"\n",
" # Create motor\n",
" Keron = SolidMotor(\n",
" thrust_source=\"dispersion_analysis_inputs/thrustCurve.csv\",\n",
" thrust_source=\"monte_carlo_analysis_inputs/thrustCurve.csv\",\n",
" burn_time=5.274,\n",
" reshape_thrust_curve=(setting[\"burn_time\"], setting[\"impulse\"]),\n",
" nozzle_radius=setting[\"nozzle_radius\"],\n",
Expand Down Expand Up @@ -458,8 +458,8 @@
" setting[\"rocket_inertia_11\"],\n",
" setting[\"rocket_inertia_33\"],\n",
" ),\n",
" power_off_drag=\"dispersion_analysis_inputs/Cd_PowerOff.csv\",\n",
" power_on_drag=\"dispersion_analysis_inputs/Cd_PowerOn.csv\",\n",
" power_off_drag=\"monte_carlo_analysis_inputs/Cd_PowerOff.csv\",\n",
" power_on_drag=\"monte_carlo_analysis_inputs/Cd_PowerOn.csv\",\n",
" center_of_mass_without_motor=0,\n",
" coordinate_system_orientation=\"tail_to_nose\",\n",
" )\n",
Expand Down Expand Up @@ -572,7 +572,7 @@
}
],
"source": [
"filename = \"dispersion_analysis_outputs/valetudo_rocket_v0\"\n",
"filename = \"monte_carlo_analysis_outputs/valetudo_rocket_v0\"\n",
"\n",
"# Initialize variable to store all results\n",
"dispersion_general_results = []\n",
Expand Down Expand Up @@ -12892,9 +12892,7 @@
")\n",
"\n",
"plt.figure()\n",
"plt.hist(\n",
" dispersion_results[\"initial_static_margin\"], label=\"Initial\", bins=int(N**0.5)\n",
")\n",
"plt.hist(dispersion_results[\"initial_static_margin\"], label=\"Initial\", bins=int(N**0.5))\n",
"plt.hist(\n",
" dispersion_results[\"out_of_rail_static_margin\"],\n",
" label=\"Out of Rail\",\n",
Expand Down Expand Up @@ -20354,7 +20352,7 @@
"from matplotlib.patches import Ellipse\n",
"\n",
"# Import background map\n",
"img = imread(\"dispersion_analysis_inputs/Valetudo_basemap_final.jpg\")\n",
"img = imread(\"monte_carlo_analysis_inputs/Valetudo_basemap_final.jpg\")\n",
"\n",
"# Retrieve dispersion data por apogee and impact XY position\n",
"apogee_x = np.array(dispersion_results[\"apogee_x\"])\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@
"metadata": {},
"outputs": [],
"source": [
"env = Environment(\n",
" latitude=39.389700, longitude=-8.288964, elevation=113\n",
")\n",
"env = Environment(latitude=39.389700, longitude=-8.288964, elevation=113)\n",
"\n",
"tomorrow = datetime.date.today() + datetime.timedelta(days=1)\n",
"\n",
"env.set_date((tomorrow.year, tomorrow.month, tomorrow.day, 12)) # Hour given in UTC time\n",
"env.set_date(\n",
" (tomorrow.year, tomorrow.month, tomorrow.day, 12)\n",
") # Hour given in UTC time\n",
"\n",
"env.set_atmospheric_model(type=\"Ensemble\", file=\"GEFS\")\n"
"env.set_atmospheric_model(type=\"Ensemble\", file=\"GEFS\")"
]
},
{
Expand Down Expand Up @@ -151,7 +151,7 @@
"source": [
"mc_env = StochasticEnvironment(\n",
" environment=env,\n",
" ensemble_member = list(range(env.num_ensemble_members)),\n",
" ensemble_member=list(range(env.num_ensemble_members)),\n",
" wind_velocity_x_factor=(1.0, 0.33, \"normal\"),\n",
" wind_velocity_y_factor=(1.0, 0.33, \"normal\"),\n",
")\n",
Expand All @@ -175,9 +175,9 @@
"source": [
"wind_x_at_1000m = []\n",
"for i in range(10):\n",
" rnd_env=mc_env.create_object()\n",
" rnd_env = mc_env.create_object()\n",
" wind_x_at_1000m.append(rnd_env.wind_velocity_x(1000))\n",
" \n",
"\n",
"print(wind_x_at_1000m)"
]
},
Expand Down Expand Up @@ -280,8 +280,12 @@
"source": [
"mc_motor = StochasticSolidMotor(\n",
" solid_motor=motor,\n",
" thrust_source=[\"../../../data/motors/Cesaroni_M1670.eng\",[[0,6000],[1,6000],[2,6000],[3,6000],[4,6000]], Function([[0,6000],[1,6000],[2,6000],[3,6000],[4,6000]])],\n",
" burn_start_time=(0, .1),\n",
" thrust_source=[\n",
" \"../../../data/motors/Cesaroni_M1670.eng\",\n",
" [[0, 6000], [1, 6000], [2, 6000], [3, 6000], [4, 6000]],\n",
" Function([[0, 6000], [1, 6000], [2, 6000], [3, 6000], [4, 6000]]),\n",
" ],\n",
" burn_start_time=(0, 0.1),\n",
" grains_center_of_mass_position=0.001,\n",
" grain_density=50,\n",
" grain_separation=1 / 1000,\n",
Expand Down Expand Up @@ -312,9 +316,9 @@
"source": [
"total_impulse = []\n",
"for i in range(10):\n",
" rnd_motor=mc_motor.create_object()\n",
" rnd_motor = mc_motor.create_object()\n",
" total_impulse.append(rnd_motor.total_impulse)\n",
" \n",
"\n",
"print(total_impulse)"
]
},
Expand Down Expand Up @@ -503,7 +507,7 @@
"mc_rocket.add_nose(mc_nose_cone, position=(1.134, 0.001))\n",
"mc_rocket.add_trapezoidal_fins(mc_fin_set, position=(0.001, \"normal\"))\n",
"mc_rocket.add_tail(mc_tail)\n",
"mc_rocket.set_rail_buttons(mc_rail_buttons,lower_button_position=(0.001, \"normal\"))\n",
"mc_rocket.set_rail_buttons(mc_rail_buttons, lower_button_position=(0.001, \"normal\"))\n",
"mc_rocket.add_parachute(mc_main)\n",
"mc_rocket.add_parachute(mc_drogue)"
]
Expand Down Expand Up @@ -598,7 +602,7 @@
],
"source": [
"for i in range(10):\n",
" rnd_rocket=mc_rocket.create_object()\n",
" rnd_rocket = mc_rocket.create_object()\n",
" print(rnd_rocket.static_margin(0))"
]
},
Expand Down Expand Up @@ -710,7 +714,7 @@
"outputs": [],
"source": [
"test_dispersion = MonteCarlo(\n",
" filename=\"dispersion_analysis_outputs/disp_class_example4\",\n",
" filename=\"monte_carlo_analysis_outputs/disp_class_example4\",\n",
" environment=mc_env,\n",
" rocket=mc_rocket,\n",
" flight=mc_flight,\n",
Expand Down Expand Up @@ -753,7 +757,7 @@
}
],
"source": [
"test_dispersion.simulate(number_of_simulations=1,append=False)"
"test_dispersion.simulate(number_of_simulations=1, append=False)"
]
},
{
Expand Down Expand Up @@ -1091,7 +1095,7 @@
"outputs": [],
"source": [
"test_dispersion.exportEllipsesToKML(\n",
" filename=\"dispersion_analysis_outputs/disp_class_example.kml\",\n",
" filename=\"monte_carlo_analysis_outputs/disp_class_example.kml\",\n",
" origin_lat=env.latitude,\n",
" origin_lon=env.longitude,\n",
" type=\"impact\",\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"!git clone https://github.com/giovaniceotto/RocketPy.git\n",
"import os\n",
"\n",
"os.chdir(\"RocketPy/docs/notebooks/dispersion_analysis\")"
"os.chdir(\"RocketPy/docs/notebooks/monte_carlo_analysis\")"
]
},
{
Expand Down Expand Up @@ -391,7 +391,7 @@
"outputs": [],
"source": [
"# Basic analysis info\n",
"filename = \"dispersion_analysis_outputs/parachute_drop_from_helicopter\"\n",
"filename = \"monte_carlo_analysis_outputs/parachute_drop_from_helicopter\"\n",
"number_of_simulations = 4000\n",
"\n",
"# Create data files for inputs, outputs and error logging\n",
Expand All @@ -413,7 +413,7 @@
"Env.maxExpectedHeight = 1500\n",
"Env.setAtmosphericModel(\n",
" type=\"Ensemble\",\n",
" file=\"dispersion_analysis_inputs/LASC2019_reanalysis.nc\",\n",
" file=\"monte_carlo_analysis_inputs/LASC2019_reanalysis.nc\",\n",
" dictionary=\"ECMWF\",\n",
")\n",
"\n",
Expand All @@ -436,7 +436,7 @@
"\n",
" # Create motor\n",
" Keron = SolidMotor(\n",
" thrustSource=\"dispersion_analysis_inputs/thrustCurve.csv\",\n",
" thrustSource=\"monte_carlo_analysis_inputs/thrustCurve.csv\",\n",
" burn_time=5.274,\n",
" reshapeThrustCurve=(setting[\"burn_time\"], setting[\"impulse\"]),\n",
" nozzle_radius=setting[\"nozzle_radius\"],\n",
Expand All @@ -459,8 +459,8 @@
" mass=setting[\"rocketMass\"],\n",
" inertiaI=setting[\"inertiaI\"],\n",
" inertiaZ=setting[\"inertiaZ\"],\n",
" powerOffDrag=\"dispersion_analysis_inputs/Cd_PowerOff.csv\",\n",
" powerOnDrag=\"dispersion_analysis_inputs/Cd_PowerOn.csv\",\n",
" powerOffDrag=\"monte_carlo_analysis_inputs/Cd_PowerOff.csv\",\n",
" powerOnDrag=\"monte_carlo_analysis_inputs/Cd_PowerOn.csv\",\n",
" centerOfDryMassPosition=0,\n",
" coordinateSystemOrientation=\"tailToNose\",\n",
" )\n",
Expand Down Expand Up @@ -581,7 +581,7 @@
},
"outputs": [],
"source": [
"filename = \"dispersion_analysis_outputs/parachute_drop_from_helicopter\"\n",
"filename = \"monte_carlo_analysis_outputs/parachute_drop_from_helicopter\"\n",
"\n",
"# Initialize variable to store all results\n",
"dispersion_general_results = []\n",
Expand Down Expand Up @@ -1165,7 +1165,7 @@
"from matplotlib.patches import Ellipse\n",
"\n",
"# Import background map\n",
"img = imread(\"dispersion_analysis_inputs/Valetudo_basemap_final.jpg\")\n",
"img = imread(\"monte_carlo_analysis_inputs/Valetudo_basemap_final.jpg\")\n",
"\n",
"# Retrieve dispersion data por apogee and impact XY position\n",
"apogeeX = np.array(dispersion_results[\"apogeeX\"])\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/user/first_simulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ analysis. Here we will show some examples, but much more can be done!
.. seealso::
*RocketPy* can be used to perform a Monte Carlo Dispersion Analysis.
See
`Monte Carlo Simulations <https://colab.research.google.com/github/RocketPy-Team/rocketpy/blob/master/docs/notebooks/dispersion_analysis/dispersion_analysis.html>`_
`Monte Carlo Simulations <https://colab.research.google.com/github/RocketPy-Team/rocketpy/blob/master/docs/notebooks/monte_carlo_analysis/monte_carlo_analysis.html>`_
for more information.

Apogee as a Function of Mass
Expand Down
4 changes: 2 additions & 2 deletions docs/user/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ RocketPy's User Guide
:maxdepth: 2
:caption: Dispersion Analysis

../notebooks/dispersion_analysis/dispersion_analysis.ipynb
../notebooks/dispersion_analysis/parachute_drop_from_helicopter.ipynb
../notebooks/monte_carlo_analysis/monte_carlo_analysis.ipynb
../notebooks/monte_carlo_analysis/parachute_drop_from_helicopter.ipynb

.. toctree::
:maxdepth: 2
Expand Down

0 comments on commit c60bbab

Please sign in to comment.