Skip to content

Fix NaN handling for TimeIntervals bounds - #2255

Open
AtomicGlance wants to merge 1 commit into
NeurodataWithoutBorders:devfrom
AtomicGlance:codex/2212-nan-time-intervals
Open

Fix NaN handling for TimeIntervals bounds#2255
AtomicGlance wants to merge 1 commit into
NeurodataWithoutBorders:devfrom
AtomicGlance:codex/2212-nan-time-intervals

Conversation

@AtomicGlance

Copy link
Copy Markdown

Fixes #2212

What changed

  • Ignore NaN start times in TimeIntervals.get_starting_time.
  • Calculate duration from the earliest valid start to the latest known start or stop boundary, so an ongoing interval with a missing stop does not shorten the observed span.
  • Return None for an empty table and NaN when no valid start time exists.
  • Add regression coverage for mixed and all-NaN inputs and document the behavior in the upcoming changelog.

Testing

  • python -m pytest tests/unit/test_epoch.py -q — 26 passed
  • ruff check src/pynwb/epoch.py tests/unit/test_epoch.py — passed
  • The broader unit suite reports 594 passed and 2 skipped; its only failures are the existing typemap-cache tests, which require the missing NWB schema submodule in this partial checkout.

@AtomicGlance
AtomicGlance force-pushed the codex/2212-nan-time-intervals branch from 224fcdf to 95d2e46 Compare September 3, 2026 20:11
@AtomicGlance

Copy link
Copy Markdown
Author

I updated this branch onto the current PyNWB dev branch and resolved the release changelog conflict. All 26 tests in ests/unit/test_epoch.py pass locally, including NaN starts/stops and ongoing-interval cases. The diff remains limited to TimeIntervals behavior, tests, and the changelog. It is ready for review when convenient.

@AtomicGlance

Copy link
Copy Markdown
Author

I rechecked the refreshed branch against the local source tree: the NaN/ongoing interval cases pass (5 passed), including all-NaN and later-start boundaries. No new code changes were needed; the branch is current and ready for review.

@AtomicGlance
AtomicGlance force-pushed the codex/2212-nan-time-intervals branch from 95d2e46 to 6e41c14 Compare September 9, 2026 18:42
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.

TimeIntervals.get_duration / get_starting_time return NaN with NaN start/stop times

1 participant