コード例 #1
0
 def point_gen():
     for n in range_(10):
         p = Point()
         p.indexes = [n]
         p.positions = {"x": n / 10.}
         p.lower = {"x": (n - 0.5) / 10.}
         p.upper = {"x": (n + 0.5) / 10.}
         yield p
コード例 #2
0
    def iterator(self):
        for i in range_(self.num):
            p = Point()
            p.positions[self.names[0]], p.positions[self.names[1]] = self._calc(i)
            p.lower[self.names[0]], p.lower[self.names[1]] = self._calc(i - 0.5)
            p.upper[self.names[0]], p.upper[self.names[1]] = self._calc(i + 0.5)
            p.indexes = [i]

            yield p
コード例 #3
0
    def iterator(self):

        for i in range_(self.num):
            point = Point()

            for axis_index in range_(self.num_axes):
                point.positions[self.name[axis_index]] = self._calc(i, axis_index)
                point.lower[self.name[axis_index]] = self._calc(i - 0.5, axis_index)
                point.upper[self.name[axis_index]] = self._calc(i + 0.5, axis_index)

            point.indexes = [i]
            yield point
コード例 #4
0
 def test_consistent_python_jython(self):
     p = Point()
     p.indexes = [0]
     p.positions = {"x": 1, "y": 2}
     p.lower = {"x": 0.5, "y": 1.75}
     p.upper = {"x": 1.5, "y": 2.25}
     m = RandomOffsetMutator(1, ["y"], [0.01])
     q = m.mutate(p, 0)
     # Generated with Python 3.7.3, but should be consistent with all Python/Jython
     self.assertAlmostEqual(2.00454337, q.positions["y"])
     self.assertAlmostEqual(2.25045721, q.upper["y"])
     self.assertAlmostEqual(1.74735178, q.lower["y"])
コード例 #5
0
    def iterator(self):
        for i in range_(self.num):
            p = Point()
            p.positions[self.names[0]], p.positions[
                self.names[1]] = self._calc(i)
            p.lower[self.names[0]], p.lower[self.names[1]] = self._calc(i -
                                                                        0.5)
            p.upper[self.names[0]], p.upper[self.names[1]] = self._calc(i +
                                                                        0.5)
            p.indexes = [i]

            yield p
コード例 #6
0
    def iterator(self):
        for i in range_(0, self._end_point(self.radius) + 1):
            p = Point()
            p.indexes = [i]

            i += 0.5  # Offset so lower bound of first point is not less than 0

            p.positions[self.names[0]], p.positions[self.names[1]] = self._calc(i)
            p.upper[self.names[0]], p.upper[self.names[1]] = self._calc(i + 0.5)
            p.lower[self.names[0]], p.lower[self.names[1]] = self._calc(i - 0.5)

            yield p
コード例 #7
0
    def iterator(self):
        for i in range_(0, self._end_point(self.radius) + 1):
            p = Point()
            p.indexes = [i]

            i += 0.5  # Offset so lower bound of first point is not less than 0

            p.positions[self.names[0]], p.positions[
                self.names[1]] = self._calc(i)
            p.upper[self.names[0]], p.upper[self.names[1]] = self._calc(i +
                                                                        0.5)
            p.lower[self.names[0]], p.lower[self.names[1]] = self._calc(i -
                                                                        0.5)

            yield p
コード例 #8
0
    def iterator(self):

        for i in range_(self.num):
            point = Point()

            for axis_index in range_(self.num_axes):
                axis_name = self.name[axis_index]
                start = self.start[axis_index]
                step = self.step[axis_index]

                point.positions[axis_name] = start + i * step
                point.lower[axis_name] = start + (i - 0.5) * step
                point.upper[axis_name] = start + (i + 0.5) * step

            point.indexes = [i]
            yield point
コード例 #9
0
    def iterator(self):

        for i in range_(self.num):
            point = Point()

            for axis_index in range_(self.num_axes):
                axis_name = self.name[axis_index]
                start = self.start[axis_index]
                step = self.step[axis_index]

                point.positions[axis_name] = start + i * step
                point.lower[axis_name] = start + (i - 0.5) * step
                point.upper[axis_name] = start + (i + 0.5) * step

            point.indexes = [i]
            yield point
コード例 #10
0
    def iterator(self):

        for i in range_(self.num):

            point = Point()
            for axis, coordinate in enumerate(self.points[i]):
                point.positions[self.name[axis]] = coordinate

                if self.upper_bounds is None:
                    upper = self._calculate_upper_bound(i, axis, coordinate)
                else:
                    upper = self.upper_bounds[i][axis]
                point.upper[self.name[axis]] = upper

                if self.lower_bounds is None:
                    lower = self._calculate_lower_bound(i, axis, coordinate)
                else:
                    lower = self.lower_bounds[i][axis]
                point.lower[self.name[axis]] = lower

            point.indexes = [i]
            yield point
コード例 #11
0
    def iterator(self):

        for i in range_(self.num):

            point = Point()
            for axis, coordinate in enumerate(self.points[i]):
                point.positions[self.name[axis]] = coordinate

                if self.upper_bounds is None:
                    upper = self._calculate_upper_bound(i, axis, coordinate)
                else:
                    upper = self.upper_bounds[i][axis]
                point.upper[self.name[axis]] = upper

                if self.lower_bounds is None:
                    lower = self._calculate_lower_bound(i, axis, coordinate)
                else:
                    lower = self.lower_bounds[i][axis]
                point.lower[self.name[axis]] = lower

            point.indexes = [i]
            yield point