Automated behavioral analysis software and pipeline for neuroscience.
Project description
Behavioral Analysis Interface
Currently built to integrate with DeepLabCut
Other tools coming soon!
Table of Contents
About
Behavython is an automated behavioral analysis interface designed to work alongside DeepLabCut (DLC). It converts raw tracking data (CSV/H5) into structured behavioral metrics.
It supports:
- Geometry-based paradigms (Open Field, Elevated Plus Maze)
- Interaction-based paradigms (Social/Object recognition)
The goal is reproducible, high-throughput behavioral quantification.
Getting Started
Prerequisites
- Python 3.10.x
- NVIDIA GPU (strongly recommended)
Installation
Pip
pip install behavython --extra-index-url https://download.pytorch.org/whl/cu118
If you omit the PyTorch index, you may install an incompatible CPU-only build.
Windows (Automated)
Use the provided:
run_behavython.bat
GPU Setup (Critical)
⚠️ Required for correct execution
Behavython depends on GPU-accelerated frameworks. You must install CUDA + cuDNN after setting up your Python environment:
conda (or mamba) install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
Failure here leads to:
- Extremely slow processing
- Potential runtime errors
⚠️ This must be done after creating your Python environment, not globally. That is, inside of your
behavythonenvironment.
Workflow
Pipeline:
Video → DeepLabCut → CSV → Behavython → Metrics
Experiment Types
ROI-Based
social_recognitionsocial_discriminationobject_discrimination
Geometry-Based
open_fieldelevated_plus_maze
Arena Configuration (Geometry)
Requires .json with coordinates extracted from ImageJ.
Open Field
4 points (ordered):
- Top Left
- Top Right
- Bottom Right
- Bottom Left
Elevated Plus Maze
12 ordered points:
- Outer: TL, TR, BL, BR
- Arms: LT, LB, RT, RB
- Center: CTL, CTR, CBL, CBR
⚠️ Incorrect ordering corrupts all spatial metrics
ROI Experiments
Use ImageJ:
-
Oval Tool (hold Shift)
-
Analyze → Set Measurements:
- Centroid
- Bounding Rectangle
-
Press
Ctrl + M -
Save CSV
Naming:
- Single:
video_roi.csv - Dual:
video_roiL.csv,video_roiR.csv
DeepLabCut Processing
Use the DEEPLABCUT tab:
- Select
config.yaml - Select videos
- Click ANALYZE
Without GPU: expect severe slowdown
Running Analysis
In ANALYSIS tab:
- Set arena size (cm)
- Set FPS
Options:
- Trim: skips initial seconds
- Crop: limits total duration
Steps:
- Select input files (CSV, ROI, videos)
- Select output folder
- (If needed) select
.json
Outputs
General
-
analysis_summary.xlsx / .csvScalar metrics per animal -
analysis_timeseries.parquetFrame-by-frame data
Geometry Experiments
Adds:
- Zone occupancy
- Transition counts
spatial_stateper frame
ROI Experiments
Adds:
- Investigation ratio
- Approach rate
- Retreat rate
File:
-
analysis_collisions.parquet- Distance to object
- Angles
- Interaction flags
Contributing
Contributions are welcome.
- Open an issue
- Submit a pull request
- Suggest improvements
License
GNU GPL v3.0
See LICENSE file.
Contact
- Matheus Costa — matheuscosta3004@gmail.com
- João Pedro Carvalho Moreira — mcjpedro@gmail.com
Acknowledgments
- Flávio Mourão — https://github.com/fgmourao
- Núcleo de Neurociências (NNC) — http://www.nnc.ufmg.br
Developed at
Núcleo de Neurociências (NNC) Universidade Federal de Minas Gerais (UFMG) Brazil
Project details
Release history Release notifications | RSS feed
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 behavython-0.8.1.tar.gz.
File metadata
- Download URL: behavython-0.8.1.tar.gz
- Upload date:
- Size: 645.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2c3140e187ae3baefe696eeacc5b457b7bf0690085142b2af515fb6511e66c1
|
|
| MD5 |
2f188929d66d18cfaa2314a00d53eec1
|
|
| BLAKE2b-256 |
02c239da7fdc540bf9e4497ee6c246fbfb97b96eff1bf770e4b4d17fb68634d1
|
File details
Details for the file behavython-0.8.1-py3-none-any.whl.
File metadata
- Download URL: behavython-0.8.1-py3-none-any.whl
- Upload date:
- Size: 650.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a6006f2a6f9fbc58e8f9ef529601fa406aacd237cb1878e1eed774d953b5956
|
|
| MD5 |
9f91d63081cdc2a09d33b7caf544b211
|
|
| BLAKE2b-256 |
04d4fea33c176e3d9d7d276498dbd2f130577942cd36f1c9f073d2509e0cc14b
|