Skip to main content

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

Metadata

Release files for physio-cassette 0.2.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for physio-cassette 0.2.16
File Size Uploaded Provenance Actions
physio_cassette-0.2.16.tar.gz 30.2 kB Without provenance Details for physio_cassette-0.2.16.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for physio-cassette 0.2.16
File Interpreter ABI Platform Actions
physio_cassette-0.2.16-py3-none-any.whl Python 3 none any Details for physio_cassette-0.2.16-py3-none-any.whl

Total release size: 55.3 kB

Release files / physio_cassette-0.2.16.tar.gz

Download URL physio_cassette-0.2.16.tar.gz
Size 30.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d133c5e6a71ef5d01a719276f141219c8eb69836ddb4fa43f71011795586f228
BLAKE2b-256 checksum
How to use checksums
9e3211c55a7dcf4389fdbfbf82ab0fe3ea2536feb958ef82eebcc6275f9032d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Release files / physio_cassette-0.2.16-py3-none-any.whl

Download URL physio_cassette-0.2.16-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6aab2d5f3568b5cca0e2077934a9d20ff3b6742532da2d491ceb09d6933c0c0
BLAKE2b-256 checksum
How to use checksums
301ace6c36fe9cee13338bdb78c28b08b377ecd1f0db00c4290dcf5e0b7ce663
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Security for physio-cassette 0.2.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page