Python Calcium Recording Analysis and Interpretation Toolbox
Project description
pyKrait
End-to-end pipeline for segmenting cells, detecting calcium peaks,
and quantifying oscillation periodicity and spatial synchronicity
from time-lapse microscopy.
Overview
pyKrait (python Calcium recording analysis and interpretation toolbox) automatically processes calcium-imaging videos (.czi, .tif, .tiff) and computes calcium activity, peak statistics, periodicity scores, and neighbour-aware synchronicity z-scores.
Installation
It is recommended to install pyKrait in a virtual environment using either venv or uv. The graphical user interface is optional, install it with pip install "pykrait[gui]".
Standard venv
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install --upgrade pip
pip install pykrait
Using uv
uv venv --python 3.11
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install pykrait
Quickstart
Launch the GUI
From inside the activated virtual environment:
python -m pykrait
The GUI walks you through video selection, segmentation, peak detection, periodicity, and synchronicity, and lets you save results to disk.
Batch process an entire folder
from pykrait.pipeline.pipeline import BatchExperiment, AnalysisParameters
from pykrait.io.files import concat_analysis_files
experiment = BatchExperiment(
folder="/path/to/videos",
params=AnalysisParameters(),
extension=".czi",
)
experiment.run()
concat_analysis_files("/path/to/videos", filetype="output")
This produces one Analysis_<video>/ directory per video and an analysis_output_overview.csv at the root of the folder.
Examples
| Scenario | Notebook |
|---|---|
| Run a folder with custom parameters | notebooks/example_batch_with_custom_parameters.ipynb |
| Re-run a folder reusing saved parameters and cached masks | notebooks/example_batch_reusing_parameters.ipynb |
| Inspect or refine a single video interactively | Launch the GUI: python -m pykrait |
How it works
For each video, pyKrait runs the following stages:
- Load — lazy
Daskarray viabioio(.czi,.tif,.tiff). - Project — STD or SUM projection across time, with optional CLAHE.
- Segment — Cellpose (
cpsamby default, or a custom model path). - Extract — per-cell mean intensity per frame, computed lazily on Dask.
- Detrend — Blackman-windowed sinc filter (cf. pyBOAT).
- Detect peaks —
scipy.signal.find_peakswith width / height / prominence thresholds. - Periodicity — STD and CoV of inter-peak intervals, scored against a shuffled-peaks null.
- Adjacency — neighbour graph from segmented masks (kernel-based proximity).
- Synchronicity — co-firing peaks within a time window and topological distance, z-scored against label-shuffled controls.
Documentation
Full API reference and tutorials: https://pykrait.readthedocs.io/en/latest/.
Acknowledgements
pyKrait builds on and heavily uses prior open-source work:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pykrait-0.3.3.tar.gz.
File metadata
- Download URL: pykrait-0.3.3.tar.gz
- Upload date:
- Size: 116.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2305dfb3b36e21ca0bca8d3a459d1d76b32af1b18e66a188a04adc1ec3312d6e
|
|
| MD5 |
6a2495de8e2c89f6c4641d0c2a6a1e03
|
|
| BLAKE2b-256 |
f560cdd463de2ec71ab418176ad4d5dfdee801f4e61a42831ff12c36d4ef7b8c
|
File details
Details for the file pykrait-0.3.3-py3-none-any.whl.
File metadata
- Download URL: pykrait-0.3.3-py3-none-any.whl
- Upload date:
- Size: 121.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfd900e8a376dde55773407d0434c89ee314d5d15a5a1cc810bf3af5b7982460
|
|
| MD5 |
cee9453073ea3287ee4fdfebc5ba4dac
|
|
| BLAKE2b-256 |
0f9f406e66a15f7719fe2dfc0748c8d9739666b9b54a2fee328c4d6e16b2e7e9
|