def getPoissonGap(params): dimensions = params['dimensions'] if len(dimensions) != 1: raise ValueError("poisson gap algorithm only implemented for one dimension") dim1 = dimensions[0] low,high = dim1['range'] numGeneratedPoints = params['numGeneratedPoints'] return pg.getGenerator(low, high, numGeneratedPoints)
def getPoissonGap(params): dimensions = params['dimensions'] if len(dimensions) != 1: raise ValueError( "poisson gap algorithm only implemented for one dimension") dim1 = dimensions[0] low, high = dim1['range'] numGeneratedPoints = params['numGeneratedPoints'] return pg.getGenerator(low, high, numGeneratedPoints)
def testTooManyPoints(self): (low, high) = 1, 100 points = pg.getGenerator(low, high, 500)() self.assertEqual(len(points), 500, "incorrect number of points generated")
def testBoundsBig(self): (low, high) = 1, 10000 points = pg.getGenerator(low, high, 283)() myBool = all([c[0] >= low and c[0] <= high for c in points]) self.assertTrue(myBool, "points not within boundaries -- bigger example")
def setUp(self): self.low = -4 self.high = 51 self.numPoints = 34 gen = pg.getGenerator(self.low, self.high, self.numPoints) self.points = gen()