Skip to content

Commit

Permalink
MNT: apply isort and black to all the files
Browse files Browse the repository at this point in the history
  • Loading branch information
Gui-FernandesBR committed Feb 8, 2024
1 parent b2bab4d commit 6da602c
Show file tree
Hide file tree
Showing 12 changed files with 1,637 additions and 1,643 deletions.
18 changes: 8 additions & 10 deletions docs/examples/ndrt_2020_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"source": [
"parameters = {\n",
" # Mass Details\n",
" \"rocket_mass\": (18.998, 0.010), # Rocket dry mass: 20.846 kg\n",
" \"rocket_mass\": (18.998, 0.010), # Rocket dry mass: 20.846 kg\n",
" # propulsion details\n",
" \"motor_structure_mass\": (1.848, 0.1),\n",
" \"burn_time\": (3.433, 0.1),\n",
Expand Down Expand Up @@ -222,7 +222,7 @@
" throat_radius=parameters.get(\"throat_radius\")[0],\n",
" interpolation_method=\"linear\",\n",
" nozzle_position=parameters.get(\"nozzle_position\")[0],\n",
" coordinate_system_orientation=\"combustion_chamber_to_nozzle\" #combustion_chamber_to_nozzle\"\n",
" coordinate_system_orientation=\"combustion_chamber_to_nozzle\", # combustion_chamber_to_nozzle\"\n",
")"
]
},
Expand Down Expand Up @@ -329,9 +329,7 @@
")\n",
"ndrt2020.set_rail_buttons(1.5, 2, 45)\n",
"\n",
"ndrt2020.add_motor(\n",
" motor=motor_l1395, position=parameters.get(\"motor_position\")[0]\n",
")"
"ndrt2020.add_motor(motor=motor_l1395, position=parameters.get(\"motor_position\")[0])"
]
},
{
Expand All @@ -358,7 +356,7 @@
"nose_cone = ndrt2020.add_nose(\n",
" length=parameters.get(\"nose_length\")[0],\n",
" kind=\"tangent\",\n",
" position=parameters.get(\"nose_position\")[0]\n",
" position=parameters.get(\"nose_position\")[0],\n",
")\n",
"fin_set = ndrt2020.add_trapezoidal_fins(\n",
" 4,\n",
Expand Down Expand Up @@ -700,7 +698,7 @@
" outputs=\"Altitude above ground level (m)\",\n",
" interpolation=\"linear\",\n",
" extrapolation=\"zero\",\n",
") # the division by 3.281 is to convert from feet to meters"
") # the division by 3.281 is to convert from feet to meters"
]
},
{
Expand Down Expand Up @@ -740,7 +738,7 @@
],
"source": [
"Function.compare_plots(\n",
" plot_list=[(actual_vz, \"Actual\"),(actual_vz_filtered, \"Filtered\")],\n",
" plot_list=[(actual_vz, \"Actual\"), (actual_vz_filtered, \"Filtered\")],\n",
" ylabel=\"Vertical velocity (m/s)\",\n",
" title=\"Vertical velocity\",\n",
" xlabel=\"Time (s)\",\n",
Expand Down Expand Up @@ -785,11 +783,11 @@
],
"source": [
"Function.compare_plots(\n",
" plot_list=[(actual_az, \"Actual\"),(actual_az_filtered, \"Filtered\")],\n",
" plot_list=[(actual_az, \"Actual\"), (actual_az_filtered, \"Filtered\")],\n",
" ylabel=\"Vertical acceleration (m/s^2)\",\n",
" title=\"Vertical acceleration\",\n",
" xlabel=\"Time (s)\",\n",
")\n"
")"
]
},
{
Expand Down
12 changes: 6 additions & 6 deletions docs/notebooks/air_brakes_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@
" altitude_ASL = state[2]\n",
" altitude_AGL = altitude_ASL - env.elevation\n",
" vx, vy, vz = state[3], state[4], state[5]\n",
" \n",
"\n",
" # Get winds in x and y directions\n",
" wind_x, wind_y = env.wind_velocity_x(altitude_ASL), env.wind_velocity_y(altitude_ASL)\n",
" \n",
" wind_x, wind_y = env.wind_velocity_x(altitude_ASL), env.wind_velocity_y(\n",
" altitude_ASL\n",
" )\n",
"\n",
" # Calculate Mach number\n",
" free_stream_speed = (\n",
" (wind_x - vx) ** 2 + (wind_y - vy) ** 2 + (vz) ** 2\n",
" ) ** 0.5\n",
" free_stream_speed = ((wind_x - vx) ** 2 + (wind_y - vy) ** 2 + (vz) ** 2) ** 0.5\n",
" mach_number = free_stream_speed / env.speed_of_sound(altitude_ASL)\n",
"\n",
" # Get previous state from state_history\n",
Expand Down
10 changes: 4 additions & 6 deletions docs/notebooks/compare_flights_usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"env = Environment(latitude=-23, longitude=-49, date=after_tomorrow)\n",
"env.set_atmospheric_model(type=\"Forecast\", file=\"GFS\")\n",
"\n",
"Pro75M1670 = SolidMotor(\n",
"Pro75M1670 = SolidMotor(\n",
" thrust_source=\"../../data/motors/Cesaroni_M1670.eng\",\n",
" dry_mass=1.815,\n",
" dry_inertia=(0.125, 0.125, 0.002),\n",
Expand Down Expand Up @@ -109,9 +109,7 @@
"\n",
"calisto.add_motor(Pro75M1670, position=-1.255)\n",
"\n",
"nosecone = calisto.add_nose(\n",
" length=0.55829, kind=\"vonKarman\", position=1.278\n",
")\n",
"nosecone = calisto.add_nose(length=0.55829, kind=\"vonKarman\", position=1.278)\n",
"\n",
"fin_set = calisto.add_trapezoidal_fins(\n",
" n=4,\n",
Expand All @@ -120,7 +118,7 @@
" span=0.110,\n",
" position=-1.04956,\n",
" cant_angle=0.5,\n",
" airfoil=(\"../../data/calisto/NACA0012-radians.csv\",\"radians\"),\n",
" airfoil=(\"../../data/calisto/NACA0012-radians.csv\", \"radians\"),\n",
")\n",
"\n",
"tail = calisto.add_tail(\n",
Expand Down Expand Up @@ -194,7 +192,7 @@
" heading=heading,\n",
" name=f\"Incl {inclination} Head {heading}\",\n",
" )\n",
" flights.append(flight)\n"
" flights.append(flight)"
]
},
{
Expand Down
32 changes: 18 additions & 14 deletions docs/notebooks/deployable_payload_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@
"metadata": {},
"outputs": [],
"source": [
"env = Environment(\n",
" latitude=32.990254, longitude=-106.974998, elevation=1400\n",
")"
"env = Environment(latitude=32.990254, longitude=-106.974998, elevation=1400)"
]
},
{
Expand All @@ -140,7 +138,9 @@
"\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=\"Forecast\", file=\"GFS\")\n",
"env.max_expected_height = 8000"
Expand Down Expand Up @@ -345,7 +345,11 @@
"payload_mass = 4.5 # in kg\n",
"rocket_mass = 14.426 - payload_mass # in kg\n",
"\n",
"print(\"Rocket Mass Without Motor: {:.4} kg (with Payload)\".format(rocket_mass + payload_mass))\n",
"print(\n",
" \"Rocket Mass Without Motor: {:.4} kg (with Payload)\".format(\n",
" rocket_mass + payload_mass\n",
" )\n",
")\n",
"print(\"Loaded Motor Mass: {:.4} kg\".format(Pro75M1670.total_mass(0)))\n",
"print(\"Payload Mass: {:.4} kg\".format(payload_mass))\n",
"print(\n",
Expand Down Expand Up @@ -398,9 +402,7 @@
" angular_position=45,\n",
")\n",
"\n",
"rocket_with_payload.add_nose(\n",
" length=0.55829, kind=\"von karman\", position=1.278\n",
")\n",
"rocket_with_payload.add_nose(length=0.55829, kind=\"von karman\", position=1.278)\n",
"\n",
"rocket_with_payload.add_trapezoidal_fins(\n",
" n=4,\n",
Expand All @@ -409,7 +411,7 @@
" span=0.110,\n",
" position=-1.04956,\n",
" cant_angle=0.5,\n",
" airfoil=(\"NACA0012-radians.csv\",\"radians\"),\n",
" airfoil=(\"NACA0012-radians.csv\", \"radians\"),\n",
")\n",
"\n",
"rocket_with_payload.add_tail(\n",
Expand Down Expand Up @@ -642,7 +644,7 @@
"flight_without_payload = Flight(\n",
" rocket=rocket_without_payload,\n",
" environment=env,\n",
" rail_length=5.2, # does not matter since the flight is starting at apogee\n",
" rail_length=5.2, # does not matter since the flight is starting at apogee\n",
" inclination=0,\n",
" heading=0,\n",
" initial_solution=flight_with_payload,\n",
Expand Down Expand Up @@ -680,10 +682,10 @@
"payload_rocket = Rocket(\n",
" radius=127 / 2000,\n",
" mass=payload_mass,\n",
" inertia=(0.1,0.1,0.001),\n",
" inertia=(0.1, 0.1, 0.001),\n",
" power_off_drag=0.5,\n",
" power_on_drag=0.5,\n",
" center_of_mass_without_motor=0\n",
" center_of_mass_without_motor=0,\n",
")\n",
"\n",
"payload_drogue = payload_rocket.add_parachute(\n",
Expand Down Expand Up @@ -722,7 +724,7 @@
"payload_flight = Flight(\n",
" rocket=payload_rocket,\n",
" environment=env,\n",
" rail_length=5.2, # does not matter since the flight is starting at apogee\n",
" rail_length=5.2, # does not matter since the flight is starting at apogee\n",
" inclination=0,\n",
" heading=0,\n",
" initial_solution=flight_with_payload,\n",
Expand Down Expand Up @@ -770,7 +772,9 @@
"metadata": {},
"outputs": [],
"source": [
"comparison = CompareFlights([flight_with_payload, flight_without_payload, payload_flight])"
"comparison = CompareFlights(\n",
" [flight_with_payload, flight_without_payload, payload_flight]\n",
")"
]
},
{
Expand Down
4 changes: 1 addition & 3 deletions docs/notebooks/dispersion_analysis/dispersion_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12894,9 +12894,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
Loading

0 comments on commit 6da602c

Please sign in to comment.