Skip to content

Commit d6c664c

Browse files
committed
Merge remote-tracking branch 'origin/develop' into tst/organize-test-files
2 parents 6cb7104 + af7bbff commit d6c664c

18 files changed

Lines changed: 662 additions & 400 deletions

.github/workflows/linters.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
python-version: ["3.9"]
19+
python-version: ["3.10"]
2020
steps:
2121
- uses: actions/checkout@main
2222
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Python
2020
uses: actions/setup-python@main
2121
with:
22-
python-version: "3.9"
22+
python-version: "3.10"
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip

.github/workflows/test-pytest-slow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
strategy:
2323
matrix:
24-
python-version: [3.9, 3.13]
24+
python-version: [3.10, 3.14]
2525
env:
2626
PYTHON: ${{ matrix.python-version }}
2727
MPLBACKEND: Agg

.github/workflows/test_pytest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
strategy:
2020
matrix:
2121
os: [ubuntu-latest, macos-latest, windows-latest]
22-
python-version: [3.9, 3.13]
22+
python-version: ["3.10", "3.14"]
2323
env:
2424
OS: ${{ matrix.os }}
2525
PYTHON: ${{ matrix.python-version }}

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ persistent=yes
8888

8989
# Minimum Python version to use for version dependent checks. Will default to
9090
# the version used to run pylint.
91-
py-version=3.9
91+
py-version=3.10
9292

9393
# Discover python modules and packages in the file system subtree.
9494
recursive=no

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3131
Attention: The newest changes should be on top -->
3232

