pylag.mortality module
MortalityCalculators can be used to determine whether a living particle lives or dies.
Note
mortality is implemented in Cython. Only a small portion of the API is exposed in Python with accompanying documentation.
- class pylag.mortality.FixedTimeMortalityCalculator(config)
Bases:
MortalityCalculator
Kill particles once they reach a given age
Three different methods are used to initialise the parameter giving the age at which an individual dies. These are: a) A single fixed value in days, 2) 2) A value in days drawn from a uniform distribution with given limits, and 3) A value in days drawn from a gaussian distribution with given mean and standard deviation.
- Parameters
config (ConfigParser) – Configuration object
- Variables
age_of_death_parameter_name (str) – The age of death parameter name.
initialisation_method (str) – The method used for initialising particle parameters.
age_of_death (float) – The age at which an individual dies.
minimum_bound (float) – The minimum bound used for the uniform random number initialisation method.
maximum_bound (float) – The maximum bound used for the uniform random number initialisation method.
mean (float) – The mean used for the guassian random number initialisation method.
standard_deviation (float) – The standard deviation used for the guassian random number initialisation method.
- class pylag.mortality.MortalityCalculator
Bases:
object
Abstract base class for PyLag mortality calculator
- apply_wrapper(self, DataReader data_reader, DTYPE_FLOAT_t time, ParticleSmartPtr particle)
Python friendly wrapper for apply()
The apply() method must be implemented in the derived class.
- Parameters
data_reader (pylag.data_reader.DataReader) – A concrete PyLag data reader which inherits from the base class pylag.data_reader.DataReader.
time (float) – The time the crossing occurred.
particle (pylag.particle_cpp_wrapper.ParticleSmartPtr) – A ParticleSmartPtr.
- set_initial_particle_properties_wrapper(self, ParticleSmartPtr particle)
Python friendly wrapper for apply()
- Parameters
particle (C pointer) – C pointer to a Particle struct
- class pylag.mortality.ProbabilisticMortalityCalculator(config)
Bases:
MortalityCalculator
Kill individuals randomly given a specified death rate
The probability of an individual dying is:
P_{D} = mu_{D} Delta t
where mu_{D} is the death rate and Delta t is the model time step for biological processes.
- pylag.mortality.get_mortality_calculator(config)
Factory method for mortality calculators
- Parameters
config (ConfigParser) – PyLag configuraton object
- Returns
A mortality calculator
- Return type