Skip to content

Add Nearest Neighbor interpolator#287

Open
kshitij-maths wants to merge 2 commits intomathLab:masterfrom
kshitij-maths:feature/nearest-interpolator
Open

Add Nearest Neighbor interpolator#287
kshitij-maths wants to merge 2 commits intomathLab:masterfrom
kshitij-maths:feature/nearest-interpolator

Conversation

@kshitij-maths
Copy link
Copy Markdown
Member

This PR implements the Nearest Neighbor interpolator requested in #166, supporting both univariate and multivariate parameter spaces.

Key Features:

  • Uses scipy.interpolate.interp1d(kind='nearest') for 1D spaces (with fill_value='extrapolate' for robust boundary handling).
  • Uses scipy.interpolate.NearestNDInterpolator for ND spaces.
  • Exposes the rescale=True argument by default for the ND interpolator to prevent severe distance scaling distortions across physical parameters of varying magnitudes.
    Testing:
  • Added comprehensive geometric and rank-consistency unit tests in tests/test_nearest.py (8 passing tests).
  • Added parallel framework compatibility tests in tests/test_parallel/test_nearest.py.

More interpolators such as splines etc will be added in subsequent additions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant