fish-simulator
Python toolbox to transform zebrafish tracking data to tail animations
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.2%) to scientific vocabulary
Repository
Python toolbox to transform zebrafish tracking data to tail animations
Basic Info
- Host: GitHub
- Owner: ThomasMullen
- License: mit
- Language: Python
- Default Branch: main
- Size: 1.91 MB
Statistics
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 5
Metadata Files
README.md
Fish Tail Simulator
A Python toolbox for transforming fish tail tracking data into tail animations.
Description
fish_simulator is a Python package used to visualize swimming data from high-speed tracking.
The typical data used is the tail angle along segments of the tail.
The package converts these tail angles to x-y coordinates and interpolates additional points along the range of tracked tail segments.
These sets of coordinates then transform slices of the fish image, producing a stack of .png files that can be rendered into an mp4 file.
Animations of fish postures are created using a piecewise affine transformation with the interpolated x-y coordinates.
Package installation
This package can be installed via PyPi:
bash
pip install fish-simulator
Alternatively, you can download and locally install the package:
```bash cd path/to/save/package git clone git@github.com:ThomasMullen/fishsimulator.git cd ./fishsimulator python -m build
go to working project
cd path/to/work/project
acivate venv
source myvirtualenv/bin/activate pip install -e path/to/save/package ```
Requires ffmpeg
Installation instructions
To convert the .png files to an .mp4 animation requires ffmpeg to be installed on the running computer.
On Ubuntu, install ffmpeg via terminal:
bash
sudo apt install ffmpeg
On macOS, install ffmpeg with Homebrew:
bash
brew install ffmpeg
NOTE: Check if
ffmpegis installed by runningwhich ffmpegin the terminal. More details can be found here.NOTE: Package can run without
ffmpeg, but you will not be able to make videos from.pngfiles. To avoid dependency issues, set thevid_fnameargument toNone.
Fish animation template
Fish image template
Fish template is an image of the larval zebrafish.
Examples
Simple illustrative plot of posture
This displays a virtual structure of the fish posture. There are several plots you can perform, with the option of converting to a video.
These functions are plot_bout_elapse, plot_skeletal_postures, and plot_skeletal_postures_with_trace. There are passed through the run function. Here is an example.
```python import numpy as np from fishsimulator.simulator import run, plotskeletalpostureswith_trace
dataarr = np.load("fishsimulator/test/fixtures/swim01.npy") run( dataarr, plotfunc=plotskeletalpostureswithtrace, pngdir="path/to/dir/plts", vidfp="path/to/video/anim.mp4", line_wid=1 fps=700, ) ```
https://github.com/ThomasMullen/fish_simulator/assets/38111949/4df1ebc9-e5da-44bd-8c51-1f556040c67e
Larval zebrafish simulation plot
There are two plotting functions using the real larvae: plot_tail_image and plot_tail_image_with_trace.
```python import numpy as np from fishsimulator.simulator import ( run, plottailimagewithtrace, plottail_image, )
run( dataarr, # plotfunc=plottailimage, plotfunc=plottailimagewithtrace, pngdir="path/to/dir/plts", vid_fp="path/to/video/anim.mp4", fps=700, ) ```
Generate a video from collections of .png files
```python from fishsimulator.utils import makevideo
makevideo( pngdir="path/to/png/files/", vidfname="path/to/video/anim.mp4", framerate=70, keeppngs=True ) ```
https://github.com/ThomasMullen/fish_simulator/assets/38111949/854c1420-c777-4a83-951d-6f31bebe175c
Citation
latex
@software{Soares_Mullen_Fish_Behaviour_Simulator_2024,
author = {Soares Mullen, Thomas},
month = jun,
title = {{Fish Tail Simulator}},
version = {0.1.11},
year = {2024}
}
Acknowledgements
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement #813457.
Owner
- Name: Thomas Soares Mullen
- Login: ThomasMullen
- Kind: user
- Website: https://ThomasMullen.github.io
- Repositories: 4
- Profile: https://github.com/ThomasMullen
PhD Student at the Champalimaud Center for the Unknown
Citation (CITATION.cff)
cff-version: 0.1.4
message: "If you use this software, please cite it as below."
authors:
- family-names: Soares Mullen
given-names: Thomas
orcid: 0000-0002-3695-4477
title: "Fish Behaviour Simulator"
version: 0.1.11
identifiers:
- type: doi
value: 10.5281/zenodo.11406459
date-released: 2024-06-01
GitHub Events
Total
- Watch event: 1
- Push event: 2
Last Year
- Watch event: 1
- Push event: 2
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 10 minutes
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- ThomasMullen (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- pypi 556 last-month
-
Total dependent packages: 0
(may contain duplicates) -
Total dependent repositories: 0
(may contain duplicates) - Total versions: 16
- Total maintainers: 1
pypi.org: fish-simulator
Simulate zebrafish swim from tail angle tracking data
- Homepage: https://github.com/ThomasMullen/fish_simulator
- Documentation: https://fish-simulator.readthedocs.io/
- License: MIT License Copyright (c) 2023 Thomas Soares Mullen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 0.1.11
published about 2 years ago
Rankings
Maintainers (1)
pypi.org: fish-simulator-test
Simulate zebrafish swim from tail angle tracking data
- Homepage: https://github.com/ThomasMullen/fish_simulator
- Documentation: https://fish-simulator-test.readthedocs.io/
- License: MIT
-
Latest release: 0.0.2
published almost 3 years ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/setup-python v3 composite
- actions/checkout v3 composite
- actions/setup-python v3 composite
- actions/checkout v3 composite
- actions/setup-python v3 composite
- pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
- Pillow *
- black *
- build *
- cmcrameri *
- h5py *
- matplotlib *
- numpy *
- scikit-image *
- scipy *
- tqdm *
- twine *
- wheel *