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

BUG: plot drag curves when function source is callable #599

Merged

Conversation

Gui-FernandesBR
Copy link
Member

Pull request type

  • Code changes (bugfix, features)

Checklist

  • Tests for the changes have been added (if needed) (no idea on how to do that smartly)
  • 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

When you use a callable object as the source of your power_on or power_off curves in the Rocket class, the all_info() method will break because self.rocket.power_on_drag.x_array is inexistent

New behavior

Solved the issue by adding a try/except block that will prevent code from breaking in the situation

Breaking change

  • No

Additional information

None

@Gui-FernandesBR Gui-FernandesBR added Bug Something isn't working Outputs Dedicated to visualizations enhancements like prints and plots labels May 15, 2024
@Gui-FernandesBR Gui-FernandesBR added this to the Release v1.X.0 milestone May 15, 2024
@Gui-FernandesBR Gui-FernandesBR self-assigned this May 15, 2024
@Gui-FernandesBR Gui-FernandesBR requested a review from a team as a code owner May 15, 2024 15:31
Copy link

codecov bot commented May 15, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 73.35%. Comparing base (61ebbc7) to head (757223b).
Report is 21 commits behind head on develop.

Files Patch % Lines
rocketpy/plots/rocket_plots.py 50.00% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #599      +/-   ##
===========================================
- Coverage    73.37%   73.35%   -0.02%     
===========================================
  Files           57       57              
  Lines         9453     9473      +20     
===========================================
+ Hits          6936     6949      +13     
- Misses        2517     2524       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Could you also fix this line?

f"Number of points defining the lift curve: {len(self.aero_surface.airfoil_cl.x_array)}"

The airfoil prints will run into the same bug if it is callable defined

@Gui-FernandesBR
Copy link
Member Author

Could you also fix this line?

f"Number of points defining the lift curve: {len(self.aero_surface.airfoil_cl.x_array)}"

The airfoil prints will run into the same bug if it is callable defined

This is a very good comment. Let's fix it in another PR.

I think it's important to add a test to this PR so we prevent the same error from happening again in the future

@Gui-FernandesBR Gui-FernandesBR merged commit 63ef48d into develop May 16, 2024
9 of 10 checks passed
@Gui-FernandesBR Gui-FernandesBR deleted the bug/plot-drag-curves-callable-function-source branch May 16, 2024 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Outputs Dedicated to visualizations enhancements like prints and plots
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

3 participants