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: Invalid Arguments on Two Dimensional Discretize (HOTFIX). #521

Merged
merged 5 commits into from
Jan 18, 2024

Conversation

phmbressan
Copy link
Collaborator

@phmbressan phmbressan commented Dec 21, 2023

Pull request type

  • Code changes (bugfix, features)

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 --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Current behavior

The PR #451 introduced a standard for the get_value arguments regarding multidimensional Functions that were not updated everywhere in code: the method set_discrete for 2D Functions breaks. One may verify it by running on master:

>>> from rocketpy import Function
>>> f = Function(lambda x,y: x**2 + y**2)
>>> f.set_discrete(-10,10,25)

New behavior

During debug there were two root causes for the error that were fixed:

  1. get_value call still used one argument for two dimensional domains: a simple argument separation was enough for a fix.
  2. __check_user_inputs method did not account for the possibility of a Function being a source.

Basic tests were implemented. Since this is a hotfix, I avoided changing much, but a full fix involves exploring issue #481 and improving the sets for interpolation and extrapolation that are quite circular in current code.

More tests and better docs for discretize are incoming on #519 .

Breaking change

  • No

Other Information

The original motivation that lead to this bug discovery was from codecov, who told be in PR #519 that the tests did not cover 2D Function.

@phmbressan phmbressan added the Bug Something isn't working label Dec 21, 2023
@phmbressan phmbressan requested a review from a team December 21, 2023 00:09
@phmbressan phmbressan self-assigned this Dec 21, 2023
Copy link

codecov bot commented Dec 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0c49c0b) 70.92% compared to head (223d598) 71.15%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #521      +/-   ##
==========================================
+ Coverage   70.92%   71.15%   +0.22%     
==========================================
  Files          55       55              
  Lines        9262     9259       -3     
==========================================
+ Hits         6569     6588      +19     
+ Misses       2693     2671      -22     
Flag Coverage Δ
unittests 71.15% <100.00%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

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

Very well solved, thank you.

MateusStano
MateusStano previously approved these changes Jan 17, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
@Gui-FernandesBR Gui-FernandesBR merged commit 4127313 into master Jan 18, 2024
11 checks passed
@Gui-FernandesBR Gui-FernandesBR deleted the bug/function-2d-discretize branch January 18, 2024 22:38
@Gui-FernandesBR Gui-FernandesBR added this to the Release v1.X.0 milestone Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

4 participants