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 summer.flows.CrudeBirthFlow(name: str, dest: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None)¶
Bases:
BaseEntryFlowA 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 summer.flows.DeathFlow(name: str, source: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None)¶
Bases:
BaseExitFlowA 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 summer.flows.FunctionFlow(name: str, source: Compartment, dest: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None)¶
Bases:
BaseTransitionFlowA flow that transfers people from a source to a destination based on a user-defined function. Note that the rate is NOT multiplied by the size of the source compartment. This can be used to define more complex flows if required. Important to be careful that compartment sizes do not go negative with these flows, as this is not guaranteed.
- Parameters
name – The flow name.
source – The source compartment.
dest – The destination compartment.
param – A function that returns the flow rate, before adjustments. See get_net_flow for
arguments. (this function's) –
adjustments – Adjustments to the flow rate.
- get_net_flow(compartments: List[Compartment], compartment_values: ndarray, flows: List[BaseFlow], flow_rates: ndarray, computed_values: dict, time: float) float¶
Returns the net flow value at a given time.
- class summer.flows.ImportFlow(name: str, dest: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None)¶
Bases:
BaseEntryFlowCalculates 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 summer.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)¶
Bases:
BaseInfectionFlowAn infection flow that should use the number of infectious people to calculate the force of infection factor.
- class summer.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)¶
Bases:
BaseInfectionFlowAn infection flow that should use the prevalence of infectious people to calculate the force of infection factor.
- class summer.flows.ReplacementBirthFlow(name: str, dest: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None)¶
Bases:
BaseEntryFlowA 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 summer.flows.TransitionFlow(name: str, source: Compartment, dest: Compartment, param: Union[float, Callable[[float], float]], adjustments: Optional[List[BaseAdjustment]] = None)¶
Bases:
BaseTransitionFlowA 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.