Skip to content

Commit

Permalink
Merge pull request #544 from RocketPy-Team/doc/issue-526
Browse files Browse the repository at this point in the history
DOC: Replacing git clone command with curl in notebooks.
  • Loading branch information
Gui-FernandesBR authored Feb 5, 2024
2 parents 2fee77e + be46ce8 commit 435bd62
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 127 deletions.
30 changes: 11 additions & 19 deletions docs/notebooks/deployable_payload_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"\n",
"* RocketPy\n",
"* netCDF4 (to get weather forecasts)\n",
"* Data files (we will clone RocketPy's repository for these)\n",
"* Data files (we will download RocketPy's data from github)\n",
"\n",
"Therefore, let's run the following lines of code:"
]
Expand All @@ -45,18 +45,10 @@
"outputs": [],
"source": [
"!pip install rocketpy netCDF4\n",
"!git clone https://github.com/RocketPy-Team/RocketPy.git"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"\n",
"os.chdir(\"RocketPy/docs/notebooks\")"
"!curl -o NACA0012-radians.csv https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/data/calisto/NACA0012-radians.csv\n",
"!curl -o Cesaroni_M1670.eng https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/data/motors/Cesaroni_M1670.eng\n",
"!curl -o powerOffDragCurve.csv https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/data/calisto/powerOffDragCurve.csv\n",
"!curl -o powerOnDragCurve.csv https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/data/calisto/powerOnDragCurve.csv"
]
},
{
Expand Down Expand Up @@ -237,7 +229,7 @@
"outputs": [],
"source": [
"Pro75M1670 = SolidMotor(\n",
" thrust_source=\"../../data/motors/Cesaroni_M1670.eng\",\n",
" thrust_source=\"Cesaroni_M1670.eng\",\n",
" dry_mass=1.815,\n",
" dry_inertia=(0.125, 0.125, 0.002),\n",
" nozzle_radius=33 / 1000,\n",
Expand Down Expand Up @@ -392,8 +384,8 @@
" radius=127 / 2000,\n",
" mass=rocket_mass + rocket_mass,\n",
" inertia=(6.321, 6.321, 0.034),\n",
" power_off_drag=\"../../data/calisto/powerOffDragCurve.csv\",\n",
" power_on_drag=\"../../data/calisto/powerOnDragCurve.csv\",\n",
" power_off_drag=\"powerOffDragCurve.csv\",\n",
" power_on_drag=\"powerOnDragCurve.csv\",\n",
" center_of_mass_without_motor=0,\n",
" coordinate_system_orientation=\"tail_to_nose\",\n",
")\n",
Expand All @@ -417,7 +409,7 @@
" span=0.110,\n",
" position=-1.04956,\n",
" cant_angle=0.5,\n",
" airfoil=(\"../../data/calisto/NACA0012-radians.csv\",\"radians\"),\n",
" airfoil=(\"NACA0012-radians.csv\",\"radians\"),\n",
")\n",
"\n",
"rocket_with_payload.add_tail(\n",
Expand Down Expand Up @@ -536,8 +528,8 @@
" radius=127 / 2000,\n",
" mass=rocket_mass,\n",
" inertia=(6.321, 6.321, 0.034),\n",
" power_off_drag=\"../../data/calisto/powerOffDragCurve.csv\",\n",
" power_on_drag=\"../../data/calisto/powerOnDragCurve.csv\",\n",
" power_off_drag=\"powerOffDragCurve.csv\",\n",
" power_on_drag=\"powerOnDragCurve.csv\",\n",
" center_of_mass_without_motor=0,\n",
" coordinate_system_orientation=\"tail_to_nose\",\n",
")\n",
Expand Down
14 changes: 8 additions & 6 deletions docs/notebooks/dispersion_analysis/dispersion_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Clone repository if using Google Colab\n",
"## Download data files if using Google Colab\n",
"\n",
"If you are running this using Binder, or you are running locally with the necessary files, you do not need to run this.\n",
"On the other hand, if you are running on Google Colab, make sure to run the cell below to clone the repository and download the necessary files."
"On the other hand, if you are running on Google Colab, make sure to run the cell below to download the necessary files."
]
},
{
Expand All @@ -37,10 +37,12 @@
"metadata": {},
"outputs": [],
"source": [
"!git clone https://github.com/RocketPy-Team/RocketPy.git\n",
"import os\n",
"\n",
"os.chdir(\"RocketPy/docs/notebooks/dispersion_analysis\")"
"!curl -o dispersion_analysis_inputs/Cd_PowerOff.csv --create-dirs https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/Cd_PowerOff.csv\n",
"!curl -o dispersion_analysis_inputs/Cd_PowerOn.csv --create-dirs https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/Cd_PowerOn.csv\n",
"!curl -o dispersion_analysis_inputs/LASC2019_reanalysis.nc --create-dirs https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/LASC2019_reanalysis.nc\n",
"!curl -o dispersion_analysis_inputs/thrustCurve.csv --create-dirs https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/thrustCurve.csv\n",
"!curl -o dispersion_analysis_inputs/Valetudo_basemap_final.jpg --create-dirs https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/Valetudo_basemap_final.jpg\n",
"!mkdir -p dispersion_analysis_outputs"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Clone repository if using Google Colab\n",
"## Clone data files if using Google Colab\n",
"\n",
"If you are running this using Binder, or you are running locally with the necessary files, you do not need to run this.\n",
"On the other hand, if you are running on Google Colab, make sure to run the cell below to clone the repository and download the necessary files."
"On the other hand, if you are running on Google Colab, make sure to run the cell below to download the necessary files."
]
},
{
Expand All @@ -31,10 +31,12 @@
"metadata": {},
"outputs": [],
"source": [
"!git clone https://github.com/giovaniceotto/RocketPy.git\n",
"import os\n",
"\n",
"os.chdir(\"RocketPy/docs/notebooks/dispersion_analysis\")"
"!curl -o dispersion_analysis_inputs/Cd_PowerOff.csv --create-dirs https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/Cd_PowerOff.csv\n",
"!curl -o dispersion_analysis_inputs/Cd_PowerOn.csv --create-dirs https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/Cd_PowerOn.csv\n",
"!curl -o dispersion_analysis_inputs/LASC2019_reanalysis.nc --create-dirs https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/LASC2019_reanalysis.nc\n",
"!curl -o dispersion_analysis_inputs/thrustCurve.csv --create-dirs https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/thrustCurve.csv\n",
"!curl -o dispersion_analysis_inputs/Valetudo_basemap_final.jpg --create-dirs https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/notebooks/dispersion_analysis/dispersion_analysis_inputs/Valetudo_basemap_final.jpg\n",
"!mkdir -p dispersion_analysis_outputs"
]
},
{
Expand Down
30 changes: 9 additions & 21 deletions docs/notebooks/getting_started_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"We start by setting up our environment. To run this notebook, we will need:\n",
"\n",
"- RocketPy\n",
"- Data files (we will clone RocketPy's repository for these)\n",
"- Data files (we will download RocketPy's data from github)\n",
"\n",
"Therefore, let's run the following lines of code:"
]
Expand All @@ -38,22 +38,10 @@
"outputs": [],
"source": [
"!pip install rocketpy\n",
"!git clone https://github.com/giovaniceotto/RocketPy.git"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "pY5XGge5OoGJ"
},
"outputs": [],
"source": [
"import os\n",
"\n",
"os.chdir(\"RocketPy/docs/notebooks\")"
"!curl -o NACA0012-radians.csv https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/data/calisto/NACA0012-radians.csv\n",
"!curl -o Cesaroni_M1670.eng https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/data/motors/Cesaroni_M1670.eng\n",
"!curl -o powerOffDragCurve.csv https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/data/calisto/powerOffDragCurve.csv\n",
"!curl -o powerOnDragCurve.csv https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/data/calisto/powerOnDragCurve.csv"
]
},
{
Expand Down Expand Up @@ -2485,7 +2473,7 @@
"outputs": [],
"source": [
"Pro75M1670 = SolidMotor(\n",
" thrust_source=\"../../data/motors/Cesaroni_M1670.eng\",\n",
" thrust_source=\"Cesaroni_M1670.eng\",\n",
" dry_mass=1.815,\n",
" dry_inertia=(0.125, 0.125, 0.002),\n",
" nozzle_radius=33 / 1000,\n",
Expand Down Expand Up @@ -3499,8 +3487,8 @@
" radius=127 / 2000,\n",
" mass=14.426,\n",
" inertia=(6.321, 6.321, 0.034),\n",
" power_off_drag=\"../../data/calisto/powerOffDragCurve.csv\",\n",
" power_on_drag=\"../../data/calisto/powerOnDragCurve.csv\",\n",
" power_off_drag=\"powerOffDragCurve.csv\",\n",
" power_on_drag=\"powerOnDragCurve.csv\",\n",
" center_of_mass_without_motor=0,\n",
" coordinate_system_orientation=\"tail_to_nose\",\n",
")\n",
Expand Down Expand Up @@ -3579,7 +3567,7 @@
" span=0.110,\n",
" position=-1.04956,\n",
" cant_angle=0.5,\n",
" airfoil=(\"../../data/calisto/NACA0012-radians.csv\",\"radians\"),\n",
" airfoil=(\"NACA0012-radians.csv\",\"radians\"),\n",
")\n",
"\n",
"tail = calisto.add_tail(\n",
Expand Down
8 changes: 4 additions & 4 deletions rocketpy/environment/environment_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,10 +901,10 @@ def __parse_surface_data(self):
# Extract data from weather file
indices = (time_index, lon_index, lat_index)
for key, value in surface_file_dict.items():
dictionary[date_string][hour_string][
key
] = self.__extract_surface_data_value(
surface_data, value, indices, lon_array, lat_array
dictionary[date_string][hour_string][key] = (

Check warning on line 904 in rocketpy/environment/environment_analysis.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/environment/environment_analysis.py#L904

Added line #L904 was not covered by tests
self.__extract_surface_data_value(
surface_data, value, indices, lon_array, lat_array
)
)

# Get elevation, time index does not matter, use last one
Expand Down
1 change: 1 addition & 0 deletions rocketpy/mathutils/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
and more. This is a core class of our package, and should be maintained
carefully as it may impact all the rest of the project.
"""

import warnings
from collections.abc import Iterable
from copy import deepcopy
Expand Down
40 changes: 25 additions & 15 deletions rocketpy/plots/flight_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,11 @@ def rail_buttons_forces(self):
)
ax1.set_xlim(
0,
self.flight.out_of_rail_time
if self.flight.out_of_rail_time > 0
else self.flight.tFinal,
(
self.flight.out_of_rail_time
if self.flight.out_of_rail_time > 0
else self.flight.tFinal
),
)
ax1.legend()
ax1.grid(True)
Expand Down Expand Up @@ -431,9 +433,11 @@ def rail_buttons_forces(self):
)
ax2.set_xlim(
0,
self.flight.out_of_rail_time
if self.flight.out_of_rail_time > 0
else self.flight.tFinal,
(
self.flight.out_of_rail_time
if self.flight.out_of_rail_time > 0
else self.flight.tFinal
),
)
ax2.legend()
ax2.grid(True)
Expand Down Expand Up @@ -557,9 +561,11 @@ def energy_data(self):
)
ax1.set_xlim(
0,
self.flight.apogee_time
if self.flight.apogee_time != 0.0
else self.flight.t_final,
(
self.flight.apogee_time
if self.flight.apogee_time != 0.0
else self.flight.t_final
),
)
ax1.ticklabel_format(style="sci", axis="y", scilimits=(0, 0))
ax1.set_title("Kinetic Energy Components")
Expand Down Expand Up @@ -587,9 +593,11 @@ def energy_data(self):
)
ax2.set_xlim(
0,
self.flight.apogee_time
if self.flight.apogee_time != 0.0
else self.flight.t_final,
(
self.flight.apogee_time
if self.flight.apogee_time != 0.0
else self.flight.t_final
),
)
ax2.ticklabel_format(style="sci", axis="y", scilimits=(0, 0))
ax2.set_title("Total Mechanical Energy Components")
Expand Down Expand Up @@ -620,9 +628,11 @@ def energy_data(self):
)
ax4.set_xlim(
0,
self.flight.apogee_time
if self.flight.apogee_time != 0.0
else self.flight.t_final,
(
self.flight.apogee_time
if self.flight.apogee_time != 0.0
else self.flight.t_final
),
)
ax3.ticklabel_format(style="sci", axis="y", scilimits=(0, 0))
ax4.set_title("Drag Absolute Power")
Expand Down
8 changes: 2 additions & 6 deletions rocketpy/rocket/aero_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,10 +1180,7 @@ def evaluate_geometrical_parameters(self):
* (self.root_chord + 2 * self.tip_chord)
* self.rocket_radius
* self.span**2
+ 6
* (self.root_chord + self.tip_chord)
* self.span
* self.rocket_radius**2
+ 6 * (self.root_chord + self.tip_chord) * self.span * self.rocket_radius**2
) / 12
roll_damping_interference_factor = 1 + (
((tau - λ) / (tau)) - ((1 - λ) / (tau - 1)) * np.log(tau)
Expand Down Expand Up @@ -1506,8 +1503,7 @@ def evaluate_geometrical_parameters(self):
* self.rocket_radius**2
* np.sqrt(-self.span**2 + self.rocket_radius**2)
* np.arctan(
(self.span)
/ (np.sqrt(-self.span**2 + self.rocket_radius**2))
(self.span) / (np.sqrt(-self.span**2 + self.rocket_radius**2))
)
- np.pi
* self.rocket_radius**2
Expand Down
Loading

0 comments on commit 435bd62

Please sign in to comment.