Metadata-Version: 2.4
Name: flygym
Version: 2.0.2
Summary: NeuroMechFly, a framework for simulating embodied sensorimotor control in adult Drosophila.
Author-email: Sibo Wang-Chen <sibo.wang@epfl.ch>, Victor Alfred Stimpfling <victor.stimpfling@epfl.ch>, Thomas Ka Chung Lam <thomas.lam@epfl.ch>, Pembe Gizem Özdil <pembe.ozdil@epfl.ch>, Louise Genoud <louise.genoud@epfl.ch>, Femke Hurtak <femke.hurtak@epfl.ch>, Pavan Ramdya <pavan.ramdya@epfl.ch>
Maintainer-email: Sibo Wang-Chen <sibo.wang@epfl.ch>, Victor Alfred Stimpfling <victor.stimpfling@epfl.ch>, Dominic Dall'Osto <dominic.dallosto@epfl.ch>, Thomas Ka Chung Lam <thomas.lam@epfl.ch>
License-Expression: Apache-2.0
Project-URL: homepage, https://neuromechfly.org/
Project-URL: repository, https://github.com/NeLy-EPFL/flygym
Project-URL: documentation, https://neuromechfly.org/
Project-URL: Bug Tracker, https://github.com/NeLy-EPFL/flygym/issues
Requires-Python: <3.13,>=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mujoco<3.7,>=3.6
Requires-Dist: numpy<3.0,>=2.0
Requires-Dist: dm_control<1.0.39,>=1.0.38
Requires-Dist: pyyaml<7.0,>=6.0
Requires-Dist: mediapy<3.0,>=1.2
Requires-Dist: imageio<3.0,>=2.37
Requires-Dist: imageio-ffmpeg==0.6.0
Requires-Dist: jaxtyping==0.3.7
Requires-Dist: tabulate==0.9.0
Requires-Dist: loguru==0.7.3
Requires-Dist: pillow<13,>=11
Requires-Dist: matplotlib<4.0,>=3.10
Requires-Dist: numba>=0.65.1
Provides-Extra: warp
Requires-Dist: warp-lang<1.13,>=1.12; extra == "warp"
Requires-Dist: mujoco_warp<3.7,>=3.6; extra == "warp"
Provides-Extra: dev
Requires-Dist: pytest<10.0,>=9.0; extra == "dev"
Requires-Dist: pytest-cov<8.0,>=7.0; extra == "dev"
Requires-Dist: ruff==0.15.13; extra == "dev"
Requires-Dist: build<2.0,>=1.0; extra == "dev"
Requires-Dist: twine<7.0,>=6.0; extra == "dev"
Requires-Dist: mkdocs-material<10.0,>=9.7; extra == "dev"
Requires-Dist: mkdocstrings[python]<2,>=1.0.0; extra == "dev"
Requires-Dist: mkdocs-gen-files==0.6.0; extra == "dev"
Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev"
Requires-Dist: mkdocs-section-index==0.3.0; extra == "dev"
Requires-Dist: mkdocs-jupyter==0.26.1; extra == "dev"
Requires-Dist: trimesh<5.0,>=4.0; extra == "dev"
Requires-Dist: shapely<3.0,>=2.0; extra == "dev"
Requires-Dist: mapbox-earcut<3.0,>=2.0; extra == "dev"
Requires-Dist: fast-simplification==0.1.13; extra == "dev"
Requires-Dist: networkx<4.0,>=3.0; extra == "dev"
Requires-Dist: rtree<2.0,>=1.0; extra == "dev"
Requires-Dist: nbstripout==0.9.1; extra == "dev"
Requires-Dist: rasterio>=1.5.0; extra == "dev"
Provides-Extra: examples
Requires-Dist: ipykernel>=7.1.0; extra == "examples"
Requires-Dist: ipython<10.0,>=9.10; extra == "examples"
Requires-Dist: pandas<4.0,>=3.0; extra == "examples"
Dynamic: license-file

