Skip to content

Add MergePoints waveform fallback#22

Merged
yoshihito-saito merged 5 commits into
masterfrom
fix-mergepoints-waveform-fallback
May 13, 2026
Merged

Add MergePoints waveform fallback#22
yoshihito-saito merged 5 commits into
masterfrom
fix-mergepoints-waveform-fallback

Conversation

@yoshihito-saito

Copy link
Copy Markdown
Collaborator

Summary

Add a waveform extraction fallback in calc_CellMetrics/getWaveformsFromDat.m for sessions where basename.dat is missing but subfolder amplifier.dat files are available.

Changes

  • keep the existing behavior when basename.dat exists
  • fall back to subfolder amplifier.dat files when basename.dat is missing
  • require basename.MergePoints.events.mat for the fallback path
  • use MergePoints.foldernames and MergePoints.timestamps_samples to map spikes to each segment
  • verify sample-count consistency between MergePoints and each segment file
  • skip spikes too close to segment boundaries
  • set spikes.processinginfo.params.WaveformsSource to MergePoints amplifier.dat files

Why

Some recordings are stored as segmented amplifier.dat files instead of a single top-level basename.dat. This change allows waveform extraction to proceed in those cases while preserving the original behavior for standard sessions.

@yoshihito-saito

Copy link
Copy Markdown
Collaborator Author

Manual validation was performed on a copied session containing both a top-level basename.dat and segmented subfolder amplifier.dat files.

To make the direct and fallback paths comparable, waveform extraction was tested with nPull set high enough to avoid random spike subsampling.

Results:

  • the direct path (basename.dat) and the fallback path (MergePoints + subfolder amplifier.dat) both extracted raw waveforms for all 71 units
  • unit ordering matched across paths
  • waveform extraction times matched for 70/71 units overall
  • after excluding spikes within one waveform window of segment boundaries, waveform extraction times matched for 71/71 units

The fallback path intentionally skips boundary-adjacent spikes, since their waveform window would cross a subfolder file boundary and could otherwise produce incomplete waveforms. The remaining full-comparison mismatch is consistent with that expected behavior.

@yoshihito-saito yoshihito-saito merged commit 146cf10 into master May 13, 2026
1 check passed
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