Skip to content

Fix subepoch fallback channel inference for Intan and Open Ephys#25

Merged
yoshihito-saito merged 1 commit into
masterfrom
fix-mergepoints-waveform-fallback
Jun 23, 2026
Merged

Fix subepoch fallback channel inference for Intan and Open Ephys#25
yoshihito-saito merged 1 commit into
masterfrom
fix-mergepoints-waveform-fallback

Conversation

@yoshihito-saito

Copy link
Copy Markdown
Collaborator

This fixes subepoch binary fallback loading when no concatenated .dat file is present.

Root cause:

  • Open Ephys continuous.dat files can include extra trailing channels beyond session.extracellular.nChannels.
  • The fallback channel inference relied on MergePoints.timestamps_samples sample counts.
  • MergePoints sample ranges behave like inclusive ranges, causing an off-by-one sample mismatch and non-integer inferred channel counts.

Changes:

  • Infer file channel count using expectedSamples, expectedSamples + 1, and expectedSamples - 1, choosing the one consistent with file size.
  • Preserve reading only 1:session.extracellular.nChannels when fallback files contain extra channels.
  • Resolve MergePoints.foldernames that contain full Linux paths by matching the local epoch folder name.

Validated on:

  • Open Ephys: RM018_day39_260620
    • continuous.dat: 200 channels
    • session: 192 channels
    • extra ADC channels excluded
  • Intan: sake_day10
    • amplifier.dat: 128 channels
    • session: 128 channels

Tests:

  • tests/test_getWaveformsFromDat_mergepoints.m
  • Minimal getWaveformsFromDat fallback check on both real sessions

@yoshihito-saito yoshihito-saito merged commit 31ef26f into master Jun 23, 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