diff --git a/docs/source/changes.rst b/docs/source/changes.rst index 2b502e9f..728e02d7 100644 --- a/docs/source/changes.rst +++ b/docs/source/changes.rst @@ -15,6 +15,8 @@ all releases are available on `Anaconda.org - :gh:`126` enhances the plot for the channel of infections. The displayed numbers can be shares among all infected, among all individuals or seven days incidences per 100,000 people. +- :gh:`127` includes better parameters for time-variant sensitivity of rapid tests. +- :gh:`128` ensures determinacy in the setup of a simulation. 0.0.7 - 2021-05-12 diff --git a/src/sid/countdowns.py b/src/sid/countdowns.py index 3aebcb24..a42ec9b1 100644 --- a/src/sid/countdowns.py +++ b/src/sid/countdowns.py @@ -53,8 +53,8 @@ """ -COUNTDOWNS_WITHOUT_DRAWS = ("cd_received_rapid_test", "cd_ever_infected") +COUNTDOWNS_WITHOUT_DRAWS = ("cd_ever_infected", "cd_received_rapid_test") """Tuple[str]: Countdowns which do not have draws.""" -COUNTDOWNS_WITH_DRAWS = tuple(set(COUNTDOWNS) - set(COUNTDOWNS_WITHOUT_DRAWS)) +COUNTDOWNS_WITH_DRAWS = tuple(sorted(set(COUNTDOWNS) - set(COUNTDOWNS_WITHOUT_DRAWS))) """Tuple[str]: Countdowns whose length is a random variable.""" diff --git a/src/sid/initial_conditions.py b/src/sid/initial_conditions.py index 683cc178..7cbcfc7d 100644 --- a/src/sid/initial_conditions.py +++ b/src/sid/initial_conditions.py @@ -234,8 +234,9 @@ def sample_initial_distribution_of_infections_and_immunity( ) spread_out_virus_strains = _sample_factorized_virus_strains_for_infections( - spread_out_infections, - initial_conditions["virus_shares"], + spread_out_infections=spread_out_infections, + virus_shares=initial_conditions["virus_shares"], + seed=next(seed), ) else: @@ -418,8 +419,11 @@ def _spread_out_initial_infections( def _sample_factorized_virus_strains_for_infections( spread_out_infections: pd.DataFrame, virus_shares: Dict[str, Any], + seed: int, ) -> pd.DataFrame: """Convert boolean infections to factorized virus strains.""" + np.random.seed(seed) + spread_out_virus_strains = pd.DataFrame( data=-1, index=spread_out_infections.index,