Skip to main content

Crate openreadout_blackrock

Crate openreadout_blackrock 

Source
Expand description

Reader for Blackrock Neurotech NSx continuous files (spec 2.1, 2.2/2.3, 3.0 including PTP) and NEV event files.

Layout and vocabulary: docs/formats/blackrock.md. Provenance: docs/provenance/blackrock.md (Blackrock’s public NEV/NSx specification LB-0023; Neo, BSD-3, read as documentation for spec 2.1). An NSx file is one trace whose sweeps are its data packets (recording pauses); a NEV file is one table of data packets (spikes with waveforms, digital events, comments).

§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_blackrock::BlackrockReader;

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

Reading a file:

use std::path::Path;

use openreadout_core::FormatReader;
use openreadout_blackrock::BlackrockReader;

let mut dataset = BlackrockReader.open(Path::new("session.ns5"))?;
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§

BlackrockReader
The Blackrock reader.

Constants§

EXTENSIONS
Extensions this reader opens.
FORMAT_ID
Format id used on the command line and in JSON.
SESSION_COMPANIONS
Files a Blackrock recording directory may hold besides NSx/NEV data: the Central configuration (.ccf), logs and notes.
SIGNATURES
Leading bytes of the file kinds.

Functions§

open_session
Open a Blackrock recording directory: each NSx file (.ns1–.ns6, one sampling group each) is a trace with its own rate and clock, each NEV file a table. Spec 2.1 NSx files take their scaling from the NEV of the same name, as when opened alone.
session_files
The NSx and NEV files of a Blackrock recording directory, or None when dir is not one (see openreadout_core::session::session_files).