Managing signals in physiology and associated metadata can be a pain.
You want abstraction, but not much from any underlying Numpy array holding them.
You want annotations in signals, but not obscure proprietary representations.
Physio Cassette is just that: Numpy arrays and dictionaries with flair. Physio Cassette provides also automatic caching operations using pickle and matlab storage
- Signal: a numpy array with associated sampling frequency, timestamps and minor metadata. Zero-cost abstraction, the data can be accessed directly
- EventRecord: a class for time annotated events based on traces TimeSeries with support for binary, trains, and multilevel events
Signals can be iterated using EventRecord events as anchor points and viceversa Events can be converted to a sampled Signal
- DataHolder: your box of cables based on Python dictionary. Parent class of SignalFrame and EventFrame.
- SignalFrame: A container for Signal data structures.
- EventFrame: A container for EventRecord structures, with support to merge operations (e.g. events annotated across multiple channels).
Physio-cassette aims to support seamlessly different file and data formats. All parsers can be customized without additional code to support more exotic / less interoperable data representations.
XML format is currently based on NSRR interpretation of data annotations.
Some functionalities will be added in the future. Other format specific features (e.g. physical/digital ranges in EDF and WFDB) are absent on purpose.
Structure | Numpy arrays | CSV/columnar files | Matlab files | EDF files | Physionet WFDB | XML |
---|---|---|---|---|---|---|
Signal | YES | YES | (use SignalFrame) | (use SignalFrame) | ||
SignalFrame | YES | YES (1 file/signal) | YES | YES | ||
EventRecord | YES | YES | YES | YES | ||
EventFrame | (use EventRecords) | YES | YES | YES |
To cache an operation simply do:
from physio_cassette import autocache
def your_function(x:int) -> bool:
# Some long operation you want to cache
return True
result = autocache(your_function, '~/path_to_cache_folder', 'desired_cache_file')(1)
To install PhysioCassette run:
$ pip install physio_cassette
- Numpy
- Scipy (Matlab IO)
- traces
- openpyxl-dictreader (excel files IO)
- xlrd (old excel format)
- pyedflib
- pymatreader
- dateutil
- wfdb
- xmltodict
Looking for people more experienced in writing unit tests and overall beta-testers to help with the reliability of the library
If you feel generous and this library helped your project: