Skip to content
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

MAINT: moving env_analysis plots and prints #370

Merged
merged 7 commits into from
May 29, 2023

Conversation

Gui-FernandesBR
Copy link
Member

@Gui-FernandesBR Gui-FernandesBR commented May 26, 2023

Pull request type

Please check the type of change your PR introduces:

  • Code maintenance (refactoring, formatting, renaming, tests)

Pull request checklist

Please check if your PR fulfills the following requirements, depending on the type of PR:

  • Code base maintenance (refactoring, formatting, renaming):

    • Docs have been reviewed and added / updated if needed
    • Lint (black rocketpy) has passed locally and any fixes were made
    • All tests (pytest --runslow) have passed locally

What is the current behavior?

The Environment Analysis class wasn't modified in the last plots/prints overhaul (see #312).

What is the new behavior?

More than 1.5k code lines were moved from the EnvironmentAnalysis file to the corresponding plots and prints file.
This makes the library more readable, and also improve the consistency over the rocketpy classes.
The expected results should be the same, in the background the code is way more organized now.

Does this introduce a breaking change?

  • Yes (The EnvironmentAnalysis class lost a lot of its methods, which now can be accessed by the plots and prints atributes)

Other information

  • Question: Do you want me to also update the 2 environment analysis notebooks? So far, I didn't updated it to
  • Please do not skip tests locally... We need everything to be running flawlessly with the --runslow option included

@Gui-FernandesBR Gui-FernandesBR added this to the Release v1.0.0 milestone May 26, 2023
@Gui-FernandesBR Gui-FernandesBR self-assigned this May 26, 2023
@Gui-FernandesBR Gui-FernandesBR removed the request for review from giovaniceotto May 26, 2023 15:57
@github-actions github-actions bot requested a review from giovaniceotto May 26, 2023 15:57
@Gui-FernandesBR
Copy link
Member Author

Quick comment: I was facing a little problem when running the class right before modifying everything. See:

AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

In order to solve it, I simply changed all the np.float appearances to float, just like recommended above. Everything should be running ok now.

Also, to run the new tests, I am using the following command on my vscode terminal:

pytest tests/test_environment_anaysis.py --runslow

Notice how the test name is mistyped... It says "_anaysis.py" instead of "_analysis.py".
A git rename command should solve it, but let's wait for the review first.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this file is already in snake_case. How great is that?
😁😁

@Gui-FernandesBR Gui-FernandesBR changed the title Maint/env analysis plots prints MAINT: moving env_analysis plots and prints May 26, 2023
@MateusStano
Copy link
Member

MateusStano commented May 27, 2023

Notice how the test name is mistyped... It says "_anaysis.py" instead of "_analysis.py". A git rename command should solve it, but let's wait for the review first.

I actually found another problem with the tests. the test test_allInfo is missing the @patch("matplotlib.pyplot.show") decorator

I think we should change this and the naming problem in this PR. Or else we will have to make another PR that will cause conflicts with this one

@MateusStano
Copy link
Member

  • Question: Do you want me to also update the 2 environment analysis notebooks? So far, I didn't updated it to

Yes, please! Or else this PR feels incomplete

Copy link
Member

@MateusStano MateusStano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes remaining:

  • Update notebooks
  • Fix _anaysis typo
  • Add @patch("matplotlib.pyplot.show") decorator to allInfo test

@Gui-FernandesBR
Copy link
Member Author

  • Question: Do you want me to also update the 2 environment analysis notebooks? So far, I didn't updated it to

Yes, please! Or else this PR feels incomplete

Ok! I just didn't want to create a bunch of conflicts within notebooks. But let's go, you're the boss here :)

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@Gui-FernandesBR
Copy link
Member Author

@MateusStano , I updated everything as requested. Ready for a re-review now

Copy link
Member

@MateusStano MateusStano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good! Feel free to merge whenever

@Gui-FernandesBR Gui-FernandesBR merged commit ea37e32 into beta/v1.0.0 May 29, 2023
@Gui-FernandesBR Gui-FernandesBR deleted the maint/env-analysis-plots-prints branch May 29, 2023 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants