Add optional time_before_peak_in_ms to waveform_mean and waveform_sd - #709
Merged
Conversation
The sampling_rate attribute and the dataset shape give the duration of the waveform window but not where the spike peak falls within it. Add an optional waveform_peak_time_ms attribute on waveform_mean and waveform_sd recording the time in milliseconds from the first sample to the alignment point used during spike sorting.
The sampling_rate attribute and the dataset shape give the duration of the waveform window but not where the spike peak falls within it. Add an optional time_before_peak_in_ms attribute on waveform_mean and waveform_sd recording the time in milliseconds from the first sample to the alignment point used during spike sorting. The name follows the units convention proposed in #569 and the quantity is the same as ms_before in SpikeInterface.
…ime' into add_waveform_peak_time # Conflicts: # core/nwb.misc.yaml # docs/format/source/format_release_notes.rst
Contributor
|
Good idea. I think this should also be added to the |
Contributor
Author
|
I agree but I am off this week. I can do It next. |
Contributor
Author
|
@rly Done |
rly
approved these changes
Aug 11, 2026
Contributor
|
Thank you @h-mayorquin ! |
rly
added a commit
to NeurodataWithoutBorders/pynwb
that referenced
this pull request
Aug 11, 2026
Update the nwb-schema submodule to the latest dev, which adds the optional time_before_peak_in_ms attribute to the waveform_mean, waveform_sd, and waveforms datasets of Units (NeurodataWithoutBorders/nwb-schema#709). Expose it as the waveform_time_before_peak_in_ms constructor argument and field of Units, following the waveform_rate and waveform_unit pattern: written onto all three waveform columns and read back from the first populated one, with a warning when the columns disagree. Return the NO_OVERRIDE sentinel from the UnitsMap constructor argument overrides so that an absent attribute leaves the docval default in place under HDMF >= 6.2.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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 of changes
time_before_peak_in_msattribute towaveform_meanandwaveform_sd.From a discussion with @alejoe91 in #667.
sampling_rateand the shape give the duration of the waveform window but not where the peak sits inside it. This PR adds an optionaltime_before_peak_in_msattribute with the time in milliseconds from the first sample to the peak, that is, the alignment point used during spike sorting. The value is the same for every unit and every spike, so it is an attribute and not a column.This should close #667.
Checklist
For all schema changes:
docs/format/source/format_release_notes.rst.hdmf-common-schemapoints to the latest release and not the latest commit on themainbranch.If this is the first schema change after a schema release (i.e., the version string in
core/nwb.namespace.yamldoes notend in "-alpha"), then:
core/nwb.namespace.yamlandcore/nwb.file.yamlto the next major/minor/patchversion with the suffix "-alpha". For example, if the current version is 2.4.0 and this is a minor change, then the
new version string should be "2.5.0-alpha".
versionvariable indocs/format/source/conf.pyto the next version without thesuffix "-alpha", e.g., "2.5.0".
releasevariable indocs/format/source/conf.pyto the next version with the suffix"-alpha", e.g., "2.5.0-alpha".
docs/format/source/format_release_notes.rstfor the new versionwith the date "Upcoming" in parentheses.