Megabouts 🐟
Overview
Megabouts is a Python toolbox designed to quantify zebrafish larval locomotion. It supports in both freely swimming and head-restrained conditions, adapting to various experimental setups and recording framerate.
📚 Full documentation and tutorials available at: megabouts.ai
Features
-
Flexible Data Input:
- Multiple tracking methods (full tracking, head tracking, tail tracking)
- Support various frame rates (20-700 Hz) and resolutions
- Compatible with different tracking software (e.g., SLEAP)
-
Analysis Pipeline:
- Tail angle and trajectory preprocessing
- Tail bout detection
- Movement classification using transformer neural networks
- Sparse coding for head-restrained experiments
Installation
pip install megabouts
Quick Start
from megabouts.tracking_data import TrackingConfig, FullTrackingData, load_example_data
from megabouts.pipeline import FullTrackingPipeline
# Load example data
df_recording, fps, mm_per_unit = load_example_data("fulltracking_posture")
# Configure tracking
tracking_cfg = TrackingConfig(fps=fps, tracking="full_tracking")
# Create tracking data
head_x = df_recording["head_x"].values * mm_per_unit
head_y = df_recording["head_y"].values * mm_per_unit
head_yaw = df_recording["head_angle"].values
tail_angle = df_recording.filter(like="tail_angle").values
tracking_data = FullTrackingData.from_posture(
head_x=head_x,
head_y=head_y,
head_yaw=head_yaw,
tail_angle=tail_angle
)
# Create pipeline and run
pipeline = FullTrackingPipeline(tracking_cfg)
tracking, tail, traj, segments, bouts, ethogram = pipeline.run(tracking_data)
License
This software is available for non-commercial research and academic use only. The software was developed by Adrien Jouary, Ph.D. in the laboratory of Michael B. Orger at Fundação Champalimaud. For full license terms, please see the LICENSE.md file.
Citation
@article{jouary2024megabouts,
title={Megabouts: a flexible pipeline for zebrafish locomotion analysis},
author={Jouary, Adrien and Laborde, Alexandre and Silva, Pedro T and Mata, J Miguel
and Marques, Joao C and Collins, Elena and Peterson, Randall T
and Machens, Christian K and Orger, Michael B},
journal={bioRxiv},
pages={2024--09},
year={2024},
publisher={Cold Spring Harbor Laboratory}
}
Contact
- Author: Adrien Jouary
- Email: adrien.jouary at research.fchampalimaud.org
- Organization: Champalimaud Foundation
Acknowledgments
This work was developed at the Champalimaud Foundation in the laboratory of Michael B. Orger.
Metadata
Release files for megabouts 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| megabouts-0.1.2.tar.gz | 78.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| megabouts-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 157.0 MB
Release files / megabouts-0.1.2.tar.gz
| Download URL | megabouts-0.1.2.tar.gz |
|---|---|
| Size | 78.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f27e5b26b99b26d6772888bd0cd9e098785a633a6864dee8828ef4ae9ebaa5d2
|
|
BLAKE2b-256 checksum How to use checksums |
c107b519f3eb148ed782080d330db824bebb512c15b25ec2cb176dbe1753f16f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2025.
Transparency logRelease files / megabouts-0.1.2-py3-none-any.whl
| Download URL | megabouts-0.1.2-py3-none-any.whl |
|---|---|
| Size | 78.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90f3c14d08e024f2520111455a81e375400e2244c9c03e08283249b7914e0754
|
|
BLAKE2b-256 checksum How to use checksums |
edc67ac13caedd875c0e0da0042e45e340c96558a75e396943a840153b1dd1a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2025.
Transparency log