Skip to main content

Crate openreadout_abf

Crate openreadout_abf 

Source
Expand description

Reader for Axon Binary Format (ABF 1 and ABF 2) electrophysiology recordings.

Layout and vocabulary: docs/formats/abf.md. Provenance: docs/provenance/abf.md (derived from the public, MIT-licensed pyABF documentation and the corpus; the Axon SDK was never consulted). A file is exposed as one trace: sweep_count sweeps × input channels, samples scaled to physical units with the per-channel gain chain recorded in the header.

§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_abf::AbfReader;

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

Reading a file:

use std::path::Path;

use openreadout_core::FormatReader;
use openreadout_abf::AbfReader;

let mut dataset = AbfReader.open(Path::new("cell.abf"))?;
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§

AbfReader
The ABF reader.
AtfReader
The ATF reader.

Constants§

ATF_FORMAT_ID
Format id of ATF files.
FORMAT_ID
Format id used on the command line and in JSON.