Skip to content

Add option to export spike waveforms subset to phy (mimic phy extract-waveforms)#4699

Open
alejoe91 wants to merge 2 commits into
SpikeInterface:mainfrom
alejoe91:phy-extract-waveforms
Open

Add option to export spike waveforms subset to phy (mimic phy extract-waveforms)#4699
alejoe91 wants to merge 2 commits into
SpikeInterface:mainfrom
alejoe91:phy-extract-waveforms

Conversation

@alejoe91

@alejoe91 alejoe91 commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds an add_waveforms option to export_to_phy that writes phy's _phy_spikes_subset.{spikes,channels,waveforms}.npy files, mimicking the phy extract-waveforms CLI command.
  • Reuses the SortingAnalyzer's waveforms/random_spikes extensions when already computed, and computes them on demand otherwise (skipping with a warning if there's no recording available).
  • Handles both sparse and dense SortingAnalyzer/sparsity combinations, matching the sparsity already used for templates.npy/pc_feature_ind.npy.

Test plan

  • Verified with phylib.io.model.TemplateModel (phy's own loader) that the exported files load correctly and return proper per-cluster waveforms, for both sparse and dense analyzers.
  • Verified stored waveform values exactly match manually-extracted raw-trace snippets (accounting for nbefore/uV scaling).
  • Add a unit test to src/spikeinterface/exporters/tests/ covering add_waveforms=True.

🤖 Generated with Claude Code

alejoe91 and others added 2 commits July 20, 2026 10:49
Writes _phy_spikes_subset.{spikes,channels,waveforms}.npy from the
SortingAnalyzer's "waveforms"/"random_spikes" extensions, so phy/phy-lib
can display individual spike waveforms without re-reading the raw
recording.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@alejoe91 alejoe91 added this to the 0.105.0 milestone Jul 20, 2026
@alejoe91 alejoe91 added the extractors Related to extractors module label Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extractors Related to extractors module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant