Coverage for pybeepop/beepop/larva.py: 94%
17 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-30 13:34 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-30 13:34 +0000
1"""BeePop+ Larva Module.
3This module contains the Larva class that represents the larval stage of honey bee
4development. Larvae are the feeding and growing stage between eggs and pupae in
5the bee lifecycle, requiring care from nurse bees and being vulnerable to mite
6infestation during this critical development period.
8Larvae in the simulation represent cohorts that develop over multiple days before
9pupating into capped brood. They consume resources and can become infested with
10varroa mites that will affect their development and future adult longevity.
11"""
13from datetime import datetime
14from pybeepop.beepop.bee import Bee
17class Larva(Bee):
18 """Larval stage honey bee class representing developing immature bees.
20 This class models larval honey bees during their growth and development phase.
21 Larvae require feeding from nurse bees and are susceptible to varroa mite
22 infestation. They develop over several days before transitioning to the
23 capped brood (pupal) stage.
25 Larvae consume colony resources and their survival affects future adult
26 populations. Mite infestation during the larval stage can reduce adult
27 longevity and overall colony health.
29 Attributes:
30 number (int): Population count for this larval cohort (inherited from Bee)
31 age (float): Development age in days (inherited from Bee)
32 alive (bool): Whether this cohort is alive (inherited from Bee)
33 infested (bool): Whether this larval cohort is infested with mites
34 fertilized (bool): Whether associated mites are fertilized
35 mites (int): Number of mites infesting this larval population
36 infest_probability (float): Probability of mite infestation (0.0-1.0)
37 """
39 def __init__(self, number=0):
40 """Initialize a new Larva cohort.
42 Creates a larval bee population with specified initial size and
43 default attributes for mite infestation status and development
44 characteristics.
46 Args:
47 number (int, optional): Initial population size for this larval
48 cohort. Defaults to 0.
49 """
50 super().__init__(number)
51 self.infested = False
52 self.fertilized = False
53 self.mites = 0
54 self.infest_probability = 0.0
56 def reset(self):
57 super().reset()
58 self.infested = False
59 self.fertilized = False
60 self.mites = 0
61 self.infest_probability = 0.0
63 def __str__(self):
64 return (
65 f"Larva(number={self.number}, age={self.age}, alive={self.alive}, "
66 f"infested={self.infested}, fertilized={self.fertilized}, "
67 f"mites={self.mites}, infest_probability={self.infest_probability})"
68 )