Simulate zebrafish swim from tail angle tracking data
Project description
Zebrafish Tail Animator
Python toolbox to transform zebrafish tracking data to tail animations
Description
zf_animator
is a Python package used to create visualisation of how swimming data looks from high-speed tracking data.
The typical data used should be the tail angle along segments of the tail.
The package will convert these tail angles to x- y- coordinates, and interpolate many more points along the range of tracked tail segments.
These sets of coordinates will then transform slices of the zebrafish image, producing a stack of .png files that can be rendered into an mp4 file.
Package installation
This package can be installed via pip
pip install fish-simulator
Alternatively, you can download and locally install the package.
cd path/to/save/package
git clone clone-latest-tag git@github.com:ThomasMullen/fish_simulator.git
cd ./fish_simulator
python3 setup.py bdist_wheel sdist
pip install ./dist/fish_simulator-<latest_tag>.tar.gz
Requires ffmpeg
Installation instructions
To convert the .png
files to an .mp4
animation requires ffmpeg
to be installed on the running computer.
This can be install in Ubuntu in the terminal:
sudo apt install ffmpeg
Or with OS X can be installed:
brew install ffmpeg
Check it is installed by running which ffmpeg
in the terminal. More details can be found here.
Dependencies
Default Fish image
Example
Default image simulation
This will use warp the default repo .png
and stack the generated images into an .mp4
.
from fish_simulator.simulator import make_image_simulation, make_video
make_image_simulation(data=tail_angle_data, upsample=4, f_path="dir/to/save/png_files")
make_video(png_dir="dir/to/save/png_files", vid_fname="file/path/of/generated_vid.mp4")
Generate a simulation of the fish tail posture
from fish_simulator.simulator import make_posture_simulation, make_video
make_posture_simulation(data=tail_angle_data, n_segments=30, png_dir="dir/to/save/png_files")
make_video(png_dir="dir/to/save/png_files", vid_fname="file/path/of/generated_vid.mp4")
Key Functions
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
Hashes for fish_simulator-0.0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20c71887f61ec830e21f640e8414f2cb05c99f476a99321ee94060abedab264b |
|
MD5 | 9239d5a5a2abe2848fcabc1b23e2d770 |
|
BLAKE2b-256 | c3291d53751a19438fca01e08222d668c22672f585a5b90e656ed6c401a438d6 |