> [!IMPORTANT]
> We introduced a new FlyGym 2.x.x API in March 2026, with a complete code rewrite and redesigned interface. This version delivers significantly improved performance:
> 
> - **~10x speed-up** for CPU-based simulations (~2x real-time throughput)
> - **~300x speed-up** for GPU-based simulation via Warp/MJWarp (~60x real-time throughput)
>
> Additional improvements include:
>
> - Improved scene composition workflow
> - Interactive viewer
> - Simplified dependency stack
>
> This version is not backward compatible, and not all features from FlyGym 1.x.x are available. Feature requests can be submitted via Issues on the Github repository. See more information about the changes [here](https://neuromechfly.org/migration/).
>
> Prefer the old version? FlyGym 1.x.x has been migrated to [`flygym-gymnasium`](https://github.com/NeLy-EPFL/flygym-gymnasium). Its documentation has been migrated to [gymnasium.neuromechfly.org](https://gymnasium.neuromechfly.org/).

## Simulating embodied sensorimotor control with NeuroMechFly v2

![](https://github.com/NeLy-EPFL/_media/blob/main/flygym/banner_large.jpg?raw=true)

[**Documentation**](https://neuromechfly.org/) | [**Paper**](https://www.nature.com/articles/s41592-024-02497-y.epdf?sharing_token=jK2FbKWL99-O28WNqrpXWNRgN0jAjWel9jnR3ZoTv0MjiFZczOI3_5wYVxbEbClrTuJzjKyEfhm2kIwso489-ypEsSqlyasWAEsBCvR9WU5poT-q2bblI6hCc7Zji6wb_jZjfXl7KWLbd2pgZTmWvk_ADQ6RuzlnHwvQyipMJzg%3D) | [**Discussion Board**](https://github.com/NeLy-EPFL/flygym/discussions)

![overview_video](https://github.com/NeLy-EPFL/_media/blob/main/flygym/overview_video.gif?raw=true)

This repository contains the source code for FlyGym, the Python library for NeuroMechFly v2, a digital twin of the adult fruit fly *Drosophila* melanogaster that can see, smell, walk over challenging terrain, and interact with the environment (see our [NeuroMechFly v2 paper](https://www.nature.com/articles/s41592-024-02497-y.epdf?sharing_token=jK2FbKWL99-O28WNqrpXWNRgN0jAjWel9jnR3ZoTv0MjiFZczOI3_5wYVxbEbClrTuJzjKyEfhm2kIwso489-ypEsSqlyasWAEsBCvR9WU5poT-q2bblI6hCc7Zji6wb_jZjfXl7KWLbd2pgZTmWvk_ADQ6RuzlnHwvQyipMJzg%3D)).

NeuroMechFly consists of the following components:
- **Biomechanical model:** The biomechanical model is based on a micro-CT scan of a real adult female fly (see our original NeuroMechFly publication). We have adjusted several body segments (in particular in the antennae) to better reflect the biological reality.
- **Vision:** The fly has compound eyes consisting of individual units called ommatidia arranged on a hexagonal lattice. We have simulated the visual inputs on the fly’s retinas.
- **Olfaction:** The fly has odor receptors in the antennae and the maxillary palps. We have simulated the odor inputs experienced by the fly by computing the odor/chemical intensity at these locations.
- **Hierarchical control:** The fly’s Central Nervous System consists of the brain and the Ventral Nerve Cord (VNC), a hierarchy analogous to our brain-spinal cord organization. The user can build a two-part model — one handling brain-level sensory integration and decision making and one handling VNC-level motor control — with an interface between the two consisting of descending (brain-to-VNC) and ascending (VNC-to-brain) representations.
- **Leg adhesion:** Insects have evolved specialized adhesive structures at the tips of the legs that enable locomotion vertical walls and overhanging ceilings. We have simulated these structures in our model. The mechanism by which the fly lifts the legs during locomotion despite adhesive forces is not well understood; to abstract this, adhesion can be turned on/off during leg stance/swing.
- **Mechanosensory feedback:** The user has access to joint angles, actuator forces, contact forces, and user-defined anatomical joint-site positions.

This package is developed at the [Neuroengineering Laboratory](https://www.epfl.ch/labs/ramdya-lab/), EPFL.

### Getting Started

For installation, see [the documentation page](https://neuromechfly.org/installation).

To get started, follow [tutorials here](https://neuromechfly.org/tutorials).
