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

Hermite interpolator may cause ringing #90

Open
ChristopherRabotin opened this issue Oct 17, 2024 · 2 comments
Open

Hermite interpolator may cause ringing #90

ChristopherRabotin opened this issue Oct 17, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ChristopherRabotin
Copy link

Hi there,

I'm quite likely to use your library on a current project. However, I noticed that your implementation of the Hermite interpolation uses the typical approach found in literature. This approach causes ringing for orbit data, where the interpolation is visibly poor. A good test is to implement this test: https://github.com/nyx-space/anise/blob/master/anise/src/math/interpolation/hermite.rs#L218.

The solution is to use the exact same algorithm as in SPICE. Here is the re-implementation of that algorithm in Rust, as part of ANISE:

def hermite(x, y, dy):
. For the details on the tests, you can look at this huge PR, or specifically this commit.

You could also simplify the Lagrange interpolation by using directly the relatively simple SPICE algorithm: https://github.com/nyx-space/anise/blob/master/anise/src/math/interpolation/lagrange.rs#L15 . I would expect this function to be faster than the numpy implementation, but I'm not sure since numpy is pretty well optimized. From my literature review a couple of years ago, I believe that the Lagrange interpolation commonly found matches the SPICE version, so I don't expect there to be any issue in the Lagrange interpolator. My OEMs use Lagrange so this ticket doesn't preclude me from using your library.

Cheers

@ChristopherRabotin ChristopherRabotin added the bug Something isn't working label Oct 17, 2024
@ChristopherRabotin
Copy link
Author

Here's a write-up of the algorithm if that's of interest: https://nyxspace.com/anise/reference/mathspec/interpolation/hermite/ .

@bradsease
Copy link
Owner

Thanks for the feedback! I'll try to get this into the next version

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
None yet
Development

No branches or pull requests

2 participants