convert to sim
@@ -5,51 +5,47 @@ Saved file originally generated by checking out Covasim v1.7.0 (with this file
not checked in) and running:
import test_regression as tr
- tr.make_msim(do_save=True)
+ tr.make_sim(do_save=True)
'''
import sciris as sc
import covasim as cv
pop_size = 500
-beta1 = 0.01
-beta2 = 0.02
-filename = 'example_regression.msim'
+beta = 0.01
+filename = 'example_regression.sim'
version = '1.7.0'
-def make_msim(do_save=False):
+def make_sim(do_save=False):
# Shared settings
- kwargs = dict(pop_size=pop_size, verbose=0)
+ pars = dict(pop_size=pop_size, beta=beta, verbose=0)
# Versioning was introduced in 2.0
if cv.check_version('2.0.0', verbose=False) >= 0:
- kwargs.update({'version':version})
+ pars.update({'version':version})
- sim1 = cv.Sim(label='Sim 1', beta=beta1, **kwargs)
- sim2 = cv.Sim(label='Sim 2', beta=beta2, **kwargs)
- msim = cv.MultiSim(sims=[sim1, sim2])
- msim.run()
- msim.reduce()
+ sim = cv.Sim(**pars)
+ sim.run()
if do_save:
- print(msim.base_sim.summary)
- msim.save(filename)
+ print(sim.summary)
+ sim.save(filename)
- return msim
+ return sim
def test_migration_regression():
sc.heading('Testing migration and regression...')
- msim1 = cv.MultiSim.load(filename)
- msim2 = make_msim()
+ sim1 = cv.MultiSim.load(filename)
+ sim2 = make_sim()
# Check that they match
- cv.diff_sims(msim1.base_sim, msim2.base_sim, die=True)
+ cv.diff_sims(sim1, sim2, die=True)
- return msim1,msim2
+ return sim1, sim2
@@ -59,7 +55,7 @@ if __name__ == '__main__':
# Start timing and optionally enable interactive plotting
T = sc.tic()
- msim1,msim2 = test_migration_regression()
+ sim1, sim2 = test_migration_regression()
sc.toc(T)
print('Done.')
\ No newline at end of file
