sid.virus_strains

Module Contents

Functions

prepare_virus_strain_factors(virus_strains: Dict[str, List[str]], params: pandas.DataFrame) → Dict[str, Union[List[str], numpy.ndarray]]

Prepare the information on virus strains and factors for infectiousness.

combine_first_factorized_infections(first: numpy.ndarray, second: numpy.ndarray) → numpy.ndarray

Combine factorized infections where the first has precedence.

categorize_factorized_infections(factorized_infections: Union[pandas.Series, numpy.ndarray], virus_strains: Dict[str, Any]) → pandas.Series

Convert factorized infections with virus strains to a categorical.

factorize_initial_infections(infections: pandas.DataFrame, virus_strains: Dict[str, Any]) → pandas.DataFrame

Factorize multiple boolean or categorical infections.

factorize_boolean_or_categorical_infections(infections, virus_strains)

Factorize boolean or categorical infections.

_factorize_boolean_infections(infected: Union[pandas.Series, numpy.ndarray], names: List[str]) → Tuple[numpy.ndarray]

Factorize boolean infection.

factorize_categorical_infections(virus_strain: pandas.Series, names: List[str]) → Tuple[numpy.ndarray]

Factorize a categorical variable indicating virus strains.

prepare_virus_strain_factors(virus_strains: Dict[str, List[str]], params: pandas.DataFrame) Dict[str, Union[List[str], numpy.ndarray]][source]

Prepare the information on virus strains and factors for infectiousness.

This function recreates the dictionary to not change the original value in partialed function and adds the factors.

The contagiousness_factor explains how contagious a virus strain is, in comparison to the base strain. The immunity_resistance_factor explains how well the immunity level guards from (re)infection, dependent on the strain. The infection probability is multiplied with: (1 - (1 - immunity_resistance_factor) * immunity), so that higher values reduce the effect of immunity.

combine_first_factorized_infections(first: numpy.ndarray, second: numpy.ndarray) numpy.ndarray[source]

Combine factorized infections where the first has precedence.

categorize_factorized_infections(factorized_infections: Union[pandas.Series, numpy.ndarray], virus_strains: Dict[str, Any]) pandas.Series[source]

Convert factorized infections with virus strains to a categorical.

factorize_initial_infections(infections: pandas.DataFrame, virus_strains: Dict[str, Any]) pandas.DataFrame[source]

Factorize multiple boolean or categorical infections.

factorize_boolean_or_categorical_infections(infections, virus_strains)[source]

Factorize boolean or categorical infections.

_factorize_boolean_infections(infected: Union[pandas.Series, numpy.ndarray], names: List[str]) Tuple[numpy.ndarray][source]

Factorize boolean infection.

factorize_categorical_infections(virus_strain: pandas.Series, names: List[str]) Tuple[numpy.ndarray][source]

Factorize a categorical variable indicating virus strains.