anatomy
Base anatomical definitions for the default fly model.
This module contains model-agnostic and default-model anatomy definitions.
FlyBody-specific anatomy is defined in
flygym.flybody.anatomy_flybody.
ActuatedDOFPreset
¶
Bases: BaseActuatedDOFPreset
Presets for which joint DoFs present in a skeleton should be actuated.
Source code in src/flygym/anatomy.py
AnatomicalJoint
dataclass
¶
Represents an anatomical joint connecting two body segments.
Source code in src/flygym/anatomy.py
AxesSet
¶
Bases: set[RotationAxis]
Set of rotation axes with automatic RotationAxis conversion. Useful for specifying which rotational DoFs are present at an anatomical joint.
Source code in src/flygym/anatomy.py
AxisOrder
¶
Bases: BaseAxisOrder, Enum
An enum specifying the order by which one-axis DoFs are chained together at anatomical joints with multiple DoFs.
This is important because 3D rotations do not commute under Euler angle representations. Keep this consistent with your data (e.g., axis order used for inverse kinematics on experimental recordings).
Special case: sometimes we might not care about the within-joint DoF order (e.g.
when iterate over the skeleton to configure body segments but not joints). In this
case, we can use DONTCARE (which aliases to PITCH_ROLL_YAW) to make our
intention explicit.
Source code in src/flygym/anatomy.py
BaseActuatedDOFPreset
¶
Bases: Enum
Base class for presets that select which joint DoFs should be actuated.
Source code in src/flygym/anatomy.py
filter(jointdofs)
¶
Filter given joint DoFs according to the preset.
Source code in src/flygym/anatomy.py
BaseAxisOrder
¶
Base class for axis-order enums parametrized by an axis enum type.
Source code in src/flygym/anatomy.py
BaseContactBodiesPreset
¶
Bases: Enum
Base class for body-segment contact presets.
Source code in src/flygym/anatomy.py
to_body_segments_list()
¶
Return the list of BodySegment objects defined by this preset.
Source code in src/flygym/anatomy.py
BaseJointPreset
¶
Bases: Enum
Base class containing all joint preset logic.
Source code in src/flygym/anatomy.py
BaseRotationAxis
¶
Bases: Enum
Base enum for axis naming and coordinate conversion.
Child enums must define PITCH / ROLL / YAW members and implement
_vector_by_axis.
Source code in src/flygym/anatomy.py
BodySegment
dataclass
¶
Represents a body segment in the fly anatomy.
See flygym.anatomy.ALL_SEGMENT_NAMES for all possible names.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Unique identifier for the body segment following the pattern |
pos |
str
|
Body location (e.g., |
link |
str
|
Name of the segment in the kinematic chain (e.g., |
Source code in src/flygym/anatomy.py
ContactBodiesPreset
¶
Bases: BaseContactBodiesPreset
Presets for which body segments should be able to collide with the ground.
Source code in src/flygym/anatomy.py
JointDOF
dataclass
¶
A single rotational degree of freedom in an anatomical joint.
Source code in src/flygym/anatomy.py
name
property
¶
Unique name following the pattern {parent}-{child}-{axis}.
from_name(name)
classmethod
¶
Create a JointDOF instance by parsing a name string.
Source code in src/flygym/anatomy.py
JointPreset
¶
Bases: BaseJointPreset
Presets for which rotational DoFs are present at which anatomical joints.
Source code in src/flygym/anatomy.py
RotationAxis
¶
Bases: BaseRotationAxis
Default flygym axis convention.
pitch -> y, roll -> z, yaw -> x.
Source code in src/flygym/anatomy.py
Skeleton
¶
Fly skeleton defining joint structure and degrees of freedom.
Source code in src/flygym/anatomy.py
get_actuated_dofs_from_preset(preset)
¶
Given a preset of actuated DoFs, return an explicit list of JointDOF.
Source code in src/flygym/anatomy.py
get_tree()
¶
Construct a tree data structure representing the skeleton.
Source code in src/flygym/anatomy.py
iter_jointdofs(root='c_thorax')
¶
Iterate through joint DOFs in depth-first order starting from the root.