ENH: Function Validation Rework & Swap np.searchsorted to bisect_left #582
Conversation
|
@MateusStano I made all the commentaries that I found important to be done in this first review. |
|
Also, @MateusStano can we make all the new methods completely private (i.e. use These new methods won't be used out of the Function class, plus using double score seems better, it allows python to mangle the methods. |
np.searchsorted to bisect_left np.searchsorted to bisect_left
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## mnt/flight-simulation-speed-up #582 +/- ##
=================================================================
Coverage ? 72.86%
=================================================================
Files ? 59
Lines ? 9547
Branches ? 0
=================================================================
Hits ? 6956
Misses ? 2591
Partials ? 0 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
|
@MateusStano good work solving the majority of commentaries! Could you add tests for the lines missing coverage? |
|
Also, @MateusStano could you please add your PR to the CHANGELOG? |
Pull request type
Checklist
black rocketpy/ tests/) has passed locallypytest tests -m slow --runslow) have passed locallyCurrent behavior
get_value_optwere usingnp.searchsorted, which was slowNew behavior
source->interpolationandextrapolation->inputs,outputsandtitle. Theget_value_optfunction is now modularized and is defined according to the currentinterpolationandextrapolationbisect_leftis now used instead ofnp.searchsorted. This cuts the execution time by half in au_dot_generalizedcall.The
Functionclass should behave exactly the same as before.Breaking change
Additional information
__img_dim__that was never used and was always equal to 1. I changed it so its defined at the__init__for backward compatibility purposes, but it is still never used__mul__,__sub__,__truediv__and other operations by avoiding going through all the validation checks when re-initializing the Functions