Skip to content

ENH: create a dataset of pre-registered motors. #814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

leogrosa
Copy link
Member

@leogrosa leogrosa commented May 6, 2025

Pull request type

  • Code changes (bugfix, features)
  • Code maintenance (refactoring, formatting, tests)
  • ReadMe, Docs and GitHub updates
  • Other (please describe):

Checklist

  • Tests for the changes have been added (if needed)
  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Current behavior

The user had to add its own .eng file to use the method GenericMotor.load_from_eng_file() to create a GenericMotor from it, and RocketPy didn't have a dataset of pre-registered motors.

New behavior

RocketPy now has its own dataset of pre-registered motors, containing 63 .eng files, located in rocketpy/datasets/motors/.
Three functions are now present in utilities.py to help:

  • list_motors_dataset(): returns a list of all available motors names;
  • load_motor_from_dataset(): load a GenericMotor from a motor name from the dataset;
  • show_motors_dataset(): prints the list of available motors, useful for quick inspection in terminals and Jupyter notebooks.

Breaking change

  • Yes
  • No

Additional information

The user guide has documentation for the three new functions:
Captura de Tela 2025-05-05 às 23 48 11
Captura de Tela 2025-05-05 às 23 49 17
Captura de Tela 2025-05-05 às 23 49 44

  • The following test didn't pass locally:
FAILED tests/integration/test_environment.py::test_rap_atmosphere - ValueError: The chosen launch time '2025-05-05-02: UTC' is not available in the provided file. Please choose a time within the range of the file, which starts at '2025-05-06-01 UTC'.

To be discussed

  • Should this dataset be installed with the default installation of RocketPy using pip? For now, the size of the dataset isn't big, so the easiest path is to just add it in the repo. However, in the future, it may become big enough to make it optional. Preparing the repo right now could be a good idea -- but it would demand changes in the PyPI pipeline.

@leogrosa leogrosa requested a review from a team as a code owner May 6, 2025 02:57
@leogrosa leogrosa linked an issue May 6, 2025 that may be closed by this pull request
@Gui-FernandesBR
Copy link
Member

Should this dataset be installed with the default installation of RocketPy using pip? For now, the size of the dataset isn't big, so the easiest path is to just add it in the repo. However, in the future, it may become big enough to make it optional. Preparing the repo right now could be a good idea -- but it would demand changes in the PyPI pipeline.

Well, I believe it would be nice if the installation was optional. I think it is worth to search how to do that.
It would be nice to ensure a lighter installation by default.

One my side, there are two main concerns:
1 - You had to duplicate the .eng files in the repo. Isn't there any way wehre you don't need the new rocketpy/dataset folder, and instead simply download the data/ folder?
2 - Is there any particular reason for creating the new functions as utilities instead of methods of the GenericMotor class? (I'm not saying one option is better than other, I'm just trying to understand)

@leogrosa
Copy link
Member Author

leogrosa commented May 6, 2025

@Gui-FernandesBR, ok, I'll search for a nice way to make it optional and discuss it in the weekly. I know that it will involve another member of the team that has access to the PyPI configuration.

Regarding your concerns:

1 - There are ways, but the team and I discussed in the weekly that creating the datasets directory would be a good choice because:

  • It separates what is meant to be used programmatically, as a resource (the datasets/ directory), from what is meant to be used in examples or sandbox exploration (the data/ directory), organizing it in a structured way (in this case, only having .eng files for motors, and nothing else);
  • It allows RocketPy to reference the dataset in other parts of the code using rocketpy.datasets. I believe it wouldn't be good to reference the data folder like that, since it's not inside the rocketpy directory;
  • It is inspired in other well-stablished projects, like the color palettes in seaborn, or the datasets from scikit-learn (sklearn.datasets).

2 - I thought it would fit better in the utilities because there may be future functions that also use the datasets directory, but are not necessarily related to the GenericMotor class. However, the fact that I've created the documentation inside the GenericMotor part in the user guide looks a little bit like an inconsistency haha, even though I thought it would be better for it to be there when thinking about its use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

ENH: Create a dataset of pre-registered motors.
2 participants