Ejemplo n.º 1
0
 def test_prof_both(self):
     with nostdout():
         profile_func(sum_inv, [100], {"start":10})
Ejemplo n.º 2
0
 def test_prof_args(self):
     with nostdout():
         profile_func(sum_inv, [100])
Ejemplo n.º 3
0
 def test_prof_kwargs(self):
     with nostdout():
         profile_func(sum_inv, [], {"N":100, "start":10})
Ejemplo n.º 4
0
 def test_prof_noargs(self):
     with nostdout():
         profile_func(sum_inv)
Ejemplo n.º 5
0
def main():
    args = parsecml()
    func = _GENERATOR_CHOICES[args.generator]
    profile_func(func)
    return
Ejemplo n.º 6
0
def main():
    args = parsecml()
    func = _GENERATOR_CHOICES[args.generator]
    profile_func(func)
    return
Ejemplo n.º 7
0
        # use large window as error esitmate too small for MCMC
        delta = 0.1
        # compare mean results
        for x, err, expected in zip(mean.eval(), mean.err(), mu):
            self.assertAlmostEquals(x, expected, delta=delta * expected)
        # compare stddev results
        for x, err, expected in zip(stddev.eval(), stddev.err(), sigma):
            self.assertAlmostEquals(x, expected, delta=delta * expected)
        # compare covariance results
        covval = cov.eval()
        coverr = cov.err()
        for ii, jj in itertools.product(xrange(len(expectedcov)), repeat=2):
            self.assertAlmostEquals(
                covval[ii, jj],
                expectedcov[ii, jj],
                delta=delta * max(expectedcov[ii, ii], expectedcov[jj, jj]))
        return


def main():
    unittest.main()
    #test = TestMcMc("test_gaussian")
    #test.setUp()
    #test.test_gaussian()
    return


if __name__ == "__main__":
    from simplot.profile import profile_func
    profile_func(main)
Ejemplo n.º 8
0
            toymc() # burn in
        def func(toymc=toymc):
            ret = toymc()
            return ret[0]
        calculate_statistics(func, statistics, npe)
        # use large window as error esitmate too small for MCMC
        delta = 0.1
        # compare mean results
        for x, err, expected in zip(mean.eval(), mean.err(), mu):
            self.assertAlmostEquals(x, expected, delta=delta*expected) 
        # compare stddev results
        for x, err, expected in zip(stddev.eval(), stddev.err(), sigma):
            self.assertAlmostEquals(x, expected, delta=delta*expected)
        # compare covariance results
        covval = cov.eval()
        coverr = cov.err()
        for ii, jj in itertools.product(xrange(len(expectedcov)), repeat=2):
            self.assertAlmostEquals(covval[ii,jj], expectedcov[ii,jj], delta=delta*max(expectedcov[ii,ii], expectedcov[jj, jj]))
        return 

def main():
    unittest.main()
    #test = TestMcMc("test_gaussian")
    #test.setUp()
    #test.test_gaussian()
    return

if __name__ == "__main__":
    from simplot.profile import profile_func
    profile_func(main)