Process Conversions

epipack.process_conversions.fission_processes_to_events(process_list)[source]

Define linear fission processes between compartments.

Parameters

process_list (list of tuple) --

A list of tuples that contains fission rates in the following format:

[
    (source_compartment, rate, target_compartment_0, target_compartment_1 ),
    ...
]

Example

For pure exponential growth of compartment B.

epi.set_fission_processes([
    ("B", growth_rate, "B", "B" ),
])
epipack.process_conversions.fission_processes_to_rates(process_list)[source]

Define linear fission processes between compartments.

Parameters

process_list (list of tuple) --

A list of tuples that contains fission rates in the following format:

[
    (source_compartment, rate, target_compartment_0, target_compartment_1 ),
    ...
]

Example

For pure exponential growth of compartment B.

epi.set_fission_processes([
    ("B", growth_rate, "B", "B" ),
])
epipack.process_conversions.fusion_processes_to_events(process_list)[source]

Define fusion processes between compartments.

Parameters

process_list (list of tuple) --

A list of tuples that contains fission rates in the following format:

[
    (coupling_compartment_0, coupling_compartment_1, rate, target_compartment_0 ),
    ...
]

Example

Fusion of reactants "A", and "B" to form "C".

fusion_processes_to_events([
    ("A", "B", reaction_rate, "C" ),
])
epipack.process_conversions.fusion_processes_to_rates(process_list)[source]

Define fusion processes between compartments.

Parameters

process_list (list of tuple) --

A list of tuples that contains fission rates in the following format:

[
    (coupling_compartment_0, coupling_compartment_1, rate, target_compartment_0 ),
    ...
]

Example

Fusion of reactants "A", and "B" to form "C".

fusion_processes_to_rates([
    ("A", "B", reaction_rate, "C" ),
])
epipack.process_conversions.processes_to_events(process_list, compartments, ignore_rate_position_checks=False)[source]

Converts a list of reaction process tuples to event tuples

Parameters
  • process_list (list of tuple) --

    A list containing reaction processes in terms of tuples.

    [
        # transition process
        ( source_compartment, rate, target_compartment),
    
        # transmission process
        ( coupling_compartment_0, coupling_compartment_1, rate, target_compartment_0, target_ccompartment_1),
    
        # fission process
        ( source_compartment, rate, target_compartment_0, target_compartment_1),
    
        # fusion process
        ( source_compartment_0, source_compartment_1, rate, target_compartment),
    
        # death process
        ( source_compartment, rate, None),
    
        # birth process
        ( None, rate, target_compartment),
    ]
    

  • compartments (list of hashable type) -- The compartments of these reaction equations.

  • ignore_rate_position_checks (bool, default = False) -- This function usually checks whether the rate of a reaction is positioned correctly. You can turn this behavior off for transition, birth, death, and transmission processes. (Useful if you want to define symbolic transmission processes that are compartment-dependent).

Returns

  • quadratic_events (list of tuple) -- event tuples for quadratic terms

  • linear_events (list obj:tuple) -- event tuples for linear terms

epipack.process_conversions.processes_to_rates(process_list, compartments, ignore_rate_position_checks=False)[source]

Converts a list of reaction process tuples to rate tuples

Parameters
  • process_list (list of tuple) --

    A list containing reaction processes in terms of tuples.

    [
        # transition process
        ( source_compartment, rate, target_compartment),
    
        # transmission process
        ( coupling_compartment_0, coupling_compartment_1, rate, target_compartment_0, target_ccompartment_1),
    
        # fission process
        ( source_compartment, rate, target_compartment_0, target_ccompartment_1),
    
        # fusion process
        ( source_compartment_0, source_compartment_1, rate, target_compartment),
    
        # death process
        ( source_compartment, rate, None),
    
        # birth process
        ( None, rate, target_compartment),
    ]
    

  • compartments (list of hashable type) -- The compartments of these reaction equations.

  • ignore_rate_position_checks (bool, default = False) -- This function usually checks whether the rate of a reaction is positioned correctly. You can turn this behavior off for transition, birth, death, and transmission processes. (Useful if you want to define symbolic transmission processes that are compartment-dependent).

Returns

  • quadratic_rates (list of tuple) -- Rate tuples for quadratic terms

  • linear_rates (list obj:tuple) -- Rate tuples for linear terms

epipack.process_conversions.transition_processes_to_events(process_list)[source]

Define the transition processes between compartments, including birth and deaths processes.

Parameters

process_list (list of tuple) --

A list of tuples that contains transitions rates in the following format:

[
    ( source_compartment, rate, target_compartment ),
    ...
]

Example

For an SEIR model.

transition_processes_to_events([
    ("E", symptomatic_rate, "I" ),
    ("I", recovery_rate, "R" ),
])
epipack.process_conversions.transition_processes_to_rates(process_list)[source]

Define the transition processes between compartments, including birth and deaths processes.

Parameters

process_list (list of tuple) --

A list of tuples that contains transitions rates in the following format:

[
    ( source_compartment, rate, target_compartment ),
    ...
]

Example

For an SEIR model.

transition_processes_to_rates([
    ("E", symptomatic_rate, "I" ),
    ("I", recovery_rate, "R" ),
])
epipack.process_conversions.transmission_processes_to_events(process_list)[source]

A wrapper to define quadratic process events through transmission reaction equations. Note that in stochastic network/agent simulations, the transmission rate is equal to a rate per link. For the mean-field ODEs, the rates provided to this function will just be equal to the prefactor of the respective quadratic terms.

For instance, if you analyze an SIR system and simulate on a network of mean degree \(k_0\), a basic reproduction number \(R_0\), and a recovery rate \(\mu\), you would define the single link transmission process as

("I", "S", R_0/k_0 * mu, "I", "I")

For the mean-field system here, the corresponding reaction equation would read

("I", "S", R_0 * mu, "I", "I")
Parameters

process_list (list of tuple) --

A list of tuples that contains transitions events in the following format:

[
    (source_compartment,
     target_compartment_initial,
     rate
     source_compartment,
     target_compartment_final,
     ),
    ...
]

Example

For an SEIR model.

transmission_processes_to_events([
    ("I", "S", +1, "I", "E" ),
])
epipack.process_conversions.transmission_processes_to_rates(process_list)[source]

A wrapper to define quadratic process rates through transmission reaction equations. Note that in stochastic network/agent simulations, the transmission rate is equal to a rate per link. For the mean-field ODEs, the rates provided to this function will just be equal to the prefactor of the respective quadratic terms.

For instance, if you analyze an SIR system and simulate on a network of mean degree \(k_0\), a basic reproduction number \(R_0\), and a recovery rate \(\mu\), you would define the single link transmission process as

("I", "S", R_0/k_0 * mu, "I", "I")

For the mean-field system here, the corresponding reaction equation would read

("I", "S", R_0 * mu, "I", "I")
Parameters

process_list (list of tuple) --

A list of tuples that contains transitions rates in the following format:

[
    (source_compartment,
     target_compartment_initial,
     rate
     source_compartment,
     target_compartment_final,
     ),
    ...
]

Example

For an SEIR model.

transmission_processes_to_rates([
    ("I", "S", +1, "I", "E" ),
])