EconForge / interpolation.py

BSD 2-Clause "Simplified" License
123 stars 35 forks source link

Add value tests for linear derivatives #95

Closed Mv77 closed 1 year ago

Mv77 commented 1 year ago

This PR adds tests that check that the derivatives produced by eval_spline are correct. It contains tests only for linear interpolators (order==1) of up to two dimensions, and checks only first order derivatives.

I believe current tests of the derivative functionality check only that the code runs and not for correct outputs.

Tagging @llorracc and @aniecon since they were part of the discussion in #94 .

Mv77 commented 1 year ago

@albop, please let me know if you'd like the file to be at a different location or with a different name. I'd be happy to incorporate any feedback.

You might notice this also adds a numba import in splines/__init__.py which now uses it for the grid checks but did not import it.

llorracc commented 1 year ago

@albop,

This PR fixes a small bug accidentally introduced in your fix of the other bug. It also adds the tests for derivatives, as you asked. It would be convenient for us if it could be merged so we can use the production version rather than a PR version.

(It would also be great if there were a new release that we could put it transparently in the requirements; in the meantime, we could just make the requirements file reference a particular commit).

albop commented 1 year ago

Thank you @Mv77. I've merged your PR. At some point, it would be good to test everything systematically but this can wait a bit.

Mv77 commented 1 year ago

Thank you @albop !