Skip to content

Commit aebdf6a

Browse files
GuilhermeAsuraGui-FernandesBR
authored andcommitted
style: format verification scripts and pin pytz>=2020.1 for CI stability
1 parent 62aef8b commit aebdf6a

File tree

4 files changed

+108
-74
lines changed

4 files changed

+108
-74
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ scipy>=1.0
33
matplotlib>=3.9.0 # Released May 15th 2024
44
netCDF4>=1.6.4
55
requests>=2.25.0
6-
pytz
6+
pytz>=2020.1
77
simplekml
88
dill

tests/animation_verification/main.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
from rocket_stl import create_rocket_stl
55
from rocket_setup import get_calisto_rocket
66

7+
78
def run_simulation_and_test_animation():
89
print("🚀 Setting up simulation (Calisto Example)...")
9-
10+
1011
# 1. Setup Environment
1112
env = Environment(latitude=32.990254, longitude=-106.974998, elevation=1400)
1213
env.set_date((2025, 12, 5, 12))
@@ -23,40 +24,40 @@ def run_simulation_and_test_animation():
2324
test_flight = Flight(
2425
rocket=calisto, environment=env, rail_length=5.2, inclination=85, heading=0
2526
)
26-
27+
2728
print(f"✅ Flight simulated successfully! Apogee: {test_flight.apogee:.2f} m")
2829

2930
# 4. Test Animation Methods
3031
stl_file = "rocket_model.stl"
31-
# Note: Depending on where you run this, you might need to adjust imports
32+
# Note: Depending on where you run this, you might need to adjust imports
3233
# or ensure create_rocket_stl is available in scope.
3334
create_rocket_stl(stl_file, length=300, radius=50)
3435

3536
print("\n🎥 Testing animate_trajectory()...")
36-
37+
3738
try:
3839
test_flight.animate_trajectory(
39-
file_name=stl_file,
40+
file_name=stl_file,
4041
stop=15.0,
4142
time_step=0.05,
42-
azimuth=-45, # Rotates view 45 degrees left
43+
azimuth=-45, # Rotates view 45 degrees left
4344
elevation=30, # Tilts view 30 degrees up
44-
zoom=1.2
45-
)
45+
zoom=1.2,
46+
)
4647
print("✅ animate_trajectory() executed successfully.")
4748
except Exception as e:
4849
print(f"❌ animate_trajectory() Failed: {e}")
4950
traceback.print_exc()
5051

5152
print("\n🔄 Testing animate_rotate()...")
52-
53+
5354
try:
5455
test_flight.animate_rotate(
55-
file_name=stl_file,
56+
file_name=stl_file,
5657
time_step=1.0,
57-
azimuth=-45, # Rotates view 45 degrees left
58+
azimuth=-45, # Rotates view 45 degrees left
5859
elevation=30, # Tilts view 30 degrees up
59-
zoom=1.2
60+
zoom=1.2,
6061
)
6162
print("✅ animate_rotate() executed successfully.")
6263
except Exception as e:
@@ -67,5 +68,6 @@ def run_simulation_and_test_animation():
6768
if os.path.exists(stl_file):
6869
os.remove(stl_file)
6970

71+
7072
if __name__ == "__main__":
71-
run_simulation_and_test_animation()
73+
run_simulation_and_test_animation()

tests/animation_verification/rocket_setup.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
AIRFOIL_PATH = os.path.join(DATA_DIR, "airfoils/NACA0012-radians.txt")
1111
MOTOR_PATH = os.path.join(DATA_DIR, "motors/cesaroni/Cesaroni_M1670.eng")
1212

13+
1314
def get_motor():
1415
"""Locates the motor file and returns a configured SolidMotor object."""
1516
# We can now point directly to the file without searching
@@ -35,10 +36,11 @@ def get_motor():
3536
coordinate_system_orientation="nozzle_to_combustion_chamber",
3637
)
3738

39+
3840
def get_calisto_rocket():
3941
"""Configures and returns the Calisto Rocket object."""
4042
motor = get_motor()
41-
43+
4244
calisto = Rocket(
4345
radius=127 / 2000,
4446
mass=14.426,
@@ -73,10 +75,20 @@ def get_calisto_rocket():
7375

7476
# Parachutes
7577
calisto.add_parachute(
76-
name="Main", cd_s=10.0, trigger=800, sampling_rate=105, lag=1.5, noise=(0, 8.3, 0.5)
78+
name="Main",
79+
cd_s=10.0,
80+
trigger=800,
81+
sampling_rate=105,
82+
lag=1.5,
83+
noise=(0, 8.3, 0.5),
7784
)
7885
calisto.add_parachute(
79-
name="Drogue", cd_s=1.0, trigger="apogee", sampling_rate=105, lag=1.5, noise=(0, 8.3, 0.5)
86+
name="Drogue",
87+
cd_s=1.0,
88+
trigger="apogee",
89+
sampling_rate=105,
90+
lag=1.5,
91+
noise=(0, 8.3, 0.5),
8092
)
81-
82-
return calisto
93+
94+
return calisto

0 commit comments

Comments
 (0)