make test more general purpose
'''
-Check regression against Covasim verson 1.6.1.
+Check regression, specifically of testing and tracing interventions, against
+earlier versions of Covasim verson.
Instructions:
1. Copy to a new file (since this file will disappear when you check out the other branch)
- 2. Check out Covasim version 1.6.1
+ 2. Set 'old' and 'new' version labels
+ 2. Check out an earlier Covasim version (e.g. git checkout v1.6.1)
3. Run
- 4. Check out Covasim version 1.7.2
+ 4. Check out Covasim a later version (e.g. git checkout v1.6.1 or git checkout master)
5. Run
-There should be a change in test_num but not in test_prob.
+At least between 1.6.1 and 1.7.2, should be a change in test_num but not in test_prob.
'''
import sciris as sc
import covasim as cv
+
+# Modify these to compare different versions
+vers = sc.objdict({
+ 'old':'1.6.1',
+ 'new':'1.7.2',
+ })
+
# Setup -- exact values don't really matter
n_runs = 5
@@ -42,16 +51,16 @@ for label,ti in {'test_num':tn, 'test_prob':tp}.items():
m1.run(n_runs=n_runs)
m1.reduce()
- ver161fn = f'intervention_regression_{label}_1.6.1.msim'
- if ver == '1.6.1':
- m1.save(filename=ver161fn)
- print(f'Multisim saved as {ver161fn}')
- elif ver == '1.7.2':
- m0 = cv.load(ver161fn)
+ old_fn = f'intervention_regression_{label}_1.6.1.msim'
+ if ver == vers.old:
+ m1.save(filename=old_fn)
+ print(f'Multisim saved as {old_fn}')
+ elif ver == vers.new:
+ m0 = cv.load(old_fn)
msim = cv.MultiSim.merge([m0, m1], base=True)
fig = msim.plot(to_plot='overview')
cv.maximize()
else:
- raise NotImplementedError(f'This test is designed for comparing versions 1.6.1 and 1.7.2, not {ver} ')
+ raise NotImplementedError(f'You have asked to compare versions {vers.old} and {vers.new}, but Covasim is version {ver}')
