src.create_initial_states.create_initial_conditions

Module Contents

Functions

create_initial_conditions(start, end, seed, virus_shares, reporting_delay, synthetic_data, empirical_infections, population_size=POPULATION_GERMANY, overall_share_known_cases=None, group_share_known_cases=None, group_weights=None)

Create the initial conditions, initial_infections and initial_immunity.

_scale_up_empirical_new_infections(empirical_infections, group_share_known_cases=None, group_weights=None, overall_share_known_cases=None)

Scale up empirical infections with share of known cases.

create_group_specific_share_known_cases(group_share_known_cases, group_weights, overall_share_known_cases, date_range)

Create the group specific share known cases.

create_initial_conditions(start, end, seed, virus_shares, reporting_delay, synthetic_data, empirical_infections, population_size=POPULATION_GERMANY, overall_share_known_cases=None, group_share_known_cases=None, group_weights=None)[source]

Create the initial conditions, initial_infections and initial_immunity.

Parameters
  • start (str or pd.Timestamp) – Start date for collection of initial infections.

  • end (str or pd.Timestamp) – End date for collection of initial infections and initial immunity.

  • seed (int) –

  • virus_shares (dict) – Keys are the names of the virus strains. Values are pandas.Series with a DatetimeIndex and the share among newly infected individuals on each day as value.

  • reporting_delay (int) – Number of days by which the reporting of cases is delayed. If given, later days are used to get the infections of the demanded time frame.

  • synthetic_data (pandas.DataFrame) – The synthetic population data set. Needs to contain ‘county’ and ‘age_group_rki’ as columns.

  • empirical_infections (pandas.DataFrame) – The index must contain ‘date’, ‘county’ and ‘age_group_rki’.

  • overall_share_known_cases (pd.Series) – Series with date index that contains the aggregated share of known cases over time.

  • group_share_known_cases (pandas.Series) – Series with age_groups in the index. The values are interpreted as share of known cases for each age group.

  • group_weights (pandas.Series) – Series with sizes or weights of age groups.

Returns

dictionary containing the initial infections and

initial immunity.

Return type

initial_conditions (dict)

_scale_up_empirical_new_infections(empirical_infections, group_share_known_cases=None, group_weights=None, overall_share_known_cases=None)[source]

Scale up empirical infections with share of known cases.

Parameters
  • empirical_infections (pandas.DataFrame) – Must have the index levels date, county and age_group_rki and contain the column “newly_infected”.

  • group_share_known_cases (pandas.Series) – Series with age_groups in the index. The values are interpreted as share of known cases for each age group.

  • group_weights (pandas.Series) – Series with sizes or weights of age groups.

  • overall_share_known_cases (pd.Series) – Series with date index that contains the aggregated share of known cases over time.

Returns

The upscaled new infections. Has the same index as

empirical_infections.

Return type

pandas.Series

create_group_specific_share_known_cases(group_share_known_cases, group_weights, overall_share_known_cases, date_range)[source]

Create the group specific share known cases.

Parameters
  • group_share_known_cases (pandas.Series) – Series with age_groups in the index. The values are interpreted as share of known cases for each age group.

  • group_weights (pandas.Series) – Series with sizes or weights of age groups.

  • overall_share_known_cases (pd.Series) – Series with date index that contains the aggregated share of known cases over time.

Returns

The index are the dates, the columns are the group labels. The

value is the share known cases of the particular group on the particular date.

Return type

pandas.DataFrame