Skip to main content

Crate openreadout_intan

Crate openreadout_intan 

Source
Expand description

Reader for Intan Technologies RHD2000 (.rhd) and RHS2000 (.rhs) recordings in the traditional single-file format.

Layout and vocabulary: docs/formats/intan.md. Provenance: docs/provenance/intan.md (Intan’s public data-file-format application notes). The header lists signal groups and channels; samples follow in data blocks of 60 or 128 samples. Each stored signal kind (amplifier, auxiliary, supply, temperature, board ADC/DAC, digital, DC amplifier, stimulation) is one trace with a single sweep, scaled as the application notes specify.

§Example

Every reader implements openreadout_core::FormatReader: descriptor says what it reads, sniff recognises a file from its first bytes, and open returns a openreadout_core::Dataset with a header-only info() summary and lazy data access.

use openreadout_core::FormatReader;
use openreadout_intan::IntanReader;

let format = IntanReader.descriptor();
assert_eq!(format.id, openreadout_intan::FORMAT_ID);
println!("{} ({}): .{}", format.name, format.family, format.extensions.join(", ."));

Reading a file:

use std::path::Path;

use openreadout_core::FormatReader;
use openreadout_intan::IntanReader;

let mut dataset = IntanReader.open(Path::new("recording.rhd"))?;
let info = dataset.info()?; // headers only
let trace = &info.traces[0];
println!("{} sweep(s) at {} Hz, {} channel(s)", trace.sweep_count, trace.sample_rate_hz, trace.channels.len());
// The first 1000 samples of sweep 0, every channel, scaled to physical units.
let samples = dataset.read_trace(0, 0, 0, 1000)?;
for (channel, values) in trace.channels.iter().zip(&samples.channels) {
    println!("{} ({}): {:?}", channel.name, channel.unit.as_deref().unwrap_or("?"), values.first());
}

Applications that accept any instrument file usually register every reader in an openreadout_core::Registry and let it detect the format; that is what the openreadout command-line tool does.

§API stability

The supported API is what this page documents. The parser modules are public only so that tests and fuzz targets can reach them: they are hidden from this documentation and may change in any release.

Structs§

IntanReader
The Intan reader.

Constants§

FORMAT_ID
Format id used on the command line and in JSON.
SESSION_COMPANIONS
Files a split-layout directory may hold besides info.rhd/info.rhs and the .dat files: the acquisition settings and notes.

Functions§

is_split_header
True for an info.rhd / info.rhs header file that has time.dat or other .dat files next to it and no data blocks of its own: opening it opens the split recording.
session_files
The files of a “one file per signal type” or “one file per channel” Intan directory (its info.rhd / info.rhs and .dat files), or None when dir is not one.