flows¶
This module contains the classes which are used to calculate inter-compartmental flow rates. As a user of the framework you should not have to use these classes directly.
- class summer2.flows.CrudeBirthFlow(name: str, dest: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None, tags: Optional[Set[str]] = None)¶
Bases:
BaseEntryFlow
A flow that calculates births using a ‘crude birth rate’ method. The number of births will be determined by the product of the birth rate and total population.
- Parameters
name – The flow name.
dest – The destination compartment.
param – The fraction of the population to be born per timestep.
adjustments – Adjustments to the flow rate.
- get_net_flow(compartment_values: ndarray, computed_values: dict, time: float, parameters: Optional[dict] = None) float ¶
Returns the net flow value at a given time.
- class summer2.flows.DeathFlow(name: str, source: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None, tags: Optional[Set[str]] = None)¶
Bases:
BaseExitFlow
A flow representing deaths. Calculated from a fractional death rate.
- Parameters
name – The flow name.
dest – The destination compartment.
param – The fraction of the population who die per timestep.
adjustments – Adjustments to the flow rate.
- get_net_flow(compartment_values: ndarray, computed_values: dict, time: float, parameters: Optional[dict] = None) float ¶
Returns the net flow value at a given time.
- is_death_flow = True¶
- class summer2.flows.ImportFlow(name: str, dest: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None, tags: Optional[Set[str]] = None)¶
Bases:
BaseEntryFlow
Calculates importation, where people enter the destination compartment from outside the system. The number of people imported per timestep is independent of the source compartment, because there isn’t a source compartment.
- Parameters
name – The flow name.
dest – The destination compartment.
param – The number of people to be imported per timestep.
adjustments – Adjustments to the flow rate.
- get_net_flow(compartment_values: ndarray, computed_values: dict, time: float, parameters: Optional[dict] = None) float ¶
Returns the net flow value at a given time.
- class summer2.flows.InfectionDensityFlow(name: str, source: Compartment, dest: Compartment, param: Union[float, Callable[[float], float]], find_infectious_multiplier: Callable[[Compartment, Compartment], float], adjustments: Optional[List[BaseAdjustment]] = None, tags: Optional[Set[str]] = None)¶
Bases:
BaseInfectionFlow
An infection flow that should use the number of infectious people to calculate the force of infection factor.
- class summer2.flows.InfectionFrequencyFlow(name: str, source: Compartment, dest: Compartment, param: Union[float, Callable[[float], float]], find_infectious_multiplier: Callable[[Compartment, Compartment], float], adjustments: Optional[List[BaseAdjustment]] = None, tags: Optional[Set[str]] = None)¶
Bases:
BaseInfectionFlow
An infection flow that should use the prevalence of infectious people to calculate the force of infection factor.
- class summer2.flows.ReplacementBirthFlow(name: str, dest: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None, tags: Optional[Set[str]] = None)¶
Bases:
BaseEntryFlow
A flow that calculates births by replacing total deaths. The total number of deaths will be supplied by the parameter function.
- Parameters
name – The flow name.
dest – The destination compartment.
param – The total number of deaths per timestep.
adjustments – Adjustments to the flow rate.
- get_net_flow(compartment_values: ndarray, computed_values: dict, time: float, parameters: Optional[dict] = None) float ¶
Returns the net flow value at a given time.
- class summer2.flows.TransitionFlow(name: str, source: Compartment, dest: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None, tags: Optional[Set[str]] = None)¶
Bases:
BaseTransitionFlow
A flow that transfers people from a source to a destination based on the population of the source compartment and the fractional flow rate.
- Parameters
name – The flow name.
source – The source compartment.
dest – The destination compartment.
param – The fraction of the source compartment to transfer per timestep.
adjustments – Adjustments to the flow rate.
- get_net_flow(compartment_values: ndarray, computed_values: dict, time: float, parameters: Optional[dict] = None) float ¶
Returns the net flow value at a given time.