src.simulation.load_simulation_inputs

Module Contents

Functions

load_simulation_inputs(scenario, start_date, end_date, debug, group_share_known_case_path=None, period_outputs=False, return_last_states=False, initial_states_path=None, is_resumed=False, rapid_test_statistics_path=None)

Load the simulation inputs.

get_simulation_dependencies(debug, is_resumed)

Collect paths on which the simulation depends.

create_period_outputs()

_calculate_share_ever_rapid_test(df, groupby)

_calculate_share_rapid_test_in_last_week(df, groupby)

_calculate_share_rapid_test_countdown_between(df, groupby, lower, upper, name)

Share by groupby with their last rapid test between lower and upper (inclusively).

calculate_period_virus_share(df, strain)

_calculate_share_doing_rapid_test(df, groupby)

load_simulation_inputs(scenario, start_date, end_date, debug, group_share_known_case_path=None, period_outputs=False, return_last_states=False, initial_states_path=None, is_resumed=False, rapid_test_statistics_path=None)[source]

Load the simulation inputs.

Does not include: params, path, seed.

Parameters
  • scenario (str) – string specifying the scenario. A function with the same name must exist in src.simulation.scenario_simulation_inputs.

  • start_date (str) – date on which the simulation starts. Data must be available for at least a month before the start date for the burn in period.

  • end_date (str) – date on which the simulation ends.

  • debug (bool) – Whether to use the debug or the full initial states.

  • group_share_known_case_path (pathlib.Path, str or None) – if not None, the group share known cases are loaded from this path and used for the creation of the initial conditions.

  • period_outputs (bool, optional) – whether to use period_outputs instead of saving the time series. Default is False.

  • return_last_states (bool, optional) – if True, the last states are returned as part of the simulation result.

  • initial_states_path (pathlib.Path, optional) – Path to the initial states. If not given the standard initial states are used.

  • is_resumed (bool, optional) – if True, the initial_states_path must be given. In that case no initial conditions are created

  • rapid_test_statistics_path (Path, optional) – where to save rapid test statistics.

Returns

Dictionary with most arguments of get_simulate_func. Keys are:
  • initial_states

  • contact_models

  • duration

  • events

  • saved_columns

  • virus_strains

  • derived_state_variables

  • seasonality_factor_model

  • initial_conditions

  • susceptibility_factor_model

  • testing_demand_models

  • testing_allocation_models

  • testing_processing_models

  • period_outputs

  • return_last_states

  • return_time_series

  • contact_policies

  • vaccination_models

  • rapid_test_models

  • rapid_test_reaction_models

Return type

dict

get_simulation_dependencies(debug, is_resumed)[source]

Collect paths on which the simulation depends.

This contains both paths to python modules and data paths. It only covers sid-germany specific paths, i.e. not sid.

Parameters
  • debug (bool) – Whether to use the debug initial states.

  • is_resumed (bool) – Whether the simulation is a resumed simulation. If False the path to the initial states from BLD / “data” are given.

Returns

Dictionary with the dependencies for the simulation.

Return type

paths (dict)

create_period_outputs()[source]
_calculate_share_ever_rapid_test(df, groupby)[source]
_calculate_share_rapid_test_in_last_week(df, groupby)[source]
_calculate_share_rapid_test_countdown_between(df, groupby, lower, upper, name)[source]

Share by groupby with their last rapid test between lower and upper (inclusively).

Parameters
  • df (pandas.DataFrame) – states DataFrame

  • groupby (str or None) – groupby column

  • lower (int) – lower bound (individuals with this value are included)

  • upper (int) – upper bound (individuals with this value are included)

  • name (str) – name of the Series to be returned

calculate_period_virus_share(df, strain)[source]
_calculate_share_doing_rapid_test(df, groupby)[source]