API for the animal_traits module#
The models.animal.animal_traits module contains classes that organizes
animal traits into enumerations for use by the Functional Group class in the
functional_group module.
Classes:
|
Enumeration for development status. |
|
Enumeration for development types. |
|
Enumeration for diet resource types. |
|
Enumeration for excretion type. |
|
Enumeration for metabolic types. |
|
Enumeration for external migration trait. |
|
Where and how reproduction happens: aquatic vs terrestrial. |
|
Enumeration for reproductive types. |
|
Enumeration for taxa types. |
|
Enumeration for vertical occupancy trait. |
- class virtual_ecosystem.models.animal.animal_traits.DevelopmentStatus(*values)[source]#
Enumeration for development status.
- class virtual_ecosystem.models.animal.animal_traits.DevelopmentType(*values)[source]#
Enumeration for development types.
- class virtual_ecosystem.models.animal.animal_traits.DietType(*values)[source]#
Enumeration for diet resource types.
TODO: refine categorizations
Methods:
Classify the detailed diet into a broad trophic category.
Count the number of distinct dietary categories in this flag set.
parse(diet_string)Parse a string of underscore-separated diet terms into a DietType flag.
- coarse_category() DietType[source]#
Classify the detailed diet into a broad trophic category.
This method examines the components of the current DietType flag and returns one of the three broad trophic categories: HERBIVORE, CARNIVORE, or OMNIVORE. These categories are defined as composite flags within the DietType enumeration.
- Returns OMNIVORE if the diet includes both plant/fungal and animal-derived
resources.
Returns CARNIVORE if the diet includes only animal-derived resources.
- Returns HERBIVORE for all other combinations, including plant-only or empty
diets.
- Returns:
A diet type flag representing the coarse category.
- Return type:
- count_dietary_categories() int[source]#
Count the number of distinct dietary categories in this flag set.
- Returns:
An integer of the number of different type types possessed by the functional group.
- classmethod parse(diet_string: str) DietType[source]#
Parse a string of underscore-separated diet terms into a DietType flag.
This method takes a lowercase string such as ‘fruit_foliage_fish’ and converts it into a combined DietType flag using bitwise OR logic. This allows diet traits to be specified flexibly in configuration files or CSV inputs.
- Parameters:
diet_string – A lowercase underscore-separated string representing one or more diet components (e.g., ‘foliage’, ‘fruit_fish’, ‘nectar_fungus’).
- Returns:
A DietType flag representing the combined diet traits.
- class virtual_ecosystem.models.animal.animal_traits.ExcretionType(*values)[source]#
Enumeration for excretion type.
- class virtual_ecosystem.models.animal.animal_traits.MetabolicType(*values)[source]#
Enumeration for metabolic types.
- class virtual_ecosystem.models.animal.animal_traits.MigrationType(*values)[source]#
Enumeration for external migration trait.
- class virtual_ecosystem.models.animal.animal_traits.ReproductiveEnvironment(*values)[source]#
Where and how reproduction happens: aquatic vs terrestrial.
- class virtual_ecosystem.models.animal.animal_traits.ReproductiveType(*values)[source]#
Enumeration for reproductive types.
- class virtual_ecosystem.models.animal.animal_traits.TaxaType(*values)[source]#
Enumeration for taxa types.
- class virtual_ecosystem.models.animal.animal_traits.VerticalOccupancy(*values)[source]#
Enumeration for vertical occupancy trait.
Methods:
parse(occupancy)Convert a string like 'soil_ground' into a VerticalOccupancy flag.
- classmethod parse(occupancy: str) VerticalOccupancy[source]#
Convert a string like ‘soil_ground’ into a VerticalOccupancy flag.
This method parses a lowercase underscore-separated string into a combined VerticalOccupancy flag using bitwise OR logic. It enables easy construction of multi-layer occupancy traits from a single string field, such as those found in CSV imports or config files.
- Parameters:
occupancy – A string representing one or more vertical layers, such as ‘soil’, ‘ground_canopy’, or ‘soil_ground_canopy’.
- Returns:
A VerticalOccupancy flag representing the combined vertical occupancy.