3333
### Added
34+
3435
- ENH: Tank Fluids with Variable Density from Temperature and Pressure [#852](https://github.com/RocketPy-Team/RocketPy/pull/852)
3536
- ENH: Controller (AirBrakes) and Sensors Encoding [#849](https://github.com/RocketPy-Team/RocketPy/pull/849)
36-
- EHN: Addition of ensemble variable to ECMWF dictionaries [#842](https://github.com/RocketPy-Team/RocketPy/pull/842)
37+
- EHN: Addition of ensemble variable to ECMWF dictionaries [#842](https://github.com/RocketPy-Team/RocketPy/pull/842)
3738
- ENH: Added Crop and Clip Methods to Function Class [#817](https://github.com/RocketPy-Team/RocketPy/pull/817)
3839
- DOC: Add Flight class usage documentation and update index [#841](https://github.com/RocketPy-Team/RocketPy/pull/841)
3940
- ENH: Discretized and No-Pickle Encoding Options [#827](https://github.com/RocketPy-Team/RocketPy/pull/827)
4041
- ENH: Add the Coriolis Force to the Flight class [#799](https://github.com/RocketPy-Team/RocketPy/pull/799)
4142
- ENH: Improve parachute geometric parametrization [#835](https://github.com/RocketPy-Team/RocketPy/pull/835)
43+
- ENH: Changing ellipses plot axis label [#855](https://github.com/RocketPy-Team/RocketPy/pull/855)
4244

4345
### Changed
4446

47+
- MNT: bumps min python version to 3.10 [#857](https://github.com/RocketPy-Team/RocketPy/pull/857)
4548
- DOC: Update docs dependencies and sub dependencies [#851](https://github.com/RocketPy-Team/RocketPy/pull/851)
49+
- MNT: extract flight data exporters [#845](https://github.com/RocketPy-Team/RocketPy/pull/845)
4650
- ENH: _MotorPrints inheritance - issue #460 [#828](https://github.com/RocketPy-Team/RocketPy/pull/828)
4751
- MNT: fix deprecations and warnings [#829](https://github.com/RocketPy-Team/RocketPy/pull/829)
4852

docs/user/first_simulation.rst

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -565,19 +565,27 @@ Visualizing the Trajectory in Google Earth
565565

566566
We can export the trajectory to ``.kml`` to visualize it in Google Earth:
567567

568+
Use the dedicated exporter class:
569+
568570
.. jupyter-input::
569571

570-
test_flight.export_kml(
572+
from rocketpy.simulation import FlightDataExporter
573+
574+
FlightDataExporter(test_flight).export_kml(
571575
file_name="trajectory.kml",
572576
extrude=True,
573-
altitude_mode="relative_to_ground",
577+
altitude_mode="relativetoground",
574578
)
575579

576580
.. note::
577581

578582
To learn more about the ``.kml`` format, see
579583
`KML Reference <https://developers.google.com/kml/documentation/kmlreference>`_.
580584

585+
.. note::
586+
587+
The legacy method ``Flight.export_kml`` is deprecated. Use
588+
:meth:`rocketpy.simulation.flight_data_exporter.FlightDataExporter.export_kml`.
581589

582590
Manipulating results
583591
--------------------
@@ -610,29 +618,41 @@ In this section, we will explore how to export specific data from your RocketPy
610618
simulations to CSV files. This is particularly useful if you want to insert the
611619
data into spreadsheets or other software for further analysis.
612620

613-
The main method that is used to export data is the :meth:`rocketpy.Flight.export_data` method. This method exports selected flight attributes to a CSV file. In this first example, we will export the rocket angle of attack (see :meth:`rocketpy.Flight.angle_of_attack`) and the rocket mach number (see :meth:`rocketpy.Flight.mach_number`) to the file ``calisto_flight_data.csv``.
621+
The recommended API is
622+
:meth:`rocketpy.simulation.flight_data_exporter.FlightDataExporter.export_data`,
623+
which exports selected flight attributes to a CSV file. In this first example,
624+
we export the rocket angle of attack (see :meth:`rocketpy.Flight.angle_of_attack`)
625+
and the rocket Mach number (see :meth:`rocketpy.Flight.mach_number`) to the file
626+
``calisto_flight_data.csv``.
614627

615628
.. jupyter-execute::
616629

617-
test_flight.export_data(
630+
from rocketpy.simulation import FlightDataExporter
631+
632+
exporter = FlightDataExporter(test_flight)
633+
exporter.export_data(
618634
"calisto_flight_data.csv",
619635
"angle_of_attack",
620636
"mach_number",
621637
)
622638

623-
| As you can see, the first argument of the method is the name of the file to be created. The following arguments are the attributes to be exported. We can check the file that was created by reading it with the :func:`pandas.read_csv` function:
639+
| As you can see, the first argument is the file name to be created. The following
640+
arguments are the attributes to be exported. We can check the file by reading it
641+
with :func:`pandas.read_csv`:
624642

625643
.. jupyter-execute::
626644

627645
import pandas as pd
628646

629647
pd.read_csv("calisto_flight_data.csv")
630648

631-
| The file header specifies the meaning of each column. The time samples are obtained from the simulation solver steps. Should you want to export the data at a different sampling rate, you can use the ``time_step`` argument of the :meth:`rocketpy.Flight.export_data` method as follows.
649+
| The file header specifies the meaning of each column. The time samples are
650+
obtained from the simulation solver steps. To export the data at a different
651+
sampling rate, use the ``time_step`` argument:
632652

633653
.. jupyter-execute::
634654

635-
test_flight.export_data(
655+
exporter.export_data(
636656
"calisto_flight_data.csv",
637657
"angle_of_attack",
638658
"mach_number",
@@ -641,15 +661,16 @@ The main method that is used to export data is the :meth:`rocketpy.Flight.export
641661

642662
pd.read_csv("calisto_flight_data.csv")
643663

644-
This will export the same data at a sampling rate of 1 second. The flight data will be interpolated to match the new sampling rate.
664+
This exports the same data at a sampling rate of 1 second. The flight data is
665+
interpolated to match the new sampling rate.
645666

646-
Finally, the :meth:`rocketpy.Flight.export_data` method also provides a convenient way to export the entire flight solution (see :meth:`rocketpy.Flight.solution_array`) to a CSV file. This is done by not passing any attributes names to the method.
667+
Finally, ``FlightDataExporter.export_data`` also provides a convenient way to
668+
export the entire flight solution (see :meth:`rocketpy.Flight.solution_array`)
669+
by not passing any attribute names:
647670

648671
.. jupyter-execute::
649672

650-
test_flight.export_data(
651-
"calisto_flight_data.csv",
652-
)
673+
exporter.export_data("calisto_flight_data.csv")
653674

654675
.. jupyter-execute::
655676
:hide-code:
@@ -659,6 +680,10 @@ Finally, the :meth:`rocketpy.Flight.export_data` method also provides a convenie
659680
import os
660681
os.remove("calisto_flight_data.csv")
661682

683+
.. note::
684+
685+
The legacy method ``Flight.export_data`` is deprecated. Use
686+
:meth:`rocketpy.simulation.flight_data_exporter.FlightDataExporter.export_data`.
662687

663688
Saving and Storing Plots
664689
------------------------
@@ -670,7 +695,7 @@ For instance, we can save our rocket drawing as a ``.png`` file:
670695

671696
calisto.draw(filename="calisto_drawing.png")
672697

673-
Also, if you want to save a specific rocketpy plot, every RocketPy
698+
Also, if you want to save a specific rocketpy plot, every RocketPy
674699
attribute of type :class:`rocketpy.Function` is capable of saving its plot
675700
as an image file. For example, we can save our rocket's speed plot and the
676701
trajectory plot as ``.jpg`` files:

docs/user/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Requirements
8585
Python Version
8686
^^^^^^^^^^^^^^
8787

88-
RocketPy supports Python 3.9 and above.
88+
RocketPy supports Python 3.10 and above.
8989
Sorry, there are currently no plans to support earlier versions.
9090
If you really need to run RocketPy on Python 3.8 or earlier, feel free to submit an issue and we will see what we can do!
9191

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "1.10.0"
44
description="Advanced 6-DOF trajectory simulation for High-Power Rocketry."
55
dynamic = ["dependencies"]
66
readme = "README.md"
7-
requires-python = ">=3.9"
7+
requires-python = ">=3.10"
88
authors = [
99
{name = "Giovani Hidalgo Ceotto", email = "ghceotto@gmail.com"},
1010
{name = "Guilherme Fernandes Alves", email = "guilherme_fernandes@usp.br"},

rocketpy/mathutils/function.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ def rbf_interpolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disab
449449

450450
self._interpolation_func = rbf_interpolation
451451

452+
else:
453+
raise ValueError(f"Interpolation {interpolation} method not recognized.")
454+
452455
def __set_extrapolation_func(self): # pylint: disable=too-many-statements
453456
"""Defines extrapolation function used by the Function. Each
454457
extrapolation method has its own function. The function is stored in
@@ -532,6 +535,11 @@ def natural_extrapolation(x, x_min, x_max, x_data, y_data, _):
532535
def natural_extrapolation(x, x_min, x_max, x_data, y_data, coeffs): # pylint: disable=unused-argument
533536
return interpolator(x)
534537

538+
else:
539+
raise ValueError(
540+
f"Natural extrapolation not defined for {interpolation}."
541+
)
542+
535543
self._extrapolation_func = natural_extrapolation
536544
elif extrapolation == 2: # constant
537545
if self.__dom_dim__ == 1:
@@ -547,6 +555,8 @@ def constant_extrapolation(x, x_min, x_max, x_data, y_data, coeffs):
547555
return extrapolator(x)
548556

549557
self._extrapolation_func = constant_extrapolation
558+
else:
559+
raise ValueError(f"Extrapolation {extrapolation} method not recognized.")
550560

551561
def set_get_value_opt(self):
552562
"""Defines a method that evaluates interpolations.

0 commit comments

Comments
 (0)