/usr/lib/python3/dist-packages/csb/test/cases/statistics/ars.py is in python3-csb 1.2.2+dfsg-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import numpy
import csb.test as test
from csb.statistics.ars import ARS, Gauss
@test.functional
class TestARS(test.Case):
def testNormal(self):
mu = 5.
sigma = 1.
ars = ARS(Gauss(mu, sigma))
ars.initialize([mu - 1., mu + 1.1], z0=-10., zmax=30)
samples = numpy.array([ars.sample() for i in range(10000)])
self.assertAlmostEqual(mu, numpy.mean(samples), delta=0.5)
self.assertAlmostEqual(sigma, numpy.std(samples), delta=0.5)
if __name__ == '__main__':
test.Console()
|