Skip to content

Commit 538d4ca

Browse files
Merge pull request #1069 from RocketPy-Team/claude/pr-1068-ci-failures-q35rzb
TST/DOC: fix build-docs and codecov failures from the PyVista animations
2 parents ce3342f + e0ff281 commit 538d4ca

3 files changed

Lines changed: 467 additions & 3 deletions

File tree

rocketpy/plots/flight_plots.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,9 +1265,10 @@ def animate_trajectory( # pylint: disable=too-many-statements,too-many-locals
12651265
Ground texture. A mapping may define ``image``, ``bounds``,
12661266
``coordinates`` (``"enu"`` or ``"latlon"``), and ``flip_y`` for
12671267
geographic placement. Default is None.
1268-
color_by : {"speed", "mach", "dynamic_pressure", "acceleration",
1269-
"altitude", False, None}, optional
1270-
Trajectory point scalar. Default is "speed".
1268+
color_by : str | bool | None, optional
1269+
Trajectory point scalar, one of ``"speed"``, ``"mach"``,
1270+
``"dynamic_pressure"``, ``"acceleration"``, ``"altitude"``,
1271+
``False`` or ``None``. Default is "speed".
12711272
show_kinematic_plots : bool, optional
12721273
Show altitude, speed and acceleration histories. Default is False.
12731274
camera_mode : {"static", "follow", "ground", "body"}, optional

tests/integration/test_plots.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,64 @@ def test_flight_animations_run_off_screen(flight_calisto):
3333
assert rotation_result is None
3434

3535

36+
def test_flight_animations_render_all_scene_options(flight_calisto):
37+
"""Exercise the animation scene builders with the full set of overlays.
38+
39+
Rendering off screen with playback controls, charts, camera tracking and
40+
stability markers enabled covers the scene-construction branches of both
41+
``animate_trajectory`` and ``animate_rotate`` (and the playback-control
42+
setup in ``_run_animation``) that the minimal smoke test does not reach.
43+
"""
44+
pytest.importorskip("pyvista")
45+
shared_options = {
46+
"start": 0,
47+
"stop": None, # spans the whole flight, hitting every event marker
48+
"time_step": 2.0,
49+
"backend": "none",
50+
"off_screen": True,
51+
"window_size": (240, 180),
52+
"playback_controls": True,
53+
}
54+
55+
trajectory_result = flight_calisto.plots.animate_trajectory(
56+
**shared_options,
57+
color_by="mach",
58+
show_kinematic_plots=True,
59+
show_subrocket_point=True,
60+
camera_mode="follow",
61+
)
62+
rotation_result = flight_calisto.plots.animate_rotate(
63+
**shared_options,
64+
show_attitude_plots=True,
65+
show_cp_cm=True,
66+
camera_mode="body",
67+
)
68+
69+
assert trajectory_result is None
70+
assert rotation_result is None
71+
72+
73+
def test_flight_animation_export_gif(flight_calisto, tmp_path):
74+
"""Cover the deterministic GIF export path of ``_run_animation``."""
75+
pytest.importorskip("pyvista")
76+
pytest.importorskip("imageio")
77+
export_file = tmp_path / "trajectory.gif"
78+
79+
result = flight_calisto.plots.animate_trajectory(
80+
start=0,
81+
stop=0.3,
82+
time_step=0.1,
83+
backend="none",
84+
window_size=(240, 180),
85+
color_by="speed",
86+
export_file=str(export_file),
87+
)
88+
89+
assert result == str(export_file)
90+
assert export_file.is_file()
91+
assert export_file.stat().st_size > 0
92+
93+
3694
@patch("matplotlib.pyplot.show")
3795
def test_compare(mock_show, flight_calisto):
3896
"""Here we want to test the 'x_attributes' argument, which is the only one

0 commit comments

Comments
 (0)