Skip to content

Commit ea18a9f

Browse files
MateusStanoclaude
andcommitted
ENH: deprecate solution_array, get_solution_at_time and the raw export
Flight.solution_array and Flight.get_solution_at_time now warn and point to the named queries on flight.solution (removal targeted v1.14); they still return the canonical projection. The no-arguments FlightDataExporter fast path now writes flight.solution.canonical_array (so it works for reduced-state flights too), corrects its header to include the missing Vx/Vy/Vz columns, and warns that explicit variable names will be required. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 19baec0 commit ea18a9f

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

rocketpy/simulation/flight.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,11 @@ def __cache_sensor_data(self):
13051305
sensor_data[sensor] = sensor.measured_data[:]
13061306
self.sensor_data = sensor_data
13071307

1308+
@deprecated(
1309+
reason="Flight.get_solution_at_time is deprecated",
1310+
version="v1.14",
1311+
alternative="flight.solution.at(t)",
1312+
)
13081313
def get_solution_at_time(self, t, atol=1e-3):
13091314
"""Returns the solution state vector at a given time. If the time is
13101315
not found in the solution, the closest time is used and a warning is
@@ -1399,6 +1404,12 @@ def lateral_surface_wind(self):
13991404
return -wind_u * np.cos(heading_rad) + wind_v * np.sin(heading_rad)
14001405

14011406
@cached_property
1407+
@deprecated(
1408+
reason="Flight.solution_array is deprecated",
1409+
version="v1.14",
1410+
alternative="flight.solution['name'] for a single variable, or "
1411+
"flight.solution.canonical_array for the full 14-column table",
1412+
)
14021413
def solution_array(self):
14031414
"""Returns solution array of the rocket flight."""
14041415
return self.solution.canonical_array

rocketpy/simulation/flight_data_exporter.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
import json
6+
import warnings
67

78
import numpy as np
89
import simplekml
@@ -89,16 +90,27 @@ class attributes which are instances of the Function class. Usage
8990

9091
# Fast evaluation for the most basic scenario
9192
if time_step is None and len(variables) == 0:
93+
warnings.warn(
94+
"Exporting with no variables writes the full 14-column "
95+
"canonical state table and will require explicit variable names "
96+
"in v1.14. Pass the variable names you want, e.g. "
97+
"data(file_name, 'x', 'y', 'z').",
98+
DeprecationWarning,
99+
stacklevel=2,
100+
)
92101
np.savetxt(
93102
file_name,
94-
f.solution,
103+
f.solution.canonical_array,
95104
fmt="%.6f",
96105
delimiter=",",
97106
header=""
98107
"Time (s),"
99108
"X (m),"
100109
"Y (m),"
101110
"Z (m),"
111+
"Vx (m/s),"
112+
"Vy (m/s),"
113+
"Vz (m/s),"
102114
"E0,"
103115
"E1,"
104116
"E2,"

0 commit comments

Comments
 (0)