Skip to content

Add optional time_before_peak_in_ms to waveform_mean and waveform_sd - #709

Merged
rly merged 4 commits into
devfrom
add_waveform_peak_time
Aug 11, 2026
Merged

Add optional time_before_peak_in_ms to waveform_mean and waveform_sd#709
rly merged 4 commits into
devfrom
add_waveform_peak_time

Conversation

@h-mayorquin

Copy link
Copy Markdown
Contributor

Summary of changes

  • Added the optional time_before_peak_in_ms attribute to waveform_mean and waveform_sd.
  • Added the release notes entry for 2.10.1.

From a discussion with @alejoe91 in #667. sampling_rate and the shape give the duration of the waveform window but not where the peak sits inside it. This PR adds an optional time_before_peak_in_ms attribute 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:

  • Add release notes for the PR to docs/format/source/format_release_notes.rst.
  • Have you included the relevant issue number using "Fix #XXX" notation where XXX is the issue number? By including "Fix #XXX" you allow GitHub to close issue #XXX when the PR is merged.
  • Make sure that hdmf-common-schema points to the latest release and not the latest commit on the main branch.

If this is the first schema change after a schema release (i.e., the version string in core/nwb.namespace.yaml does not
end in "-alpha"), then:

  • Update the version string in core/nwb.namespace.yaml and core/nwb.file.yaml to the next major/minor/patch
    version 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".
  • Update the value of the version variable in docs/format/source/conf.py to the next version without the
    suffix "-alpha", e.g., "2.5.0".
  • Update the value of the release variable in docs/format/source/conf.py to the next version with the suffix
    "-alpha", e.g., "2.5.0-alpha".
  • Add a new section in the release notes docs/format/source/format_release_notes.rst for the new version
    with the date "Upcoming" in parentheses.

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
@rly

rly commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Good idea. I think this should also be added to the waveforms column. What do you think?

@h-mayorquin

Copy link
Copy Markdown
Contributor Author

I agree but I am off this week. I can do It next.

@h-mayorquin

Copy link
Copy Markdown
Contributor Author

@rly Done

@rly
rly merged commit d4bd08e into dev Aug 11, 2026
6 checks passed
@rly
rly deleted the add_waveform_peak_time branch August 11, 2026 00:25
@rly

rly commented Aug 11, 2026

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

Proposal: Add waveform Timing Context for Units Table

2 participants