Skip to content

Fix misleading error message for coordinate validation#12

Merged
kylecarow merged 1 commit intoNatLabRockies:mainfrom
meredithdoan:error-update
Jan 30, 2026
Merged

Fix misleading error message for coordinate validation#12
kylecarow merged 1 commit intoNatLabRockies:mainfrom
meredithdoan:error-update

Conversation

@meredithdoan
Copy link

The error message for Monotonicity(usize) claims that coordinates must be "sorted and non-repeating," but the actual implementation only checks for monotonically increasing values (using <=), which allows duplicate/repeating values. This makes the error message deceptive - it promises stricter validation than is actually performed.

An alternative fix would be to change the implementation to use < instead of <=, enforcing strictly increasing coordinates (no duplicates). See https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.PchipInterpolator.html: SciPy's interpolation functions explicitly reject duplicate values as they would make the function "overspecified." However, changing the implementation to require strictly increasing coordinates would be a breaking change and may affect existing users. This PR opts for the minimal fix of correcting the error message to match the current behavior.

@kylecarow
Copy link
Collaborator

Thanks for the PR @meredithdoan! I'll go ahead and merge this.
Good catch on this; I had forgotten to update the error message when I loosened that restriction.

If anyone in the future has feelings about changing the comparison to be < rather than <=, I'm open to making a new major version to do so.

@kylecarow kylecarow merged commit f4aca48 into NatLabRockies:main Jan 30, 2026
1 check passed
@meredithdoan meredithdoan deleted the error-update branch January 30, 2026 20:06
@kylecarow
Copy link
Collaborator

@meredithdoan I've published these changes in v0.8.2!

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.

2 participants