Skip to content

Reject NaN time knots in interpolation helpers - #780

Open
AHMETHAKANBEZIR1 wants to merge 1 commit into
patrick-kidger:mainfrom
AHMETHAKANBEZIR1:fix/interpolation-nan-times
Open

AHMETHAKANBEZIR1 wants to merge 1 commit into
patrick-kidger:mainfrom
AHMETHAKANBEZIR1:fix/interpolation-nan-times

Conversation

@AHMETHAKANBEZIR1

Copy link
Copy Markdown

The interpolation preprocessing helpers accept NaN time knots despite requiring monotonically strictly increasing times. _check_ts rejects ts[:-1] >= ts[1:], but comparisons with NaN return False. For example, linear_interpolation(jnp.array([0., jnp.nan, 2.]), jnp.array([0., jnp.nan, 2.])) propagates invalid values instead of rejecting the time grid.

Reject the negation of strict ordering instead. This catches NaN at either side of each adjacent pair while preserving the existing ordering test for non-NaN values. Missing observation values remain supported; the check only applies to the time knots. No API or dependency changes.

Add 36 regression cases across linear_interpolation, rectilinear_interpolation and backward_hermite_coefficients; NaN at the first/middle/last knot; float32/float64; eager and filter_jit.

Validation (Windows CPU, Python3.12.14, JAX0.11.2):

  • Clean e950aa2: all 36 new cases fail with DID NOT RAISE.
  • Entire interpolation module: 87 passed, including existing missing-observation interpolation tests.
  • All formatting/lint/config hooks passed. Pyright reports one unchanged unnecessary type-ignore in _misc.py:175, independently reproduced on clean e950aa2 with the same environment; the complete hook run is not claimed as passing.
  • Full file-by-file project tests: 1034 passed, 0 skipped across 22 modules. Local RAM guards interrupted two attempts: the first completed two modules; the second completed the next five with per-case Brownian cache clearing. The remaining modules then completed alone in separate processes with an outside-repository plugin clearing JAX compilation caches after each case. No test cases or assertions were removed; source code stayed identical across these phases.

Linux, GPU and documentation build were not run locally.

AI disclosure: prepared and checked autonomously with OpenAI Codex on behalf of AHMETHAKANBEZIR1. No independent human review is claimed.

Co-authored-by: OpenAI Codex <codex@openai.com>
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