Skip to content

Commit 1f828b9

Browse files
committed
MNT: black correction
1 parent c93e62c commit 1f828b9

File tree

1 file changed

+77
-54
lines changed

1 file changed

+77
-54
lines changed

examples/ProjetoJupiter--Valetudo--2019/simulation.ipynb

Lines changed: 77 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
}
2727
],
2828
"source": [
29-
"%pip install rocketpy<=2.0\n"
29+
"%pip install rocketpy<=2.0"
3030
]
3131
},
3232
{
@@ -36,8 +36,19 @@
3636
"metadata": {},
3737
"outputs": [],
3838
"source": [
39-
"from rocketpy import Environment, SolidMotor, Rocket, Flight, TrapezoidalFins, EllipticalFins, RailButtons, NoseCone, Tail, Parachute\n",
40-
"import datetime\n"
39+
"from rocketpy import (\n",
40+
" Environment,\n",
41+
" SolidMotor,\n",
42+
" Rocket,\n",
43+
" Flight,\n",
44+
" TrapezoidalFins,\n",
45+
" EllipticalFins,\n",
46+
" RailButtons,\n",
47+
" NoseCone,\n",
48+
" Tail,\n",
49+
" Parachute,\n",
50+
")\n",
51+
"import datetime"
4152
]
4253
},
4354
{
@@ -57,7 +68,7 @@
5768
"source": [
5869
"env = Environment()\n",
5970
"env.set_location(latitude=-23.36417778, longitude=-48.0)\n",
60-
"env.set_elevation(668.0)\n"
71+
"env.set_elevation(668.0)"
6172
]
6273
},
6374
{
@@ -168,7 +179,7 @@
168179
}
169180
],
170181
"source": [
171-
"env.all_info()\n"
182+
"env.all_info()"
172183
]
173184
},
174185
{
@@ -188,7 +199,7 @@
188199
"outputs": [],
189200
"source": [
190201
"motor = SolidMotor(\n",
191-
" thrust_source='thrust_source.csv',\n",
202+
" thrust_source=\"thrust_source.csv\",\n",
192203
" dry_mass=0,\n",
193204
" center_of_dry_mass_position=0,\n",
194205
" dry_inertia=[0, 0, 0],\n",
@@ -203,9 +214,9 @@
203214
" nozzle_position=-0.378,\n",
204215
" throat_radius=0.0107,\n",
205216
" reshape_thrust_curve=False, # Not implemented in Rocket-Serializer\n",
206-
" interpolation_method='linear',\n",
207-
" coordinate_system_orientation='nozzle_to_combustion_chamber',\n",
208-
")\n"
217+
" interpolation_method=\"linear\",\n",
218+
" coordinate_system_orientation=\"nozzle_to_combustion_chamber\",\n",
219+
")"
209220
]
210221
},
211222
{
@@ -424,7 +435,7 @@
424435
}
425436
],
426437
"source": [
427-
"motor.all_info()\n"
438+
"motor.all_info()"
428439
]
429440
},
430441
{
@@ -454,11 +465,11 @@
454465
"source": [
455466
"nosecone = NoseCone(\n",
456467
" length=0.274169,\n",
457-
" kind='Von Karman',\n",
468+
" kind=\"Von Karman\",\n",
458469
" base_radius=0.04045000000000001,\n",
459470
" rocket_radius=0.04045000000000001,\n",
460-
" name='0.274169',\n",
461-
")\n"
471+
" name=\"0.274169\",\n",
472+
")"
462473
]
463474
},
464475
{
@@ -477,7 +488,7 @@
477488
"metadata": {},
478489
"outputs": [],
479490
"source": [
480-
"trapezoidal_fins = {}\n"
491+
"trapezoidal_fins = {}"
481492
]
482493
},
483494
{
@@ -493,12 +504,11 @@
493504
" tip_chord=0.018000000000000002,\n",
494505
" span=0.077,\n",
495506
" cant_angle=0.0,\n",
496-
" sweep_length= 0.03933010329337934,\n",
497-
" sweep_angle= None,\n",
507+
" sweep_length=0.03933010329337934,\n",
508+
" sweep_angle=None,\n",
498509
" rocket_radius=0.04045000000000001,\n",
499-
" name='Conjunto de aletas trapezoidais',\n",
500-
")\n",
501-
"\n"
510+
" name=\"Conjunto de aletas trapezoidais\",\n",
511+
")"
502512
]
503513
},
504514
{
@@ -517,7 +527,7 @@
517527
"metadata": {},
518528
"outputs": [],
519529
"source": [
520-
"tails = {}\n"
530+
"tails = {}"
521531
]
522532
},
523533
{
@@ -536,7 +546,7 @@
536546
"metadata": {},
537547
"outputs": [],
538548
"source": [
539-
"parachutes = {}\n"
549+
"parachutes = {}"
540550
]
541551
},
542552
{
@@ -547,11 +557,11 @@
547557
"outputs": [],
548558
"source": [
549559
"parachutes[0] = Parachute(\n",
550-
" name='Drogue_chute',\n",
560+
" name=\"Drogue_chute\",\n",
551561
" cd_s=0.454,\n",
552-
" trigger='apogee',\n",
553-
" sampling_rate=100, \n",
554-
")\n"
562+
" trigger=\"apogee\",\n",
563+
" sampling_rate=100,\n",
564+
")"
555565
]
556566
},
557567
{
@@ -565,11 +575,11 @@
565575
" radius=0.04045000000000001,\n",
566576
" mass=8.2564,\n",
567577
" inertia=[0.01467, 0.01467, 5.5915],\n",
568-
" power_off_drag='drag_curve.csv',\n",
569-
" power_on_drag='drag_curve.csv',\n",
578+
" power_off_drag=\"drag_curve.csv\",\n",
579+
" power_on_drag=\"drag_curve.csv\",\n",
570580
" center_of_mass_without_motor=1.4023,\n",
571-
" coordinate_system_orientation='nose_to_tail',\n",
572-
")\n"
581+
" coordinate_system_orientation=\"nose_to_tail\",\n",
582+
")"
573583
]
574584
},
575585
{
@@ -598,7 +608,7 @@
598608
"metadata": {},
599609
"outputs": [],
600610
"source": [
601-
"rocket.add_motor(motor, position= 2.052896709219859)\n"
611+
"rocket.add_motor(motor, position=2.052896709219859)"
602612
]
603613
},
604614
{
@@ -616,7 +626,7 @@
616626
"metadata": {},
617627
"outputs": [],
618628
"source": [
619-
"rocket.parachutes = list(parachutes.values())\n"
629+
"rocket.parachutes = list(parachutes.values())"
620630
]
621631
},
622632
{
@@ -635,10 +645,10 @@
635645
"outputs": [],
636646
"source": [
637647
"rail_buttons = rocket.set_rail_buttons(\n",
638-
" upper_button_position=1.148,\n",
639-
" lower_button_position=2.399,\n",
640-
" angular_position=30.000,\n",
641-
")\n"
648+
" upper_button_position=1.148,\n",
649+
" lower_button_position=2.399,\n",
650+
" angular_position=30.000,\n",
651+
")"
642652
]
643653
},
644654
{
@@ -818,7 +828,7 @@
818828
],
819829
"source": [
820830
"### Rocket Info\n",
821-
"rocket.all_info()\n"
831+
"rocket.all_info()"
822832
]
823833
},
824834
{
@@ -1229,7 +1239,7 @@
12291239
}
12301240
],
12311241
"source": [
1232-
"flight.all_info()\n"
1242+
"flight.all_info()"
12331243
]
12341244
},
12351245
{
@@ -1309,7 +1319,7 @@
13091319
"print(f\"Time to apogee (OpenRocket): {time_to_apogee_ork:.3f} s\")\n",
13101320
"print(f\"Time to apogee (RocketPy): {time_to_apogee_rpy:.3f} s\")\n",
13111321
"apogee_difference = time_to_apogee_rpy - time_to_apogee_ork\n",
1312-
"error = abs((apogee_difference)/time_to_apogee_rpy)*100\n",
1322+
"error = abs((apogee_difference) / time_to_apogee_rpy) * 100\n",
13131323
"print(f\"Time to apogee difference: {error:.3f} %\")\n",
13141324
"print()\n",
13151325
"\n",
@@ -1318,7 +1328,7 @@
13181328
"print(f\"Flight time (OpenRocket): {flight_time_ork:.3f} s\")\n",
13191329
"print(f\"Flight time (RocketPy): {flight_time_rpy:.3f} s\")\n",
13201330
"flight_time_difference = flight_time_rpy - flight_time_ork\n",
1321-
"error_flight_time = abs((flight_time_difference)/flight_time_rpy)*100\n",
1331+
"error_flight_time = abs((flight_time_difference) / flight_time_rpy) * 100\n",
13221332
"print(f\"Flight time difference: {error_flight_time:.3f} %\")\n",
13231333
"print()\n",
13241334
"\n",
@@ -1327,7 +1337,9 @@
13271337
"print(f\"Ground hit velocity (OpenRocket): {ground_hit_velocity_ork:.3f} m/s\")\n",
13281338
"print(f\"Ground hit velocity (RocketPy): {ground_hit_velocity_rpy:.3f} m/s\")\n",
13291339
"ground_hit_velocity_difference = ground_hit_velocity_rpy - ground_hit_velocity_ork\n",
1330-
"error_ground_hit_velocity = abs((ground_hit_velocity_difference)/ground_hit_velocity_rpy)*100\n",
1340+
"error_ground_hit_velocity = (\n",
1341+
" abs((ground_hit_velocity_difference) / ground_hit_velocity_rpy) * 100\n",
1342+
")\n",
13311343
"print(f\"Ground hit velocity difference: {error_ground_hit_velocity:.3f} %\")\n",
13321344
"print()\n",
13331345
"\n",
@@ -1336,7 +1348,9 @@
13361348
"print(f\"Launch rod velocity (OpenRocket): {launch_rod_velocity_ork:.3f} m/s\")\n",
13371349
"print(f\"Launch rod velocity (RocketPy): {launch_rod_velocity_rpy:.3f} m/s\")\n",
13381350
"launch_rod_velocity_difference = launch_rod_velocity_rpy - launch_rod_velocity_ork\n",
1339-
"error_launch_rod_velocity = abs((launch_rod_velocity_difference)/launch_rod_velocity_rpy)*100\n",
1351+
"error_launch_rod_velocity = (\n",
1352+
" abs((launch_rod_velocity_difference) / launch_rod_velocity_rpy) * 100\n",
1353+
")\n",
13401354
"print(f\"Launch rod velocity difference: {error_launch_rod_velocity:.3f} %\")\n",
13411355
"print()\n",
13421356
"\n",
@@ -1345,7 +1359,7 @@
13451359
"print(f\"Max acceleration (OpenRocket): {max_acceleration_ork:.3f} m/s²\")\n",
13461360
"print(f\"Max acceleration (RocketPy): {max_acceleration_rpy:.3f} m/s²\")\n",
13471361
"max_acceleration_difference = max_acceleration_rpy - max_acceleration_ork\n",
1348-
"error_max_acceleration = abs((max_acceleration_difference)/max_acceleration_rpy)*100\n",
1362+
"error_max_acceleration = abs((max_acceleration_difference) / max_acceleration_rpy) * 100\n",
13491363
"print(f\"Max acceleration difference: {error_max_acceleration:.3f} %\")\n",
13501364
"print()\n",
13511365
"\n",
@@ -1354,16 +1368,16 @@
13541368
"print(f\"Max altitude (OpenRocket): {max_altitude_ork:.3f} m\")\n",
13551369
"print(f\"Max altitude (RocketPy): {max_altitude_rpy:.3f} m\")\n",
13561370
"max_altitude_difference = max_altitude_rpy - max_altitude_ork\n",
1357-
"error_max_altitude = abs((max_altitude_difference)/max_altitude_rpy)*100\n",
1371+
"error_max_altitude = abs((max_altitude_difference) / max_altitude_rpy) * 100\n",
13581372
"print(f\"Max altitude difference: {error_max_altitude:.3f} %\")\n",
13591373
"print()\n",
13601374
"\n",
13611375
"max_mach_ork = 0.36177\n",
1362-
"max_mach_rpy = flight.max_mach_number \n",
1376+
"max_mach_rpy = flight.max_mach_number\n",
13631377
"print(f\"Max Mach (OpenRocket): {max_mach_ork:.3f}\")\n",
13641378
"print(f\"Max Mach (RocketPy): {max_mach_rpy:.3f}\")\n",
13651379
"max_mach_difference = max_mach_rpy - max_mach_ork\n",
1366-
"error_max_mach = abs((max_mach_difference)/max_mach_rpy)*100\n",
1380+
"error_max_mach = abs((max_mach_difference) / max_mach_rpy) * 100\n",
13671381
"print(f\"Max Mach difference: {error_max_mach:.3f} %\")\n",
13681382
"print()\n",
13691383
"\n",
@@ -1372,7 +1386,7 @@
13721386
"print(f\"Max velocity (OpenRocket): {max_velocity_ork:.3f} m/s\")\n",
13731387
"print(f\"Max velocity (RocketPy): {max_velocity_rpy:.3f} m/s\")\n",
13741388
"max_velocity_difference = max_velocity_rpy - max_velocity_ork\n",
1375-
"error_max_velocity = abs((max_velocity_difference)/max_velocity_rpy)*100\n",
1389+
"error_max_velocity = abs((max_velocity_difference) / max_velocity_rpy) * 100\n",
13761390
"print(f\"Max velocity difference: {error_max_velocity:.3f} %\")\n",
13771391
"print()\n",
13781392
"\n",
@@ -1381,16 +1395,22 @@
13811395
"print(f\"Max thrust (OpenRocket): {max_thrust_ork:.3f} N\")\n",
13821396
"print(f\"Max thrust (RocketPy): {max_thrust_rpy:.3f} N\")\n",
13831397
"max_thrust_difference = max_thrust_rpy - max_thrust_ork\n",
1384-
"error_max_thrust = abs((max_thrust_difference)/max_thrust_rpy)*100\n",
1398+
"error_max_thrust = abs((max_thrust_difference) / max_thrust_rpy) * 100\n",
13851399
"print(f\"Max thrust difference: {error_max_thrust:.3f} %\")\n",
13861400
"print()\n",
13871401
"\n",
13881402
"burnout_stability_margin_ork = 2.4363\n",
1389-
"burnout_stability_margin_rpy = flight.stability_margin(flight.rocket.motor.burn_out_time)\n",
1403+
"burnout_stability_margin_rpy = flight.stability_margin(\n",
1404+
" flight.rocket.motor.burn_out_time\n",
1405+
")\n",
13901406
"print(f\"Burnout stability margin (OpenRocket): {burnout_stability_margin_ork:.3f}\")\n",
13911407
"print(f\"Burnout stability margin (RocketPy): {burnout_stability_margin_rpy:.3f}\")\n",
1392-
"burnout_stability_margin_difference = burnout_stability_margin_rpy - burnout_stability_margin_ork\n",
1393-
"error_burnout_stability_margin = abs((burnout_stability_margin_difference)/burnout_stability_margin_rpy)*100\n",
1408+
"burnout_stability_margin_difference = (\n",
1409+
" burnout_stability_margin_rpy - burnout_stability_margin_ork\n",
1410+
")\n",
1411+
"error_burnout_stability_margin = (\n",
1412+
" abs((burnout_stability_margin_difference) / burnout_stability_margin_rpy) * 100\n",
1413+
")\n",
13941414
"print(f\"Burnout stability margin difference: {error_burnout_stability_margin:.3f} %\")\n",
13951415
"print()\n",
13961416
"\n",
@@ -1399,7 +1419,9 @@
13991419
"print(f\"Max stability margin (OpenRocket): {max_stability_margin_ork:.3f}\")\n",
14001420
"print(f\"Max stability margin (RocketPy): {max_stability_margin_rpy:.3f}\")\n",
14011421
"max_stability_margin_difference = max_stability_margin_rpy - max_stability_margin_ork\n",
1402-
"error_max_stability_margin = abs((max_stability_margin_difference)/max_stability_margin_rpy)*100\n",
1422+
"error_max_stability_margin = (\n",
1423+
" abs((max_stability_margin_difference) / max_stability_margin_rpy) * 100\n",
1424+
")\n",
14031425
"print(f\"Max stability margin difference: {error_max_stability_margin:.3f} %\")\n",
14041426
"print()\n",
14051427
"\n",
@@ -1408,10 +1430,11 @@
14081430
"print(f\"Min stability margin (OpenRocket): {min_stability_margin_ork:.3f}\")\n",
14091431
"print(f\"Min stability margin (RocketPy): {min_stability_margin_rpy:.3f}\")\n",
14101432
"min_stability_margin_difference = min_stability_margin_rpy - min_stability_margin_ork\n",
1411-
"error_min_stability_margin = abs((min_stability_margin_difference)/min_stability_margin_rpy)*100\n",
1433+
"error_min_stability_margin = (\n",
1434+
" abs((min_stability_margin_difference) / min_stability_margin_rpy) * 100\n",
1435+
")\n",
14121436
"print(f\"Min stability margin difference: {error_min_stability_margin:.3f} %\")\n",
1413-
"print()\n",
1414-
"\n"
1437+
"print()"
14151438
]
14161439
}
14171440
],

0 commit comments

Comments
 (0)