Make Units.waveform_unit configurable - #2237
Open
rly wants to merge 1 commit into
Open
Conversation
Update the nwb-schema submodule to the latest schema dev (2.10.1-alpha), which includes NeurodataWithoutBorders/nwb-schema#707. That PR changes the "unit" attribute of Units.waveform_mean, waveform_sd, and waveforms from a fixed value of "volts" to a default value of "volts". HDMF short-circuits attribute resolution when a spec has a fixed value, so the existing mapping from Units.waveform_unit onto the "unit" attribute of the waveform columns was never reached and the requested unit was silently replaced with "volts" on write. With the schema change the mapping is reachable, so no write-path change is needed. Implement the warning placeholder in UnitsMap._get_waveform_stat: a file can now carry different "unit" values across the three waveform columns while the Units container holds only one, so report which column's value was used. Fixes #2162 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2237 +/- ##
==========================================
+ Coverage 96.04% 96.24% +0.19%
==========================================
Files 30 30
Lines 3010 3010
Branches 437 436 -1
==========================================
+ Hits 2891 2897 +6
+ Misses 67 64 -3
+ Partials 52 49 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 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.
Fixes #2162.
Updates the nwb-schema submodule to the latest schema dev (2.10.1-alpha), which includes NeurodataWithoutBorders/nwb-schema#707. That PR changes the
unitattribute ofUnits.waveform_mean,waveform_sd, andwaveformsfrom a fixed value of"volts"to a default value of"volts".HDMF short-circuits attribute resolution when a spec has a fixed value, so the existing mapping from
Units.waveform_unitonto theunitattribute was never reached. With the schema change it is reachable, so no write-path change was needed.Also implements the warning placeholder in
UnitsMap._get_waveform_stat, since a file can now carry differentunitvalues across the three waveform columns while theUnitscontainer holds only one.Note that
waveform_unitcan only be set on theUnitsconstructor, so it is not reachable from thenwbfile.add_unit(...)path that auto-creates the table. Worth addressing separately.🤖 Generated with Claude Code