Add num_samples to ImageSeries#2194
Open
rly wants to merge 2 commits into
Open
Conversation
Adds optional `num_samples` dataset to `ImageSeries` to support cases where format='external' and rate-based timing is used, since the data array is empty and its shape cannot be used to determine the frame count. A ValueError is raised on construction (UserWarning on read) when `num_samples` is absent in this configuration. Also updates nwb-schema submodule to dev tip (489cc31f) which defines this field, and pins HDMF to >=6.0.2 which fixed the np.generic/uint64 type error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2194 +/- ##
==========================================
+ Coverage 95.21% 95.24% +0.02%
==========================================
Files 30 30
Lines 2989 3005 +16
Branches 442 446 +4
==========================================
+ Hits 2846 2862 +16
Misses 87 87
Partials 56 56
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
489cc31f), which adds the optionalnum_samplesdataset toImageSeries. Corresponds to Add optionalnum_samplesdataset toImageSeriesfor external file timing nwb-schema#678num_samplesinImageSeries: whenformat='external'andrate-based timing isused, the data array is empty (shape
(0, 0, 0)) and its length cannot be used to determine theframe count.
num_samplesfills that gap.ValueErroron construction whenexternal_file+rateare set butnum_samplesisabsent. Files missing the field are read silently (no warning) to avoid noise from existing data.
TimeSeries.num_samples(a computed read-only property) with a stored attribute backedby
self._num_samples, falling back to the parent implementation for data-bearing series.rate+num_samplesrequirement for external-file series.>=6.0.2, which fixed aTypeErrorwhen writingnp.uint64values.Checklist
num_samplesis written to and read back from HDF5 (roundtrip test added)ValueErrorraised whenexternal_file+rate+ nonum_sampleson constructionnum_samplesnum_samplesnot required whentimestampsis provided