Expand description
Reader for SpikeGLX recordings: a .meta text file beside a headerless interleaved int16
.bin (Neuropixels imec AP/LF streams, NI-DAQ and OneBox streams).
Layout and vocabulary: docs/formats/spikeglx.md. Provenance: docs/provenance/spikeglx.md
(the SpikeGLX authors’ public metadata documentation). One stream (one .bin) is one trace
with a single sweep; channels are scaled to µV (imec) or V (NI, OneBox) as the documentation
specifies; status (SY) and digital (XD) words are returned raw.
§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_spikeglx::SpikeGlxReader;
let format = SpikeGlxReader.descriptor();
assert_eq!(format.id, openreadout_spikeglx::FORMAT_ID);
println!("{} ({}): .{}", format.name, format.family, format.extensions.join(", ."));Reading a file:
use std::path::Path;
use openreadout_core::FormatReader;
use openreadout_spikeglx::SpikeGlxReader;
let mut dataset = SpikeGlxReader.open(Path::new("run_g0_t0.imec0.ap.bin"))?;
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§
- Spike
GlxReader - The SpikeGLX reader.
Constants§
- FORMAT_
ID - Format id used on the command line and in JSON.
- SESSION_
COMPANIONS - Files a SpikeGLX run directory may hold besides the stream pairs:
.metafiles (read with their.bin), logs, notes and text outputs.
Functions§
- looks_
like_ meta - True when
.metatext looks like SpikeGLX metadata. - open_
session - Open a SpikeGLX run directory: every stream (imec AP and LF bands, NI-DAQ, OneBox) is a trace of its own, with its own rate and sample clock; nothing is resampled or realigned.
- session_
files - The stream
.binfiles (each with its.meta) of a SpikeGLX run directory, orNonewhendiris not one (seeopenreadout_core::session::session_files). The run directory<run>_g0/holds the NI-DAQ and OneBox streams; each probe’s streams are in a subdirectory named…_imec<N>(normally<run>_g0_imec<N>/), which is read too. Other subdirectories (post-processing outputs) are ignored, and a directory that only wraps a run directory is not a run itself.