|
22 | 22 |
|
23 | 23 | #include "abm/mask_type.h" |
24 | 24 | #include "abm/time.h" |
| 25 | +#include "abm/infection_state.h" |
25 | 26 | #include "abm/virus_variant.h" |
26 | 27 | #include "abm/protection_event.h" |
27 | 28 | #include "abm/protection_event.h" |
@@ -276,6 +277,23 @@ struct DeathsPerInfectedCritical { |
276 | 277 | } |
277 | 278 | }; |
278 | 279 |
|
| 280 | +/** |
| 281 | + * @brief Distributions of the time that people have been in their initial infection state at the beginning of the simulation. |
| 282 | + * This makes it possible to draw from a user-defined distribution instead of drawing from a uniform distribution. |
| 283 | + */ |
| 284 | +struct InitialInfectionStateDistributions { |
| 285 | + using Type = CustomIndexArray<AbstractParameterDistribution, VirusVariant, AgeGroup, InfectionState>; |
| 286 | + static Type get_default(AgeGroup size) |
| 287 | + { |
| 288 | + return Type({VirusVariant::Count, size, InfectionState::Count}, |
| 289 | + AbstractParameterDistribution(ParameterDistributionUniform(0., 1.))); |
| 290 | + } |
| 291 | + static std::string name() |
| 292 | + { |
| 293 | + return "InitialInfectionStateDistributions"; |
| 294 | + } |
| 295 | +}; |
| 296 | + |
279 | 297 | /** |
280 | 298 | * @brief Parameters for the ViralLoad course. Default values taken as constant values from the average from |
281 | 299 | * https://github.com/VirologyCharite/SARS-CoV-2-VL-paper/tree/main |
@@ -317,29 +335,29 @@ struct ViralLoadDistributions { |
317 | 335 | * @brief Parameters for the viral shed. Default values taken as constant values that match the graph 2C from |
318 | 336 | * https://github.com/VirologyCharite/SARS-CoV-2-VL-paper/tree/main |
319 | 337 | */ |
320 | | -struct ViralShedParameters { |
| 338 | +struct ViralShedTuple { |
321 | 339 | ScalarType viral_shed_alpha; |
322 | 340 | ScalarType viral_shed_beta; |
323 | 341 |
|
324 | 342 | /// This method is used by the default serialization feature. |
325 | 343 | auto default_serialize() |
326 | 344 | { |
327 | | - return Members("ViralShedParameters") |
| 345 | + return Members("ViralShedTuple") |
328 | 346 | .add("viral_shed_alpha", viral_shed_alpha) |
329 | 347 | .add("viral_shed_beta", viral_shed_beta); |
330 | 348 | } |
331 | 349 | }; |
332 | 350 |
|
333 | | -struct ViralShedDistribution { |
334 | | - using Type = CustomIndexArray<ViralShedParameters, VirusVariant, AgeGroup>; |
| 351 | +struct ViralShedParameters { |
| 352 | + using Type = CustomIndexArray<ViralShedTuple, VirusVariant, AgeGroup>; |
335 | 353 | static Type get_default(AgeGroup size) |
336 | 354 | { |
337 | | - Type default_val({VirusVariant::Count, size}, ViralShedParameters{-7., 1.}); |
| 355 | + Type default_val({VirusVariant::Count, size}, ViralShedTuple{-7., 1.}); |
338 | 356 | return default_val; |
339 | 357 | } |
340 | 358 | static std::string name() |
341 | 359 | { |
342 | | - return "ViralShedDistribution"; |
| 360 | + return "ViralShedParameters"; |
343 | 361 | } |
344 | 362 | }; |
345 | 363 |
|
@@ -375,21 +393,6 @@ struct InfectionRateFromViralShed { |
375 | 393 | } |
376 | 394 | }; |
377 | 395 |
|
378 | | -/** |
379 | | - * @brief Probability that an Infection is detected. |
380 | | - */ |
381 | | -struct DetectInfection { |
382 | | - using Type = CustomIndexArray<UncertainValue<ScalarType>, VirusVariant, AgeGroup>; |
383 | | - static Type get_default(AgeGroup size) |
384 | | - { |
385 | | - return Type({VirusVariant::Count, size}, 1.); |
386 | | - } |
387 | | - static std::string name() |
388 | | - { |
389 | | - return "DetectInfection"; |
390 | | - } |
391 | | -}; |
392 | | - |
393 | 396 | /** |
394 | 397 | * @brief Effectiveness of a Mask of a certain MaskType% against an Infection%. |
395 | 398 | */ |
@@ -715,12 +718,13 @@ using ParametersBase = |
715 | 718 | TimeInfectedSymptomsToSevere, TimeInfectedSymptomsToRecovered, TimeInfectedSevereToCritical, |
716 | 719 | TimeInfectedSevereToRecovered, TimeInfectedSevereToDead, TimeInfectedCriticalToDead, |
717 | 720 | TimeInfectedCriticalToRecovered, SymptomsPerInfectedNoSymptoms, SeverePerInfectedSymptoms, |
718 | | - CriticalPerInfectedSevere, DeathsPerInfectedSevere, DeathsPerInfectedCritical, ViralLoadDistributions, |
719 | | - ViralShedDistribution, ViralShedFactor, InfectionRateFromViralShed, DetectInfection, MaskProtection, AerosolTransmissionRates, |
720 | | - LockdownDate, QuarantineDuration, QuarantineEffectiveness, SocialEventRate, BasicShoppingRate, |
721 | | - WorkRatio, SchoolRatio, GotoWorkTimeMinimum, GotoWorkTimeMaximum, GotoSchoolTimeMinimum, |
722 | | - GotoSchoolTimeMaximum, AgeGroupGotoSchool, AgeGroupGotoWork, InfectionProtectionFactor, |
723 | | - SeverityProtectionFactor, HighViralLoadProtectionFactor, TestData>; |
| 721 | + CriticalPerInfectedSevere, DeathsPerInfectedSevere, DeathsPerInfectedCritical, |
| 722 | + InitialInfectionStateDistributions, ViralLoadDistributions, ViralShedParameters, ViralShedFactor, |
| 723 | + InfectionRateFromViralShed, MaskProtection, AerosolTransmissionRates, LockdownDate, QuarantineDuration, |
| 724 | + QuarantineEffectiveness, SocialEventRate, BasicShoppingRate, WorkRatio, SchoolRatio, |
| 725 | + GotoWorkTimeMinimum, GotoWorkTimeMaximum, GotoSchoolTimeMinimum, GotoSchoolTimeMaximum, |
| 726 | + AgeGroupGotoSchool, AgeGroupGotoWork, InfectionProtectionFactor, SeverityProtectionFactor, |
| 727 | + HighViralLoadProtectionFactor, TestData>; |
724 | 728 |
|
725 | 729 | /** |
726 | 730 | * @brief Maximum number of Person%s an infectious Person can infect at the respective Location. |
@@ -954,14 +958,6 @@ class Parameters : public ParametersBase |
954 | 958 | (uint32_t)v, (size_t)i, 0); |
955 | 959 | return true; |
956 | 960 | } |
957 | | - |
958 | | - if (this->get<DetectInfection>()[{v, i}] < 0.0 || this->get<DetectInfection>()[{v, i}] > 1.0) { |
959 | | - log_error("Constraint check: Parameter DetectInfection of virus variant {} and age group {:.0f} " |
960 | | - "smaller than {:d} or " |
961 | | - "larger than {:d}", |
962 | | - (uint32_t)v, (size_t)i, 0, 1); |
963 | | - return true; |
964 | | - } |
965 | 961 | } |
966 | 962 |
|
967 | 963 | if (this->get<GotoWorkTimeMinimum>()[i].seconds() < 0.0 || |
|
0 commit comments