Closed phmbressan closed 2 months ago
I will update the Documentation regarding the changes shortly, but feature wise the PR should be ready to review.
There seems to be a minimum amount of points for the ND linear interpolation to be used. Could this be checked for when initializing the Function object?
I have introduced a check into commit c04d401. Let me know if this solution is enough.
Attention: Patch coverage is 92.00000%
with 8 lines
in your changes missing coverage. Please review.
Project coverage is 75.45%. Comparing base (
3c759f7
) to head (bae7cae
). Report is 17 commits behind head on develop.
Files with missing lines | Patch % | Lines |
---|---|---|
rocketpy/mathutils/function.py | 92.00% | 8 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I have introduced a check into commit c04d401. Let me know if this solution is enough.
Seems good enough to me
Pull request type
Checklist
black rocketpy/ tests/
) has passed locallypytest tests -m slow --runslow
) have passed locallyCHANGELOG.md
has been updated (if relevant)Current behavior
Options of ND interpolation and extrapolation of ND Functions are rather limited. Only "shepard" is supported, which might not be adequate for some datasets.
New behavior
This PR introduces the following polation methods for ND Functions:
Interpolation:
Extrapolation:
Note: I could not find an easy / reasonable approach for strictly linear extrapolation, since the dataset dealt by the Function class is generally "unstructed" (check out scipy tools) which prevent the usage of utilities that make use of "structed" data (like interpn). It should be possible to build a Delaunay triangulation with scipy tools to find the nearest points and manually build the linear extrapolation, but the accuracy and applicability of the results will likely vary a lot.
Therefore, due to having more smooth and predictable results, I have decided to apply "rbf" extrapolation to the "linear" option (with a explicit warning). This might be worth of an improvement in the future.
Result Examples
Sample plots comparing interpolation results for the paraboloid $f(x,y) = x^2 + y^2$ :
Lambda Function
Rbf Interpolation
Linear Interpolation
Shepard Interpolation
Breaking change