# 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/ed/08/96e8c5fed2f0a4227438d9d635d9fe97a01176112e4a78cca359aeea100d/physio_cassette-0.2.8.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.8",
"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": "488569944544a3037d5e74c4c470123b69b6a3e6487fcf80de98015d273dda22",
"md5": "47278020fcae1379374dac76141e915c",
"sha256": "30f67ff0adcba7b2ba8a6d7f3253cfcecc1315abf92cb8055b6dee1aa8b0004c"
},
"downloads": -1,
"filename": "physio_cassette-0.2.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "47278020fcae1379374dac76141e915c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 22911,
"upload_time": "2025-01-21T13:42:48",
"upload_time_iso_8601": "2025-01-21T13:42:48.227447Z",
"url": "https://files.pythonhosted.org/packages/48/85/69944544a3037d5e74c4c470123b69b6a3e6487fcf80de98015d273dda22/physio_cassette-0.2.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ed0896e8c5fed2f0a4227438d9d635d9fe97a01176112e4a78cca359aeea100d",
"md5": "9766c161ed66c7d10068e93e50d480bf",
"sha256": "a0bcf88b7537d9a28873c644709b88dbabd508ed7c77125caddd8b5e34e400f6"
},
"downloads": -1,
"filename": "physio_cassette-0.2.8.tar.gz",
"has_sig": false,
"md5_digest": "9766c161ed66c7d10068e93e50d480bf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 27728,
"upload_time": "2025-01-21T13:42:53",
"upload_time_iso_8601": "2025-01-21T13:42:53.049321Z",
"url": "https://files.pythonhosted.org/packages/ed/08/96e8c5fed2f0a4227438d9d635d9fe97a01176112e4a78cca359aeea100d/physio_cassette-0.2.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-21 13:42:53",
"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"
}