Skip to main content

Library for opening Nalu Scientific data files

Project description

NaluACQ

naluacq is a Rust crate for I/O with Nalu Scientific acquisitions in the GbE-compatible format.

The crate encompasses the following:

  • Reading acquisitions
  • Writing acquisitions (mainly used by naludaq_rs)
  • Parsing events from acquisitions
  • Calibration of events
  • Exporting acquisitions to other formats

Some of these features are made available in the Python (PyO3) bindings for this crate.

Structure of Acquisitions

An acquisition in the new format is a directory containing multiple files describing various aspects of the acquisition.

  • {n}.bin - binary event data file "n" (up to 500 MB) containing raw events back-to-back
  • {n}.idx - index file containing the offset and length of each event in the corresponding .bin file
  • metadata.yml - user-defined string metadata. NaluDAQ uses this to store board parameters and registers.
  • readout_metadata - more user-defined binary metadata. NaluDAQ uses this for extra information about the readout.
  • [pedestals_calibration] - optional binary file containing pedestal calibration data
  • [timing_calibration] - optional binary file containing timing calibration data
  • [adc2mv_calibration] - optional binary file containing ADC to mV calibration data

Event Storage

Events are stored in groups of 500 MB maximum known as "chunks." Each chunk is represented using two files: a .bin file which contains the raw event data and an .idx file which points to each event in the .bin file.

Bin File

Events are stored back-to-back in the .bin files as unparsed binary data. A maximum of 500 MB (at the time of writing) is allowed to be stored in a single .bin file. The rough structure is as follows:

  1. Metadata Sector
    • 8-byte header indicating file version type and sector length
    • user-defined metadata stored as raw bytes
  2. Data Sector
    • Event 1 (raw bytes)
    • Event 2 (raw bytes)
    • ...

Idx File

Because searching through the entire file for a specific event would be painfully slow, an index file is used to store the offset and length of each event in the corresponding .bin file. The index file is comprised of several 8-byte entries, each indicating the offset and length of a single event in the .bin file. A specific event can be found by reading the entry at 8 * index bytes and then reading length bytes from the .bin file starting at offset bytes.

Examples

Reading an Acquisition

use naluacq::Acquisition;

let acq = Acquisition::open("path/to/acquisition.acq").unwrap();

let idx = 0;
let raw_event = acq.get(idx).unwrap()

Parsing an Acquisitions

use naluacq::{Acquisition, Aardvarcv3Event, ParseInto};

let acq = Acquisition::open("path/to/acquisition.acq").unwrap();

let idx = 0;
let raw_event = acq.get(idx).unwrap()

let parsed_event: Aardvarcv3Event = raw_event.parse_into().unwrap();

Building the Documentation

cargo doc --open

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

naluacq-0.4.5-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (668.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

naluacq-0.4.5-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (668.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

naluacq-0.4.5-cp312-none-win_amd64.whl (496.8 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

naluacq-0.4.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (668.0 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

naluacq-0.4.5-cp311-none-win_amd64.whl (496.8 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

naluacq-0.4.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (668.4 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

naluacq-0.4.5-cp310-none-win_amd64.whl (496.8 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

naluacq-0.4.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (668.4 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

naluacq-0.4.5-cp39-none-win_amd64.whl (497.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

naluacq-0.4.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (668.2 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

naluacq-0.4.5-cp38-none-win_amd64.whl (497.7 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

naluacq-0.4.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (668.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

naluacq-0.4.5-cp37-none-win_amd64.whl (497.8 kB view hashes)

Uploaded CPython 3.7 Windows x86-64

naluacq-0.4.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (668.9 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page