FrozenPy
FrozenPy is a small collection of Python functions for detecting freezing behavior and averaging data based on a threshold and experimental parameters, with a particular focus on Pavlovian conditioning paradigms. Freezing is detected by thresholding motion data under a defined value (e.g., 10 a.u.) for a defined minimum length of time (1 sec). It also includes functions for converting .out files generated from MedPC to easier-to-handle .csv files.
FrozenPy is designed so that it is easy to add metadata (group, sex, etc.) and formats data for use with popular plotting (Seaborn) and statistical (Pingouin) packages within Python.
Usage
Installation
FrozenPy can easily be installed via pip. Type the following into your terminal to install FrozenPy.
pip install FrozenPy
Read .out files
Converting .out to .raw.csv, read .raw.csv:
# Base directory containing .out files
out_dir = '/path/to/your/.out/files'
# convert all .out files within dir to .raw.csv
fp.read_out(out_dir)
# read .raw.csv
data_raw = fp.read_rawcsv('your_data.raw.csv')
Detect freezing and average
Detect freezing:
# detect freezing
data_freezing = fp.detect_freezing(data_raw)
This is an example for if we wanted to slice and average data with a 3 min baseline, 10s CS, 2s US, 58s ISI, and 5 trials:
# slice data
frz_bl, frz_trials = fp.get_averagedslices(df=data_freezing,
BL=180,
CS=10,
US=2,
Trials=5,
ISI=58,
fs=5,
Behav='Freezing')
This would output two variables: frz_bl which contained the averaged BL data for each subject, and frz_trials which contained CS, US, and ISI data for each subject. These are separated because BL is factorial data whereas Trials are repeated measures.
Notes
This code was developed specifically for the Maren Lab which uses MedPC boxes that measure motion via loadcells, but it should work with any motion data so long as it is in the correct format. If you notice any problems or wish to contribute please don't hesitate to contact me at mictott@gmail.com, open a pull request, or submit an issue.
Future directions
- take advantage of xarrays (not in the near future)
- provide visible feedback to allow for threshold adjustments (not in the near future unless needed)
Metadata
Release files for FrozenPy 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| FrozenPy-0.3.3.tar.gz | 6.7 kB | Without provenance | Details for FrozenPy-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| FrozenPy-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for FrozenPy-0.3.3-py3-none-any.whl |
Total release size: 19.1 kB
Release files / FrozenPy-0.3.3.tar.gz
| Download URL | FrozenPy-0.3.3.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5414d8a4085bcb8b75597b23423ec0d19a8e5a4c6f87c163096d1cbe01c9893a
|
|
BLAKE2b-256 checksum How to use checksums |
4c36bb874c163e67bb2cdc373237115fb406673bdaa6c682905df50197850853
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.7
|
Release files / FrozenPy-0.3.3-py3-none-any.whl
| Download URL | FrozenPy-0.3.3-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23a631fee3dcd7fdb792eff52c7d64109aefb4ccfbef7632627b63c832f75fad
|
|
BLAKE2b-256 checksum How to use checksums |
4d23cd49393c14086f62e9b87ad5901749055ab769e4d441ae6d4fb8621722ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.7
|
Security for FrozenPy 0.3.3
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.