Skip to main content

Storage structures for signals (mostly physiological data), metadata and event annotations

Project description

Physio Cassette: Storage structures for signals, metadata and event annotations

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 representations.

Physio Cassette is just that: Numpy arrays and dictionaries with flair. Physio Cassette provides also automatic caching operations using pickle and matlab storage

Basic data structures

  • 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

Containers

  • 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).

Supported IO

Physio-cassette aims to support seamlessly different file and data formats. 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 :heavy_check_mark: :heavy_check_mark: (use SignalFrame) (use SignalFrame)
SignalFrame :heavy_check_mark: :heavy_check_mark: (1 file/signal) :heavy_check_mark: :heavy_check_mark:
EventRecord :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
EventFrame (use EventRecords) :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:

Caching

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)

Installation

To install PhysioCassette run:

$ pip install physio_cassette

Dependencies

Contribution

If you feel generous and this library helped your project:

Buy me a coffee

Project details


Download files

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

Source Distribution

physio_cassette-0.1.14.tar.gz (20.9 kB view hashes)

Uploaded Source

Built Distribution

physio_cassette-0.1.14-py3-none-any.whl (19.4 kB view hashes)

Uploaded Python 3

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