Example #1
0
    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)
Example #2
0
 def test_num_comms(self):
     M = bm.get_model(self.model_name, p_in=.5, p_out=0)
     assert_equal(len(M.comms(0)),   4)
     assert_equal(len(M.comms(25)),  4)
     assert_equal(len(M.comms(50)),  3)
     assert_equal(len(M.comms(85)),  4)
     assert_equal(len(M.comms(100)), 4)
Example #3
0
 def test_num_comms(self):
     M = bm.get_model(self.model_name, p_in=.5, p_out=0)
     assert_equal(len(M.comms(0)), 4)
     assert_equal(len(M.comms(25)), 4)
     assert_equal(len(M.comms(50)), 3)
     assert_equal(len(M.comms(85)), 4)
     assert_equal(len(M.comms(100)), 4)
Example #4
0
 def test_ccs(self):
     M = bm.get_model(self.model_name, p_in=.5, p_out=0)
     g = M.t(0)
     assert_compnents(g, 4)
     g = M.t(50)
     assert_compnents(g, 3)
     g = M.t(25)
     assert_compnents(g, 3)
Example #5
0
 def test_Gnm(self):
     M = bm.get_model(self.model_name,
                      p_in=.5,
                      p_out=.5,
                      opts=dict(Gnm=True))
     edges = M.t(0).number_of_edges()
     expected_edges = 128 * 127 / 2 * .5
     assert_almost_equals(edges, expected_edges, delta=5)
Example #6
0
    def test_ccs(self):
        M = bm.get_model(self.model_name, p_in=.5, p_out=0)
        g = M.t(0)
        assert_compnents(g, getattr(self, 'n_ccs', 4))

        g = M.t(50)
        assert_compnents(g, getattr(self, 'n_ccs', 4))

        g = M.t(25)
        assert_compnents(g, getattr(self, 'n_ccs_off', 4))
Example #7
0
    def test_ccs(self):
        M = bm.get_model(self.model_name, p_in=.5, p_out=0)
        g = M.t(0)
        assert_compnents(g, getattr(self, 'n_ccs', 4))

        g = M.t(50)
        assert_compnents(g, getattr(self, 'n_ccs', 4))

        g = M.t(25)
        assert_compnents(g, getattr(self, 'n_ccs_off', 4))
Example #8
0
    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)
Example #9
0
def test_all_managed():
    assert_all_managed(bm.get_model('StdGrow'))
    assert_all_managed(bm.get_model('StdMerge'))
    assert_all_managed(bm.get_model('StdMixed'))

    assert_all_managed(bm.get_model('StdGrow', q=8))
    assert_all_managed(bm.get_model('StdMerge', q=8))
    assert_all_managed(bm.get_model('StdMixed', q=8))
Example #10
0
def test_all_managed():
    assert_all_managed(bm.get_model('StdGrow' ))
    assert_all_managed(bm.get_model('StdMerge'))
    assert_all_managed(bm.get_model('StdMixed'))

    assert_all_managed(bm.get_model('StdGrow' , q=8))
    assert_all_managed(bm.get_model('StdMerge', q=8))
    assert_all_managed(bm.get_model('StdMixed', q=8))
Example #11
0
 def getM():
     return bm.get_model(self.model_name, p_in='k=15', p_out='ktot=45')
Example #12
0
 def getM():
     return bm.get_model(self.model_name, p_in=.6, p_out=.6)
Example #13
0
 def getM():
     return bm.get_model(self.model_name, p_in='k=15', p_out='ktot=45')
Example #14
0
 def test_ccs(self):
     M = bm.get_model(self.model_name, p_in=.5, p_out=0)
     g = M.t(0);   assert_compnents(g, 4)
     g = M.t(50);  assert_compnents(g, 3)
     g = M.t(25);  assert_compnents(g, 3)
Example #15
0
 def getM():
     return bm.get_model(self.model_name, p_in='k=20', p_out='k=5')
Example #16
0
 def test_Gnm(self):
     M = bm.get_model(self.model_name, p_in=.5, p_out=.5,
                      opts=dict(Gnm=True))
     edges = M.t(0).number_of_edges()
     expected_edges = 128*127 / 2 * .5
     assert_almost_equals(edges, expected_edges, delta=5)
Example #17
0
 def getM():
     return bm.get_model(self.model_name, p_in='k=20', p_out='k=5')
Example #18
0
 def test_size(self):
     M = bm.get_model(self.model_name)
     assert len(M.t(0)) == 128
Example #19
0
 def test_all_managed(self):
     assert_all_managed(bm.get_model(self.model_name))
     assert_all_managed(bm.get_model(self.model_name, q=8))
     assert_all_managed(bm.get_model(self.model_name, p_in=.5, p_out=.5))
Example #20
0
 def test_all_managed(self):
     assert_all_managed(bm.get_model(self.model_name))
     assert_all_managed(bm.get_model(self.model_name, q=8))
     assert_all_managed(bm.get_model(self.model_name, p_in=.5, p_out=.5))
Example #21
0
 def test_size(self):
     M = bm.get_model(self.model_name)
     assert len(M.t(0)) == 128
Example #22
0
 def getM():
     return bm.get_model(self.model_name, p_in=.6, p_out=.6)