PIEPY : Psychophysical and Imaging Experiments Pypeline
by Sakir Kaan Cetindag
Code to parse, analyse and visualize psychophysical and imaging data.
Installation
You can create an environment and simply install using pip
uv venv --python 3.12
source .venv/bin/acvtivate # MacOS | Linux
# .venv/bin/activate # Windows
uv pip install piepy-neuro
or clone from github
uv add git+https://github.com/kaancet/piepy.git
Quickstart
IMPORTANT : A
config.jsonfile is used to point piepy to the behavioral data and other directories. You need to change the paths variable according to your directory structure for piepy to work!
- Stimpy .stimlog and .riglog is in : <path_to_dir>/presentation/your_experiment_name
- Analysed data is saved(and loaded from) : <path_to_dir>/analysis/your_experiment_name
sess = WheelDetectionSession("240810_KC150_detect__no_cam_KC")
data = sess.analyze(load_flag=False)
Code Architecture
The analysis pipeline is organised in a modular way where the parsing/analysing of behavioral data is seperate from statistical analysis and plotting.
The data architecture is also set-up in a way to make it easy to pass around between analysis and plotting. For this, there is the RunData class which holds the data in a polars DataFrame, which can be plugged into dedicated statitical analysis/plotting classes.
The behavioral data is divided into three main layers for data parsing and aggregation:
- Trial
- Run/Session
- Hub
1. Trial
Main parsing of the experiment data happens in the Trial class. Currently, piepy depends on experimental logs generated by generated by StimPy (.stimlog and .riglog), to calculate basic trial variables such as reaction time, trial outcome, lick counts etc. The main ingredient in this process is the state machine that is being used in the ExperimentController in StimPy.
How a trial is parsed depends on the user defined state transitions in StimPy and and a trial schema that is . There is a base
The parsed rawdata is aggregated in a dictioanry of dataframes and then seperated into trials by using the timings of various software and hardware signals into trials. These trials are then collected into a dataframe, where each row is a trial.
2. Run
The aggregated trials makes up the data of the Run. Each Run will have it's own DataFrame where each row is a trial. Run(s) make up a Session.
3. Session
Mostly for convenience, holds one or multiple Run(s) in it.
These are mostly dependent on the behavioural/imaging data that is being analysed so a custom Trial, Run, Session classes need to be implemented to parse the data according to specific needs.
Contribution guidelines
To implement a feature create a new branch (e.g feature_VR_wheel_analysis)
Who do I talk to?
Phase 1 — Canonical data contract + run concatenation
- Goal: One schema, one concat path; deliver multi-run concatenation.
- Changes:
- Promote
Trialinto an explicit base schema with reserved core columns (trial_no,t_trialstart,t_trialend,animalid,baredate,date,run_no,run_uid,session_uid,paradigm). Experiments extend it. - Single
align_and_concat(frames)incore/schemathat reconciles dtypes/missing columns once (supersedes the bespoke loops inhub.pyandmouse.py). Session.concatenate_runs(policy=...): stacks run trial-tables with arun_no/run_uidcolumn, cumulativetotal_trial_no, and an explicit time policy (per-run reset vs. monotonic session clock — important for later event alignment).
- Promote
- Deliverable:
session.concatenate_runs(); hub/mouse aggregation reuse the shared concat; golden tests extended to a concatenated multi-run session. - Effort: M–L · Risk: Med · Depends on: Phase 0
Metadata
Release files for piepy-neuro 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 |
|---|---|---|---|---|
| piepy_neuro-0.3.3.tar.gz | 213.8 kB | Without provenance | Details for piepy_neuro-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| piepy_neuro-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for piepy_neuro-0.3.3-py3-none-any.whl |
Total release size: 413.5 kB
Release files / piepy_neuro-0.3.3.tar.gz
| Download URL | piepy_neuro-0.3.3.tar.gz |
|---|---|
| Size | 213.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8292b961babee928984adea84976e1cec71d133d467ba2dc4d760fa2ea788a6
|
|
BLAKE2b-256 checksum How to use checksums |
3cabd846d446c8d955a5ec39f7427fc9302127873dd0dfb5b844a24e6fd6c155
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / piepy_neuro-0.3.3-py3-none-any.whl
| Download URL | piepy_neuro-0.3.3-py3-none-any.whl |
|---|---|
| Size | 199.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8ac5f8703d98bf368f868426f447e55bd0b04bc3334ee9a365057f9b7428940
|
|
BLAKE2b-256 checksum How to use checksums |
7590a621d522091f13e5cbdcc00c9e33e17689ebbf7f7f174452f634acd2cf94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for piepy-neuro 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.