def test_det_limit(self): Mnd = bm.get_model(self.model_name, p_in=.5, p_out=0, opts=dict(no_det_limit=True)) Md = bm.get_model(self.model_name, p_in=.5, p_out=0, opts=dict(no_det_limit=False)) # Test the command line no-det-limit option works. argv = [ bm.__file__, self.model_name, '/nonexistant', # outdir '--graph-format=null', '--comm-format=null' ] Mnd2, args = bm.main_argv(argv=argv + ['--no-det-limit']) # Default shourd be detectability limit. Md2, args = bm.main_argv(argv=argv) assert_equal(len(Mnd.comms(0)), 3) assert_equal(len(Mnd.comms(1)), 4) assert_equal(len(Md.comms(0)), 3) assert_equal(len(Md.comms(1)), 3) assert_equal(len(Mnd2.comms(0)), 3) assert_equal(len(Mnd2.comms(1)), 4) assert_equal(len(Md2.comms(0)), 3) assert_equal(len(Md2.comms(1)), 3)
def test_seed(self): """Test that seeding does """ argv = [bm.__file__, self.model_name, '--p_in=.5', '--p_out=.1'] import random random.seed(10) M1a, args = bm.main_argv(argv=argv + ['--seed=51']) random.seed(10) M2, args = bm.main_argv(argv=argv + ['--seed=965']) random.seed(10) M1b, args = bm.main_argv(argv=argv + ['--seed=51']) def edgeset(g): print len(g), g.number_of_edges() return set(frozenset((a, b)) for a, b in g.edges_iter()) assert_equal(edgeset(M1a.t(5)), edgeset(M1b.t(5)))
def test_seed(self): """Test that seeding does """ argv = [bm.__file__, self.model_name, '--p_in=.5', '--p_out=.1'] import random random.seed(10) M1a, args = bm.main_argv(argv=argv+['--seed=51']) random.seed(10) M2, args = bm.main_argv(argv=argv+['--seed=965']) random.seed(10) M1b, args = bm.main_argv(argv=argv+['--seed=51']) def edgeset(g): print len(g), g.number_of_edges() return set(frozenset((a, b)) for a,b in g.edges_iter()) assert_equal( edgeset(M1a.t(5)), edgeset(M1b.t(5)))
def test_det_limit(self): Mnd = bm.get_model(self.model_name, p_in=.5, p_out=0, opts=dict(no_det_limit=True)) Md = bm.get_model(self.model_name, p_in=.5, p_out=0, opts=dict(no_det_limit=False)) # Test the command line no-det-limit option works. argv = [bm.__file__, self.model_name, '/nonexistant', # outdir '--graph-format=null','--comm-format=null'] Mnd2, args = bm.main_argv(argv=argv+['--no-det-limit']) # Default shourd be detectability limit. Md2, args = bm.main_argv(argv=argv) assert_equal(len(Mnd.comms(0)), 3) assert_equal(len(Mnd.comms(1)), 4) assert_equal(len(Md.comms(0)), 3) assert_equal(len(Md.comms(1)), 3) assert_equal(len(Mnd2.comms(0)), 3) assert_equal(len(Mnd2.comms(1)), 4) assert_equal(len(Md2.comms(0)), 3) assert_equal(len(Md2.comms(1)), 3)
def getM(): return bm.main_argv( ['X', self.model_name, '--k_in=%d' % k, '--k_out_tot=60'])[0]
def getM(): return bm.main_argv(['X', self.model_name, '--k_in=%d'%k, '--k_out_tot=60'])[0]