Skip to content

Stream large Intan RHD recordings to DAT files - #32

Merged
ryanharvey1 merged 1 commit into
masterfrom
codex/intan-stream-to-dat
Sep 30, 2026
Merged

ryanharvey1 merged 1 commit into
masterfrom
codex/intan-stream-to-dat

Conversation

@ryanharvey1

Copy link
Copy Markdown
Member

Large RHD recordings currently require allocating the full recording in MATLAB before export. Add read_Intan_RHD2000_file('streamToDat', true) to write amplifier, auxiliary, analog input, digital input, and timestamp DAT files one RHD block at a time.

The export uses sample-interleaved analog channels, raw ADC counts, auxiliary samples repeated four times, packed digital words, and integer timestamp ticks. Amplifier centering and pre-v3 software notch filtering match the in-memory reader, with filter state carried between blocks. Reject incomplete blocks before exporting, check read/write counts, report timestamp gaps, and close input/output handles on errors.

The default workspace-loading behavior remains available. Streaming overwrites these five DAT files beside the selected RHD recording; it does not export supply, temperature, digital output, or header files. Recordings containing only a header retain the existing metadata-loading behavior.

Validation: all 10 regression tests passed locally in MATLAB R2025a. Synthetic multi-block recordings cover RHD versions 1.0–3.0, multi-channel ordering and digital bits, both notch frequencies, signed/unsigned timestamps, missing channels, malformed files, output-open failures, default loading, header-only files, and picker cancellation. git diff --check passed; MATLAB Code Analyzer reported only the two existing unused-variable warnings. Large real recordings were not available for validation.

Format reference: Intan RHD data file formats.

@ryanharvey1
ryanharvey1 merged commit 732cbbd into master Sep 30, 2026
1 check passed
@ryanharvey1
ryanharvey1 deleted the codex/intan-stream-to-dat branch September 30, 2026 20:28
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