InstituteforDiseaseModeling/covasim

Plot comparing three scenarios will only show two?

AndrewC19 opened this issue · 3 comments

Describe the bug

If I plot three scenarios, the graphs only show two of the three scenarios.

To reproduce

Steps to reproduce the behavior:

import covasim as cv

base_pars = dict(
    pop_type='hybrid',
    pop_size=50e3,
    pop_infected=100,
    start_day='2021-06-01',
    end_day='2021-09-01',
    location='UK'
)

# Define interventions
testing_intervention = cv.test_prob(symp_prob=0.2, asymp_prob=0.001, symp_quar_prob=1.0, asymp_quar_prob=1.0)
contact_tracing_intervention = cv.contact_tracing(trace_probs=dict(h=1.0, s=0.5, w=0.5, c=0.3))

# Create scenarios
scenarios = dict(baseline={'name': 'Baseline', 'pars': {}},
                 testing={'name': 'Testing', 'pars': {'interventions': testing_intervention}},
                 contact_tracing={'name': 'Contact Tracing', 'pars': {'interventions': contact_tracing_intervention}})

# Run and plot the scenarios
scens = cv.Scenarios(basepars=base_pars, scenarios=scenarios)
scens.run()
scens.plot()

Expected behavior

All three default graphs (cumulative infections, new infections per day, and cumulative deaths) should include a line for each of the three scenarios.

Screenshots or outputs
Screenshot 2021-06-16 at 12 39 49

Platform:

  • Covasim version: 3.0.5
  • OS: macOS Big Sur 11.4
  • Other platform information: using python 3.7.4 in pycharm IDE.

Hi @AndrewC19 , the issue is that you've defined a contact tracing intervention, but no testing intervention, so no one is ever diagnosed to start the contact tracing process. You should have gotten the following warning in the console when running:

Note: you have defined a contact tracing intervention but no testing intervention was found. Unless this is intentional, please define at least one testing intervention.

If you define

scenarios = dict(baseline={'name': 'Baseline', 'pars': {}},
                 testing={'name': 'Testing', 'pars': {'interventions': testing_intervention}},
                 contact_tracing={'name': 'Contact Tracing', 'pars': {'interventions': [testing_intervention, contact_tracing_intervention]}})

then that should work.

Hi @cliffckerr, thanks for the reply. I didn't notice the warning in the console, but this makes sense. I also have a follow-up question about the model.

I understand that the quar_period parameter should have an effect on the contact_tracing intervention as contact tracing puts contacted individuals into quarantine. What I don't understand is how the test_prob intervention works. In the Covasim paper, it says that "people diagnosed with COVID-19 can be isolated" and "people in isolation or quarantine typically have a lower probability of infecting others (if infectious)". I cannot see how this is implemented in the test_prob method.

How would I go about modifying the test_prob intervention such that individuals are more or less compliant to isolate upon receiving a positive result? Also, is it possible to change the isolation period similar to quar_period?

Apologies if this is something obvious that I am missing!

Hi @AndrewC19 , apologies for the slow reply!

Isolation and quarantine efficacy are defined in the parameters, and depend on the contact layer:
https://github.com/InstituteforDiseaseModeling/covasim/blob/master/covasim/parameters.py#L184

There is currently no way to set the isolation period following diagnosis; the assumption is that people remain in that state for the duration of their infection. (It is however reset when they recover.)

Closing this issue, but feel free to write to info@covasim.org for hopefully faster support in future!