sid.parse_model¶
This module contains the code the parse input data.
Module Contents¶
Functions¶
|
Parse the user-defined duration. |
|
Parse the initial conditions. |
|
Parse the information of the different infectiousness for each virus strain. |
-
parse_duration(duration: Union[Dict[str, Any], None]) → Dict[str, Any][source]¶ Parse the user-defined duration.
- Parameters
duration (Union[Dict[str, Any], None]) – A dictionary which contains keys and values suited to be passed to
pandas.date_range(). Only the first three arguments,"start","end", and"periods", are allowed.- Returns
- A dictionary containing start and end dates
and dates for the whole period.
- Return type
internal_duration (Dict[str, Any])
Examples
>>> parse_duration({"start": "2020-03-01", "end": "2020-03-10"}) {'start': Timestamp('2020-03-01 00:00:00', freq='D'), 'end': ...
-
parse_initial_conditions(ic: Dict[str, Any], start_date_simulation: pd.Timestamp, virus_strains: Dict[str, Any]) → Dict[str, Any][source]¶ Parse the initial conditions.
-
parse_virus_strains(virus_strains: Optional[List[str]], params: pd.DataFrame) → Dict[str, List[str]][source]¶ Parse the information of the different infectiousness for each virus strain.
The multipliers are scaled between 0 and 1 such that random contacts only need to be reduced with the infection probabilities in
sid.contacts._reduce_random_contacts_with_infection_probs().- Parameters
virus_strains (Optional[List[str]]) – A list of names indicating the different virus strains used in the model. Their different infectiousness is looked up in the params DataFrame. By default, only one virus strain is used.
params (pandas.DataFrame) – The params DataFrame.
- Returns
- A dictionary with a single key called
"names"which holds the sorted names of virus strains.
- Return type