Exemplo n.º 1
0
        def testAnswerServer(self):
            # Create a uniform random field
            g = Guesser("map_filter_test", self.ms.nPoints, (0.0, 0.0, 2*math.pi),
                        "location", (10,10,1))
            g.uniform([[-5.0,5.0],[-5.0,5.0],[0.0,3.0]])

            # Compose a guess request
            greq = GuessRequest()
            greq.points = g.outPoints()
            greq.pers = (0.0, 0.0, 2*math.pi)
            greq.data_type = "location"

            gresp = self.ms.answer_server(greq)
            parray = np.array([p.point for p in gresp.outPoints])

            # There should be no points left where the mapData array was 1.0
            xmax = False ; ymin = False ; xyint = False

            mx = map(max, parray.transpose())
            self.assertTrue(mx[0] < 2.5 and mx[1] < 2.5)
            mn = map(min, parray.transpose())
            self.assertTrue(mn[0] > -3.5 and mn[1] > -3.5)

            cornerTest = False
            npts = parray.shape[0]
            for i in range(npts):
                if parray[i][0] > 0.25 and \
                        parray[i][1] < -0.5:
                    cornerTest = True
            self.assertFalse(cornerTest)  
Exemplo n.º 2
0
        def testAnswerServer(self):
            # Create a uniform random field
            g = Guesser("map_filter_test", self.ms.nPoints,
                        (0.0, 0.0, 2 * math.pi), "location", (10, 10, 1))
            g.uniform([[-5.0, 5.0], [-5.0, 5.0], [0.0, 3.0]])

            # Compose a guess request
            greq = GuessRequest()
            greq.points = g.outPoints()
            greq.pers = (0.0, 0.0, 2 * math.pi)
            greq.data_type = "location"

            gresp = self.ms.answer_server(greq)
            parray = np.array([p.point for p in gresp.outPoints])

            # There should be no points left where the mapData array was 1.0
            xmax = False
            ymin = False
            xyint = False

            mx = map(max, parray.transpose())
            self.assertTrue(mx[0] < 2.5 and mx[1] < 2.5)
            mn = map(min, parray.transpose())
            self.assertTrue(mn[0] > -3.5 and mn[1] > -3.5)

            cornerTest = False
            npts = parray.shape[0]
            for i in range(npts):
                if parray[i][0] > 0.25 and \
                        parray[i][1] < -0.5:
                    cornerTest = True
            self.assertFalse(cornerTest)