# 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](https://github.com/datascopeanalytics/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:
```python
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:
```bash
$ pip install physio_cassette
```
## Dependencies
- Numpy
- Scipy (Matlab IO)
- [traces](https://github.com/datascopeanalytics/traces)
- [openpyxl-dictreader](https://pypi.org/project/openpyxl-dictreader/) (excel files IO)
- [xlrd](https://pypi.org/project/xlrd/) (old excel format)
- [pyedflib](https://github.com/holgern/pyedflib)
- [pymatreader](https://pypi.org/project/pymatreader/)
- [dateutil](https://pypi.org/project/python-dateutil/)
- [wfdb](https://pypi.org/project/wfdb/)
- [xmltodict](https://pypi.org/project/xmltodict/)
#### 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][buymeacoffee-shield]][buymeacoffee]
[buymeacoffee]: https://www.buymeacoffee.com/u2Vb3kO
[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
Raw data
{
"_id": null,
"home_page": null,
"name": "physio-cassette",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "data storage, physiological signals, event records",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/61/46/9ebe3bbdb6921fa34a121273b0eccd0595c4bb16c09ad4c13ddcb8bf3b1e/physio_cassette-0.2.5.tar.gz",
"platform": null,
"description": "# Physio Cassette: Storage structures for signals, metadata and event annotations\r\nManaging signals in physiology and associated metadata can be a pain.\r\n\r\nYou want abstraction, but not much from any underlying Numpy array holding them.\r\n\r\nYou want annotations in signals, but not obscure proprietary representations.\r\n\r\nPhysio Cassette is just that: Numpy arrays and dictionaries with flair. Physio Cassette provides also automatic caching operations using pickle and matlab storage\r\n\r\n\r\n### Basic data structures\r\n- Signal: a numpy array with associated sampling frequency, timestamps and minor metadata. Zero-cost abstraction, the data can be accessed directly\r\n- EventRecord: a class for time annotated events based on [traces](https://github.com/datascopeanalytics/traces) TimeSeries with support for binary, trains, and multilevel events\r\n\r\nSignals can be iterated using EventRecord events as anchor points and viceversa Events can be converted to a sampled Signal\r\n\r\n### Containers\r\n- DataHolder: your box of cables based on Python dictionary. Parent class of SignalFrame and EventFrame.\r\n- SignalFrame: A container for Signal data structures.\r\n- EventFrame: A container for EventRecord structures, with support to merge operations (e.g. events annotated across multiple channels).\r\n\r\n### Supported Inputs\r\nPhysio-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.\r\n\r\nXML format is currently based on NSRR interpretation of data annotations.\r\n\r\nSome functionalities will be added in the future. Other format specific features (e.g. physical/digital ranges in EDF and WFDB) are absent on purpose.\r\n\r\n| Structure | Numpy arrays | CSV/columnar files | Matlab files | EDF files | Physionet WFDB | XML |\r\n|-------------|--------------------|--------------------|------------------------------------|--------------------|--------------------|--------------------|\r\n| Signal | YES | | YES | (use SignalFrame) | (use SignalFrame) | |\r\n| SignalFrame | YES | | YES (1 file/signal) | YES | YES | |\r\n| EventRecord | YES | YES | | | YES | YES |\r\n| EventFrame | (use EventRecords) | YES | | | YES | YES |\r\n\r\n### Caching\r\nTo cache an operation simply do:\r\n```python\r\nfrom physio_cassette import autocache\r\n\r\ndef your_function(x:int) -> bool:\r\n # Some long operation you want to cache\r\n return True\r\n\r\nresult = autocache(your_function, '~/path_to_cache_folder', 'desired_cache_file')(1)\r\n```\r\n\r\n## Installation\r\nTo install PhysioCassette run:\r\n```bash\r\n$ pip install physio_cassette\r\n```\r\n\r\n## Dependencies\r\n- Numpy\r\n- Scipy (Matlab IO)\r\n- [traces](https://github.com/datascopeanalytics/traces)\r\n- [openpyxl-dictreader](https://pypi.org/project/openpyxl-dictreader/) (excel files IO)\r\n- [xlrd](https://pypi.org/project/xlrd/) (old excel format)\r\n- [pyedflib](https://github.com/holgern/pyedflib)\r\n- [pymatreader](https://pypi.org/project/pymatreader/)\r\n- [dateutil](https://pypi.org/project/python-dateutil/)\r\n- [wfdb](https://pypi.org/project/wfdb/)\r\n- [xmltodict](https://pypi.org/project/xmltodict/)\r\n\r\n\r\n#### Contributing\r\nLooking for people more experienced in writing unit tests and overall beta-testers to help with the reliability of the library\r\n\r\nIf you feel generous and this library helped your project:\r\n\r\n[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee]\r\n\r\n[buymeacoffee]: https://www.buymeacoffee.com/u2Vb3kO\r\n[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Storage structures for signals (mostly physiological data), metadata and event annotations",
"version": "0.2.5",
"project_urls": {
"Bug Tracker": "https://github.com/LucaCerina/physio-cassette/issues",
"homepage": "https://github.com/LucaCerina/physio-cassette"
},
"split_keywords": [
"data storage",
" physiological signals",
" event records"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7ccdecb9dd264f0efa27cf0610bf932a8b46782eb4125ff042de406654a41157",
"md5": "92efe31001fcf48800366121e7e19608",
"sha256": "fb0625729e60d4e151531b1bfd6515bc13fd6a2c0460b4f92da214c66a2daa23"
},
"downloads": -1,
"filename": "physio_cassette-0.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "92efe31001fcf48800366121e7e19608",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 22637,
"upload_time": "2024-03-25T12:17:15",
"upload_time_iso_8601": "2024-03-25T12:17:15.361557Z",
"url": "https://files.pythonhosted.org/packages/7c/cd/ecb9dd264f0efa27cf0610bf932a8b46782eb4125ff042de406654a41157/physio_cassette-0.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "61469ebe3bbdb6921fa34a121273b0eccd0595c4bb16c09ad4c13ddcb8bf3b1e",
"md5": "1585d8c82c79c674b001cde71e0b3a72",
"sha256": "070dc92e61ef3649645990a5f81438457a30415ef335c812daa265f71e26522a"
},
"downloads": -1,
"filename": "physio_cassette-0.2.5.tar.gz",
"has_sig": false,
"md5_digest": "1585d8c82c79c674b001cde71e0b3a72",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 26691,
"upload_time": "2024-03-25T12:17:18",
"upload_time_iso_8601": "2024-03-25T12:17:18.763531Z",
"url": "https://files.pythonhosted.org/packages/61/46/9ebe3bbdb6921fa34a121273b0eccd0595c4bb16c09ad4c13ddcb8bf3b1e/physio_cassette-0.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-25 12:17:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LucaCerina",
"github_project": "physio-cassette",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "physio-cassette"
}