# 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/25/12/68787292454e8cc8e3dccec6e282108f6ee3399f468a3d05ff1545e664f7/physio_cassette-0.2.7.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.7",
"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": "a228d7d2a23410a46edb8d21f738a77f0098780c85544d9f51088aa75e84d053",
"md5": "81cf047738e71d57a4ec583ad8afc7af",
"sha256": "b39ab17faec7d69c824d494ccf9d78ef7ab5dbbfdf3d22791740c9fae76ee3b5"
},
"downloads": -1,
"filename": "physio_cassette-0.2.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "81cf047738e71d57a4ec583ad8afc7af",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 22699,
"upload_time": "2024-09-05T08:47:13",
"upload_time_iso_8601": "2024-09-05T08:47:13.911604Z",
"url": "https://files.pythonhosted.org/packages/a2/28/d7d2a23410a46edb8d21f738a77f0098780c85544d9f51088aa75e84d053/physio_cassette-0.2.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "251268787292454e8cc8e3dccec6e282108f6ee3399f468a3d05ff1545e664f7",
"md5": "03e8417545ccb7012f48f163e5aaf6c1",
"sha256": "3b9da7ffff994a0340bb3418938b0350c64d18fc2ac271b6a6f4bb69d1c922cc"
},
"downloads": -1,
"filename": "physio_cassette-0.2.7.tar.gz",
"has_sig": false,
"md5_digest": "03e8417545ccb7012f48f163e5aaf6c1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 27255,
"upload_time": "2024-09-05T08:47:16",
"upload_time_iso_8601": "2024-09-05T08:47:16.994237Z",
"url": "https://files.pythonhosted.org/packages/25/12/68787292454e8cc8e3dccec6e282108f6ee3399f468a3d05ff1545e664f7/physio_cassette-0.2.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-05 08:47:16",
"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"
}