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

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 Inputs

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

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

Contributing

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:

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.2.13.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

physio_cassette-0.2.13-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file physio_cassette-0.2.13.tar.gz.

File metadata

  • Download URL: physio_cassette-0.2.13.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for physio_cassette-0.2.13.tar.gz
Algorithm Hash digest
SHA256 c67f730670bec17c7b9d0f0cfd76c2bb259c74da91d9ab764b300cc1c8a4ad25
MD5 d68a18961fdb70bb03279b1b9fef7f26
BLAKE2b-256 e371057efe99930778d94dbef3b7baaa1a7f09330a24fce9f26d8b1f99e729fb

See more details on using hashes here.

File details

Details for the file physio_cassette-0.2.13-py3-none-any.whl.

File metadata

File hashes

Hashes for physio_cassette-0.2.13-py3-none-any.whl
Algorithm Hash digest
SHA256 b084e222e729d685ccfe672a73e99c75fef7265d3db819884b562649a1b6fd95
MD5 7af8141b2e8af7c3757da987b177dc05
BLAKE2b-256 b4cdafd47492c169602f90a9248048be19d8d1ae6860c24f99ab46b731c1e80c

See more details on using hashes here.

Supported by

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