A simple package for rat vision rendering simulation.
Project description
ratvision
A Python library for simulating rat vision through 3D rendering.
ratvision provides a simple interface to render what a rat would see based on its position and head direction in a 3D environment. It uses Blender for the 3D rendering process, making it possible to create realistic simulations of a rat's visual perspective.
Installation
pip install ratvision
Or by cloning this repository:
git clone git@github.com:marcoabrate/ratvision.git
cd ratvision
pip install .
Usage
renderer = Renderer(blender_exec='/path/to/blender') # blender.exe for Win
# positions is List[Tuple[float, float]]
# head_directions is List[float]
renderer.render(positions, head_directions)
See examples/render_demo.py for a thorough example. After cloning this repository or downloading the examples folder, you can run the demo with:
python examples/render_demo.py --blender_exec "/path/to/Blender"
Rendered frames and an animation animation.mp4 will be saved to a new output directory.
Requirements
- Python 3.7+
- Blender (external dependency, not included in the package)
The code was tested with Blender 3.6 on Linux and MacOS machines.
Features
- Generate rat-eye-view video animations from movement trajectories
- Easy to use Python API
- Compatible with custom 3D environments
- Built-in visualization function
Configuration Options
The renderer can be configured with the following parameters:
| Parameter | Description | Default |
|---|---|---|
env_file |
Path to Blender environment file | Built-in box |
output_dir |
Directory where rendered frames are saved | ./output |
frame_dim |
Dimensions of the rendered frames (width, height) | (120, 64) |
camera_name |
Name of the camera in the Blender scene | Camera_main |
camera_height |
Height of the camera from the ground in meters | 0.035 |
camera_vertical_angle |
Vertical inclination of the camera in radians | pi/2 |
You can view the configuration description by calling:
Renderer.config_description()
Customizable 3D environment
While ratvision comes with a default 3D environment, you can use your own Blender files:
renderer.update_config({'env_file': '/path/to/environment.blend'})
Note: All rendering and camera settings defined in the Blender environment will be preserved when rendering with ratvision. Only the parameters that can be set through the config will be overwritten. Be sure to change them to your preference before running ratvision. For biologically-plausible rendering and camera settings, you can check the provided environment environments/box_messy.blend.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Marco P. Abrate marcopietro.abrate@gmail.com
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 ratvision-0.1.1.tar.gz.
File metadata
- Download URL: ratvision-0.1.1.tar.gz
- Upload date:
- Size: 15.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d0487bf49dbbade4d962747bf59bd3f1041753919edbed95090ed10951ab2e7
|
|
| MD5 |
14b945f411cb6000f411f8c8b6d8a01c
|
|
| BLAKE2b-256 |
1ebb71cd880f1759fb8adc704e23513fb0f4dfab598614d41acf34dd61e45e5e
|
Provenance
The following attestation bundles were made for ratvision-0.1.1.tar.gz:
Publisher:
publish.yml on marcoabrate/ratvision
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratvision-0.1.1.tar.gz -
Subject digest:
1d0487bf49dbbade4d962747bf59bd3f1041753919edbed95090ed10951ab2e7 - Sigstore transparency entry: 259350553
- Sigstore integration time:
-
Permalink:
marcoabrate/ratvision@af9a169345d9e39bd7d868d95e1109141638dce9 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/marcoabrate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@af9a169345d9e39bd7d868d95e1109141638dce9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ratvision-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ratvision-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d65cbf8da13cf3dfd70be62983f802a4ce3c0d28884a7a8f1e1b90542dbcdec
|
|
| MD5 |
e43abc97b3c7ccdead6286c8183be164
|
|
| BLAKE2b-256 |
63c1f1ef3feea236183f6d8449f1c0fb4086faa35bf690c4702d0c4e5e09e7cd
|
Provenance
The following attestation bundles were made for ratvision-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on marcoabrate/ratvision
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratvision-0.1.1-py3-none-any.whl -
Subject digest:
8d65cbf8da13cf3dfd70be62983f802a4ce3c0d28884a7a8f1e1b90542dbcdec - Sigstore transparency entry: 259350559
- Sigstore integration time:
-
Permalink:
marcoabrate/ratvision@af9a169345d9e39bd7d868d95e1109141638dce9 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/marcoabrate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@af9a169345d9e39bd7d868d95e1109141638dce9 -
Trigger Event:
release
-
Statement type: