simplified load test works
+'''
+Confirm that two populations generated and saved with the same seed match,
+and otherwise don't.
+'''
+
import covasim as cv
import numpy as np
import sciris as sc
@@ -5,7 +10,7 @@ import sciris as sc
T = sc.tic()
seeds = [55, 66]
-pop_type = 'synthpops'
+pop_type = ['random', 'hybrid', 'synthpops'][1]
pars = dict(
pop_type = pop_type,
@@ -15,15 +20,13 @@ pars = dict(
lkmap = {'random':'a', 'hybrid':'w', 'synthpops':'w'}
lkey = lkmap[pop_type]
-np.random.seed(seeds[0])
s1 = cv.Sim(pars, popfile='p1.pop', save_pop=True, rand_seed=seeds[0], label='p1')
-s1.initialize()
-np.random.seed(seeds[0])
s1b = cv.Sim(pars, popfile='p1b.pop', save_pop=True, rand_seed=seeds[0], label='p1b')
-s1b.initialize()
-np.random.seed(seeds[1])
s2 = cv.Sim(pars, popfile='p2.pop', save_pop=True, rand_seed=seeds[1], label='p2')
+s1.initialize()
+s1b.initialize()
s2.initialize()
+
s1c = cv.Sim(pars, popfile='p1.pop', load_pop=True, rand_seed=seeds[0], label='p1c')
s1c.initialize()
@@ -40,11 +43,8 @@ for key in s1.people.keys():
s1.initialize()
s1.run(verbose=0)
-s1b.initialize()
s1b.run(verbose=0)
-s2.initialize()
s2.run(verbose=0)
-s1c.initialize()
s1c.run(verbose=0)
assert s1.summary == s1b.summary
