def testFitPowerLaw(self): alpha = 2.7 xmin = 1.0 exponent = (1/(alpha)) numPoints = 15000 x = numpy.random.rand(numPoints)**-exponent x = x[x>=1] alpha2 = Util.fitPowerLaw(x, xmin) self.assertAlmostEquals(alpha, alpha2, places=1)
def testFitPowerLaw(self): alpha = 2.7 xmin = 1.0 exponent = (1 / (alpha)) numPoints = 15000 x = numpy.random.rand(numPoints)**-exponent x = x[x >= 1] alpha2 = Util.fitPowerLaw(x, xmin) self.assertAlmostEquals(alpha, alpha2, places=1)