Package for read/write binary file (.adibin format)
Project description
binfilepy
Software library to read and write binary file (.adibin format).
Example to write a binary file:
from binfilepy import BinFile
from binfilepy import CFWBINARY
from binfilepy import CFWBCHANNEL
with BinFile(filename, "w") as f:
header = CFWBINARY()
header.setValue(1.0 / 240.0, 2019, 1, 28, 8, 30, 0.0, 0.0, 2, 0)
f.setHeader(header)
channel1 = CFWBCHANNEL()
channel1.setValue("I", "mmHg", 1.0, 0.0)
f.addChannel(channel1)
channel2 = CFWBCHANNEL("II", "mmHg", 1.0, 0.0)
f.addChannel(channel2)
chanData = []
d1 = [1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1]
d2 = [8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8]
chanData.append(data1)
chanData.append(data2)
f.writeHeader()
f.writeChannelData(chanData)
f.updateSamplesPerChannel(16, True)
Example to read a binary file:
from binfilepy import BinFile
with BinFile(filename, "r") as f:
# You must read header first before you can read channel data
f.readHeader()
# readChannelData() supports reading in random location (Ex: Read 10 secs of data at 1 min mark)
data = f.readChannelData(offset=60, length=10, useSecForOffset=True, useSecForLength=True)
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 Distribution
binfilepy-0.1.0.tar.gz
(5.6 kB
view hashes)
Built Distribution
Close
Hashes for binfilepy-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28d681a8c1f1a2b742bbff4a3503d754b9d0758e377f2960b1982445ddd87379 |
|
MD5 | d62dc8e179c8a384d0559071635d0804 |
|
BLAKE2b-256 | 7032572090cba689184d3175e4118150477667db69c4fe8135e69954ad78bd5c |