class test_prob(symp_prob, asymp_prob=0.0, symp_quar_prob=None, asymp_quar_prob=None, quar_policy=None, subtarget=None, ili_prev=None, sensitivity=1.0, loss_prob=0.0, test_delay=0, start_day=0, end_day=None, swab_delay=None, **kwargs)[source]#

Bases: Intervention

Assign each person a probability of being tested for COVID based on their symptom state, quarantine state, and other states. Unlike test_num, the total number of tests not specified, but rather is an output.

  • symp_prob (float) – probability of testing a symptomatic (unquarantined) person

  • asymp_prob (float) – probability of testing an asymptomatic (unquarantined) person (default: 0)

  • symp_quar_prob (float) – probability of testing a symptomatic quarantined person (default: same as symp_prob)

  • asymp_quar_prob (float) – probability of testing an asymptomatic quarantined person (default: same as asymp_prob)

  • quar_policy (str) – policy for testing in quarantine: options are ‘start’ (default), ‘end’, ‘both’ (start and end), ‘daily’; can also be a number or a function, see get_quar_inds()

  • subtarget (dict) – subtarget intervention to people with particular indices (see test_num() for details)

  • ili_prev (float/arr) – prevalence of influenza-like-illness symptoms in the population; can be float, array, or dataframe/series

  • sensitivity (float) – test sensitivity (default 100%, i.e. no false negatives)

  • loss_prob (float) – probability of the person being lost-to-follow-up (default 0%, i.e. no one lost to follow-up)

  • test_delay (int) – days for test result to be known (default 0, i.e. results available instantly)

  • start_day (int) – day the intervention starts (default: 0, i.e. first day of the simulation)

  • end_day (int) – day the intervention ends (default: no end)

  • swab_delay (dict) – distribution for the delay from onset to swab; if this is present, it is used instead of test_delay

  • kwargs (dict) – passed to Intervention()


interv = cv.test_prob(symp_prob=0.1, asymp_prob=0.01) # Test 10% of symptomatics and 1% of asymptomatics
interv = cv.test_prob(symp_quar_prob=0.4) # Test 40% of those in quarantine with symptoms



Fix the dates


Ensure variables with large memory footprints get erased


Perform testing