From 2c41e8b087e24fb10c747fc0062bd94d07ed9056 Mon Sep 17 00:00:00 2001 From: MateusStano Date: Sat, 18 Nov 2023 16:55:45 +0100 Subject: [PATCH] MNT: run black on notebook --- .../dispersion_analysis.ipynb | 71 ++++++++++--------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/docs/notebooks/dispersion_analysis/dispersion_analysis.ipynb b/docs/notebooks/dispersion_analysis/dispersion_analysis.ipynb index 521ba9058..3ecdf1ad7 100644 --- a/docs/notebooks/dispersion_analysis/dispersion_analysis.ipynb +++ b/docs/notebooks/dispersion_analysis/dispersion_analysis.ipynb @@ -84,7 +84,7 @@ "\n", "import numpy as np\n", "from numpy.random import normal, choice\n", - "from IPython.display import display\n" + "from IPython.display import display" ] }, { @@ -160,7 +160,6 @@ " \"motor_inertia_33\": (0.003, 0.00003),\n", " # Distance between rocket's center of dry mass and motor's center of dry mass (m)\n", " \"motor_dry_mass_position\": (0.5, 0.001),\n", - " \n", " # Propulsion Details - run help(SolidMotor) for more information\n", " # Motor total impulse (N*s)\n", " \"impulse\": (1415.15, 35.3),\n", @@ -180,7 +179,6 @@ " \"grain_initial_inner_radius\": (9.65 / 1000, 0.375 / 1000),\n", " # Motor's grain height (m)\n", " \"grain_initial_height\": (120 / 1000, 1 / 1000),\n", - "\n", " # Aerodynamic Details - run help(Rocket) for more information\n", " # Rocket's radius (kg*m^2)\n", " \"radius\": (40.45 / 1000, 0.001),\n", @@ -204,7 +202,6 @@ " \"fin_tip_chord\": (0.018, 0.0005),\n", " # Axial distance between rocket's center of dry mass and nearest point in its fin (m)\n", " \"fin_distance_to_CM\": (-0.906, 0.001),\n", - "\n", " # Launch and Environment Details - run help(Environment) and help(Flight) for more information\n", " # Launch rail inclination angle relative to the horizontal plane (degrees)\n", " \"inclination\": (84.7, 1),\n", @@ -214,17 +211,15 @@ " \"rail_length\": (5.7, 0.0005),\n", " # Members of the ensemble forecast to be used\n", " \"ensemble_member\": list(range(10)),\n", - "\n", " # Parachute Details - run help(Rocket) for more information\n", " # Drag coefficient times reference area for the drogue chute (m^2)\n", " \"cd_s_drogue\": (0.349 * 1.3, 0.07),\n", " # Time delay between parachute ejection signal is detected and parachute is inflated (s)\n", " \"lag_rec\": (1, 0.5),\n", - " \n", " # Electronic Systems Details - run help(Rocket) for more information\n", " # Time delay between sensor signal is received and ejection signal is fired (s)\n", " \"lag_se\": (0.73, 0.16),\n", - "}\n" + "}" ] }, { @@ -267,7 +262,7 @@ " # Update counter\n", " i += 1\n", " # Yield a flight setting\n", - " yield flight_setting\n" + " yield flight_setting" ] }, { @@ -340,7 +335,7 @@ "\n", "\n", "def export_flight_error(flight_setting):\n", - " dispersion_error_file.write(str(flight_setting) + \"\\n\")\n" + " dispersion_error_file.write(str(flight_setting) + \"\\n\")" ] }, { @@ -403,9 +398,7 @@ "initial_cpu_time = process_time()\n", "\n", "# Define basic Environment object\n", - "Env = Environment(\n", - " date=(2019, 8, 10, 21), latitude=-23.363611, longitude=-48.011389\n", - ")\n", + "Env = Environment(date=(2019, 8, 10, 21), latitude=-23.363611, longitude=-48.011389)\n", "Env.set_elevation(668)\n", "Env.max_expected_height = 1500\n", "Env.set_atmospheric_model(\n", @@ -414,6 +407,7 @@ " dictionary=\"ECMWF\",\n", ")\n", "\n", + "\n", "# Set up parachutes. This rocket, named Valetudo, only has a drogue chute.\n", "def drogue_trigger(p, h, y):\n", " # Check if rocket is going down, i.e. if it has passed the apogee\n", @@ -452,7 +446,7 @@ " dry_inertia=(\n", " setting[\"motor_inertia_11\"],\n", " setting[\"motor_inertia_11\"],\n", - " setting[\"motor_inertia_33\"]\n", + " setting[\"motor_inertia_33\"],\n", " ),\n", " center_of_dry_mass_position=setting[\"motor_dry_mass_position\"],\n", " )\n", @@ -463,7 +457,7 @@ " inertia=(\n", " setting[\"rocket_inertia_11\"],\n", " setting[\"rocket_inertia_11\"],\n", - " setting[\"rocket_inertia_33\"]\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", @@ -626,7 +620,7 @@ "\n", "# Print number of flights simulated\n", "N = len(dispersion_general_results)\n", - "print(\"Number of simulations: \", N)\n" + "print(\"Number of simulations: \", N)" ] }, { @@ -2786,7 +2780,7 @@ "plt.title(\"Out of Rail Velocity\")\n", "plt.xlabel(\"Velocity (m/s)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -3826,7 +3820,7 @@ "plt.title(\"Apogee Time\")\n", "plt.xlabel(\"Time (s)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -5022,7 +5016,7 @@ "plt.ylabel(\"Number of Occurences\")\n", "plt.show()\n", "\n", - "# Real measured apogee for Valetudo = 860 m\n" + "# Real measured apogee for Valetudo = 860 m" ] }, { @@ -6129,7 +6123,7 @@ "plt.title(\"Apogee X Position\")\n", "plt.xlabel(\"Apogee X Position (m)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -7283,7 +7277,7 @@ "plt.title(\"Apogee Y Position\")\n", "plt.xlabel(\"Apogee Y Position (m)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -8304,7 +8298,7 @@ "plt.title(\"Impact Time\")\n", "plt.xlabel(\"Time (s)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -9362,7 +9356,7 @@ "plt.title(\"Impact X Position\")\n", "plt.xlabel(\"Impact X Position (m)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -10457,7 +10451,7 @@ "plt.title(\"Impact Y Position\")\n", "plt.xlabel(\"Impact Y Position (m)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -11530,7 +11524,7 @@ "plt.xlim(-35, 0)\n", "plt.xlabel(\"Velocity (m/s)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -12899,16 +12893,20 @@ ")\n", "\n", "plt.figure()\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\"], label=\"Out of Rail\", bins=int(N**0.5)\n", + " dispersion_results[\"initial_static_margin\"], label=\"Initial\", bins=int(N**0.5)\n", + ")\n", + "plt.hist(\n", + " dispersion_results[\"out_of_rail_static_margin\"],\n", + " label=\"Out of Rail\",\n", + " bins=int(N**0.5),\n", ")\n", "plt.hist(dispersion_results[\"final_static_margin\"], label=\"Final\", bins=int(N**0.5))\n", "plt.legend()\n", "plt.title(\"Static Margin\")\n", "plt.xlabel(\"Static Margin (c)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -13949,7 +13947,7 @@ "plt.title(\"Maximum Velocity\")\n", "plt.xlabel(\"Velocity (m/s)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -14949,7 +14947,7 @@ "plt.title(\"Parachute Events\")\n", "plt.xlabel(\"Number of Parachute Events\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -16150,7 +16148,7 @@ "plt.title(\"Drogue Parachute Trigger Time\")\n", "plt.xlabel(\"Time (s)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -17389,7 +17387,7 @@ "plt.title(\"Drogue Parachute Fully Inflated Time\")\n", "plt.xlabel(\"Time (s)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -18626,7 +18624,7 @@ "plt.title(\"Drogue Parachute Fully Inflated Velocity\")\n", "plt.xlabel(\"Velocity m/s)\")\n", "plt.ylabel(\"Number of Occurences\")\n", - "plt.show()\n" + "plt.show()" ] }, { @@ -20365,6 +20363,7 @@ "impact_x = np.array(dispersion_results[\"impact_x\"])\n", "impact_y = np.array(dispersion_results[\"impact_y\"])\n", "\n", + "\n", "# Define function to calculate eigen values\n", "def eigsorted(cov):\n", " vals, vecs = np.linalg.eigh(cov)\n", @@ -20417,7 +20416,9 @@ "# Draw launch point\n", "plt.scatter(0, 0, s=30, marker=\"*\", color=\"black\", label=\"Launch Point\")\n", "# Draw apogee points\n", - "plt.scatter(apogee_x, apogee_y, s=5, marker=\"^\", color=\"green\", label=\"Simulated Apogee\")\n", + "plt.scatter(\n", + " apogee_x, apogee_y, s=5, marker=\"^\", color=\"green\", label=\"Simulated Apogee\"\n", + ")\n", "# Draw impact points\n", "plt.scatter(\n", " impact_x, impact_y, s=5, marker=\"v\", color=\"blue\", label=\"Simulated Landing Point\"\n", @@ -20449,7 +20450,7 @@ "# Save plot and show result\n", "plt.savefig(str(filename) + \".pdf\", bbox_inches=\"tight\", pad_inches=0)\n", "plt.savefig(str(filename) + \".svg\", bbox_inches=\"tight\", pad_inches=0)\n", - "plt.show()\n" + "plt.show()" ] } ], @@ -20490,7 +20491,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.0" + "version": "3.10.5" }, "vscode": { "interpreter": {