Skip to content

Add num_samples to ImageSeries#2194

Open
rly wants to merge 2 commits into
devfrom
num-samples-imageseries
Open

Add num_samples to ImageSeries#2194
rly wants to merge 2 commits into
devfrom
num-samples-imageseries

Conversation

@rly
Copy link
Copy Markdown
Contributor

@rly rly commented May 19, 2026

Summary

  • Points the nwb-schema submodule to the latest dev tip (489cc31f), which adds the optional
    num_samples dataset to ImageSeries. Corresponds to Add optional num_samples dataset to ImageSeries for external file timing nwb-schema#678
  • Implements num_samples in ImageSeries: when format='external' and rate-based timing is
    used, the data array is empty (shape (0, 0, 0)) and its length cannot be used to determine the
    frame count. num_samples fills that gap.
  • Raises ValueError on construction when external_file + rate are set but num_samples is
    absent. Files missing the field are read silently (no warning) to avoid noise from existing data.
  • Overrides TimeSeries.num_samples (a computed read-only property) with a stored attribute backed
    by self._num_samples, falling back to the parent implementation for data-bearing series.
  • Updates gallery docs to document the rate + num_samples requirement for external-file series.
  • Pins HDMF to >=6.0.2, which fixed a TypeError when writing np.uint64 values.

Checklist

  • num_samples is written to and read back from HDF5 (roundtrip test added)
  • ValueError raised when external_file + rate + no num_samples on construction
  • No error or warning when reading old files without num_samples
  • num_samples not required when timestamps is provided
  • Gallery docs updated

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
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.24%. Comparing base (2bdc540) to head (43e3136).

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              
Flag Coverage Δ
integration 73.21% <75.00%> (+0.14%) ⬆️
unit 85.65% <87.50%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rly rly marked this pull request as ready for review May 19, 2026 05:39
@rly rly requested a review from oruebel May 19, 2026 05:39
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