RUFAS.routines.animal.life_cycle.animal_population module#
- class RUFAS.routines.animal.life_cycle.animal_population.AnimalPopulation(*, calves: List[Calf], heiferIs: List[HeiferI], heiferIIs: List[HeiferII], heiferIIIs: List[HeiferIII], cows: List[Cow], replacement: List[Cow], current_animal_id: int = 0, order_by_random: bool = True)#
Bases:
object
A data class representing the population of animals in a herd.
Attributes#
- calvesList[Calf]
A list of Calf instances in the herd.
- heiferIsList[HeiferI]
A list of HeiferI (stage I heifers) instances in the herd.
- heiferIIsList[HeiferII]
A list of HeiferII (stage II heifers) instances in the herd.
- heiferIIIsList[HeiferIII]
A list of HeiferIII (stage III heifers) instances in the herd.
- cowsList[Cow]
A list of Cow instances in the herd.
- replacementList[Cow]
A list of replacement Cow instances in the herd.
- current_animal_idint, default=0
The highest ID number among all animals in the herd.
- order_by_randombool, default=0
A flag to indicate whether the animals should be ordered randomly.
- current_animal_id: int = 0#
- order_by_random: bool = True#
- next_id() int #
Increment and return the next unique identifier for an animal.
Returns#
- int
The next unique animal_id.
- get_calves() List[Calf] #
Retrieve a list of Calf instances.
Returns#
- List[Calf]
A list of Calf instances.
- get_heiferIs() List[HeiferI] #
Retrieve a list of HeiferI instances.
Returns#
- List[HeiferI]
A list of HeiferI instances.
- get_heiferIIs() List[HeiferII] #
Retrieve a list of HeiferII instances.
Returns#
- List[HeiferII]
A list of HeiferII instances.
- get_heiferIIIs() List[HeiferIII] #
Retrieve a list of HeiferIII instances.
Returns#
- List[HeiferIII]
A list of HeiferIII instances.
- get_replacement_cows() List[Cow] #
Retrieve a list of replacement Cow instances.
Returns#
- List[Cow]
A list of replacement Cow instances.
- static _average(data: List[int | float]) float #
A custom get-average function for the given data. Returns 0 for an empty list.
Parameters#
- dataList[int | float]
The input data.
Returns#
- float
The average of the given data, or 0 for an empty data list.