InstituteforDiseaseModeling / covasim

COVID-19 Agent-based Simulator (Covasim): a model for exploring coronavirus dynamics and interventions
https://covasim.org
MIT License
255 stars 224 forks source link

Faulty error message: rel_imm_variant is not a valid key #377

Closed Tianmaru closed 2 years ago

Tianmaru commented 2 years ago

Describe the bug

This is not really a bug, but an erroneous error message that might cause confusion. When defining a new variant, the key "rel_imm_variant" is listed as valid key, although it actually isn't.

To reproduce

Define a new variant and use the key "rel_imm_variant", for example:

psi_pars = dict(
    rel_imm_variant = 1,
    rel_beta        = 1,
    rel_symp_prob   = 1,
    rel_severe_prob = 1,
    rel_crit_prob   = 1,
    rel_death_prob  = 1
)

psi = cv.variant(label='Psi', variant=psi_pars, days=0, n_imports=10)

Expected behavior Either accept the provided parameters, or state that rel_imm_variant is not a valid key.

Screenshots or outputs KeyNotFoundError: Could not parse variant keys "rel_imm_variant"; valid keys are: "rel_imm_variant, rel_beta, rel_symp_prob, rel_severe_prob, rel_crit_prob, rel_death_prob"

Platform (please complete the following information): Covasim 3.1.1 (2021-12-06) — © 2021 by IDM

Additional Context: This is caused by rel_imm_variant being listed in variant_pars in default.py, but does not actually seem to be a parameter defined by variants.

cliffckerr commented 2 years ago

Thanks @Tianmaru, well spotted! We'll get this fixed in the 3.1.2 release.

cliffckerr commented 2 years ago

Fixed in 3.1.2