Skip to content

Port Intan "one file per signal type" support from NDR-matlab - #29

Merged
stevevanhooser merged 1 commit into
mainfrom
claude/intan-rhd2000-filename-error-onkw20
Sep 10, 2026
Merged

stevevanhooser merged 1 commit into
mainfrom
claude/intan-rhd2000-filename-error-onkw20

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Summary

Mirrors NDR-matlab#138 (merge b461bf6). NDR-python previously only handled the Intan "one file per channel" directory layout (amp-A-000.dat, aux-A-AUX1.dat, …). Some recordings — including the KJNielsen lab's Intan output that surfaced the sibling bug in vhlab-toolbox — save in the alternative "one file per signal type" layout: all channels of a given signal type share one interleaved file (amplifier.dat, auxiliary.dat, supply.dat, analogin.dat, digitalin.dat, digitalout.dat).

Changes

  • New ndr.format.intan.read_IntanRHD2000_one_file_per_channel_type (regular_port, 1-for-1 with the MATLAB helper) reads one interleaved signal-type file at a time, with the correct Intan filenames.
  • read_Intan_RHD2000_directory:
    • Detects the layout from a *amplifier.dat probe and dispatches to the new helper on hit; keeps the existing per-channel path otherwise.
    • Resolves prefixed info.rhd and time.dat (e.g. febc0_u000_000_info.rhd) via a local _fixdatfilename helper.
    • For digital channels in per-signal-type mode, extracts the requested channel's bit from the packed 16-bit word using its native_order.
  • ndr.reader.intan_rhd.filenamefromepochfiles recognizes <prefix>_info.rhd as the directory-mode header when a *time.dat sibling is in the epoch file list.

Bridge

Bumps matlab_last_sync_hash to b461bf6 on the three affected entries (read_Intan_RHD2000_directory, reader.intan_rhd, and the new helper's own entry). NDR_BRIDGE_CHECK_STRICT=1 bridge checks pass (191 tests).

Tests

Adds tests/test_intan_one_file_per_signal_type.py — 9 tests mirroring the MATLAB TestOneFilePerSignalType suite: interleaved multi-channel amplifier reads, an auxiliary.dat regression pin against the old auxin.dat, time.dat, digital in/out returning the packed 16-bit word, sub-range slicing, prefix resolution, missing-file error, an end-to-end read_Intan_RHD2000_directory dispatch with a synthetic header, and prefixed-info.rhd directory detection. All pass locally.

Test plan

  • pytest tests/test_intan_one_file_per_signal_type.py
  • NDR_BRIDGE_CHECK_STRICT=1 NDR_MATLAB_PATH=../NDR-matlab pytest tests/test_matlab_bridge_completeness.py tests/test_matlab_bridge_conventions.py
  • No regressions in existing intan tests (pytest tests/test_intan_multifile.py tests/test_readers.py).

🤖 Generated with Claude Code

https://claude.ai/code/session_01N2wVrGvkW9xWFGcoP8ed4k


Generated by Claude Code

Mirrors NDR-matlab #138 (merge b461bf6): NDR-python previously only
handled the "one file per channel" Intan directory layout (amp-A-000.dat,
aux-A-AUX1.dat, ...). Some Intan recordings — including the KJNielsen
lab's output that surfaced the sibling bug in vhlab-toolbox — save
in the alternative "one file per signal type" layout, where all channels
of a given signal type share one interleaved file (amplifier.dat,
auxiliary.dat, supply.dat, analogin.dat, digitalin.dat, digitalout.dat).

Add ndr.format.intan.read_IntanRHD2000_one_file_per_channel_type
(regular_port, matching MATLAB semantics 1-for-1) and teach
read_Intan_RHD2000_directory to detect the layout from a *amplifier.dat
probe and dispatch to the new helper on hit. Resolve prefixed info.rhd
and time.dat (e.g., "febc0_u000_000_info.rhd") through a local
fixdatfilename helper. For digital channels in per-signal-type mode,
extract the requested channel's bit from the packed 16-bit word using
its native_order. ndr.reader.intan_rhd.filenamefromepochfiles now
recognizes "<prefix>_info.rhd" as the directory-mode header when a
*time.dat sibling is in the epoch file list.

Bump matlab_last_sync_hash to b461bf6 on the three affected entries and
add a bridge entry for the new function; all pass NDR_BRIDGE_CHECK_STRICT.
9 new unit tests mirror the MATLAB TestOneFilePerSignalType suite.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N2wVrGvkW9xWFGcoP8ed4k
@stevevanhooser
stevevanhooser merged commit eb2c3c2 into main Sep 10, 2026
7 checks passed
@stevevanhooser
stevevanhooser deleted the claude/intan-rhd2000-filename-error-onkw20 branch September 10, 2026 17:57
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.

2 participants