A python library to parse ADC64-formatted files
Project description
This is a script and library to help interfact with the ADC64 format.
To install:
pip install adc64format
## mpd format (new) To use interactively or within another python codebase:
from adc64format import mpd_parse_chunk, mpd_parse_run_start, MPDReader input_file = adc64format.MPDReader(input_filename,n_adcs) input_file.open() # Read run info _, nbytes_runinfo, runinfo = adc64format.mpd_parse_run_start(input_file.stream) # use the first file for the event reference _, chunk_size, test_event = adc64format.mpd_parse_chunk(input_file.stream) events = input_file.next(batch_size) print(events.keys())
## adc64 format (old)
To dump the contents of a single ADC64 file to an HDF5 format:
adc64_to_hdf5.py <input ADC64 file>.data <output HDF5 file>.h5
To use interactively or within another python codebase:
from adc64format import dtypes, skip_chunks, parse_chunk, ADC64Reader # Option 1: Parse a single event from an ordinary file object with open('<ADC64 file>.data', 'rb') as f: # Load the first event chunk = parse_chunk(f) # Look at chunk data (as numpy arrays) for key in dtypes: print(chunk[key]) # Skip N events n = 100 skip_chunks(f, n) chunk = parse_chunk(f) # Option 2: Parse events from multiple files and align by timestamp with ADC64Reader('<ADC 64 file from ADC 0>.data', '<ADC 64 file from ADC 1>.data', ...) as reader: batch_size = 10 # how many events to load on each iteration events = reader.next(batch_size) # get matched events between multiple files events_file0, events_file1, ... = events # Look at data for key in dtypes: print(events_file0[key])
Project details
Release history Release notifications | RSS feed
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 Distribution
File details
Details for the file adc64format-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: adc64format-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45be8805b37f914ffc0d1fffedc060a4f913c2a8d6caa0a6aa4e6c65117fcbad |
|
MD5 | fae003fe41ea9d797e43c128eba2cb74 |
|
BLAKE2b-256 | 97331c468cc2cf63e7f84c2a7029e3976bc4e308b25f8cd5eb424a216394beae |