示例#1
0
    def test_stationary_profile_is_two_points(self):
        # Create the two points the same as each other
        position = {"sample_y": 1.0, "sample_x": 1.5}
        point = Point()
        point.lower = position
        point.positions = position
        point.upper = position
        point.duration = 0.1

        # Turnaround interval on P99
        min_turnaround = 0.002
        min_interval = 0.002

        time_arrays, velocity_arrays = profile_between_points(
            self.axis_mapping,
            point,
            point,
            min_time=min_turnaround,
            min_interval=min_interval,
        )

        expected_time_arrays = {
            "sample_x": [0.0, 0.002],
            "sample_y": [0.0, 0.002],
        }
        expected_velocity_arrays = {
            "sample_x": [0.0, 0.0],
            "sample_y": [0.0, 0.0],
        }
        self.assertEqual(time_arrays, expected_time_arrays)
        self.assertEqual(velocity_arrays, expected_velocity_arrays)
示例#2
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
示例#3
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"])
示例#4
0
    def test_approximately_stationary_axis_results_in_2_profile_points(self):
        # The stationary point which causes a problem on P99 testing
        position = {"sample_y": 1.0000000000000888, "sample_x": 1.5}
        point = Point()
        point.lower = position
        point.positions = position
        point.upper = position
        point.duration = 0.1

        next_position = {"sample_y": 1.0000000000000666, "sample_x": 1.0}
        next_point = Point()
        next_point.lower = next_position
        next_point.positions = next_position
        next_point.upper = next_position
        next_point.duration = 0.1

        # Turnaround interval on P99
        min_turnaround = 0.002
        min_interval = 0.002

        time_arrays, velocity_arrays = profile_between_points(
            self.axis_mapping,
            point,
            next_point,
            min_time=min_turnaround,
            min_interval=min_interval,
        )

        expected_time_arrays = {
            "sample_x": [0.0, 0.1, 0.284, 0.384],
            "sample_y": [0.0, 0.384],
        }
        expected_velocity_arrays = {
            "sample_x": [0.0, -1.760563380282, -1.760563380282, 0.0],
            "sample_y": [0, 0],
        }
        self.assertEqual(time_arrays, expected_time_arrays)
        self.assertEqual(velocity_arrays, expected_velocity_arrays)