Пример #1
0
    def test_time_map_in_ns(self):
        """Test for time_map_in_ns."""
        time_window = (0, 1000)
        breaks = [(100, 200)]
        dt = 1e-9

        haxis = layouts.time_map_in_ns(time_window=time_window,
                                       axis_breaks=breaks,
                                       dt=dt)

        self.assertListEqual(list(haxis.window), [0, 900])
        self.assertListEqual(list(haxis.axis_break_pos), [100])
        ref_axis_map = {
            0.0: '0',
            180.0: '280',
            360.0: '460',
            540.0: '640',
            720.0: '820',
            900.0: '1000'
        }
        self.assertDictEqual(haxis.axis_map, ref_axis_map)
        self.assertEqual(haxis.label, 'Time (ns)')
Пример #2
0
    def test_time_map_in_without_dt(self):
        """Test for time_map_in_ns when dt is not provided."""
        time_window = (0, 1000)
        breaks = [(100, 200)]
        dt = None

        haxis = layouts.time_map_in_ns(time_window=time_window,
                                       axis_breaks=breaks,
                                       dt=dt)

        self.assertListEqual(list(haxis.window), [0, 900])
        self.assertListEqual(list(haxis.axis_break_pos), [100])
        ref_axis_map = {
            0.0: '0',
            180.0: '280',
            360.0: '460',
            540.0: '640',
            720.0: '820',
            900.0: '1000'
        }
        self.assertDictEqual(haxis.axis_map, ref_axis_map)
        self.assertEqual(haxis.label, 'System cycle time (dt)')
    def test_time_map_in_ns(self):
        """Test for time_map_in_ns."""
        time_window = (0, 1000)
        breaks = [(100, 200)]
        dt = 1e-9

        haxis = layouts.time_map_in_ns(time_window=time_window,
                                       axis_breaks=breaks,
                                       dt=dt)

        self.assertListEqual(list(haxis.window), [0, 900])
        self.assertListEqual(list(haxis.axis_break_pos), [100])
        ref_axis_map = {
            0.0: "0",
            180.0: "280",
            360.0: "460",
            540.0: "640",
            720.0: "820",
            900.0: "1000",
        }
        self.assertDictEqual(haxis.axis_map, ref_axis_map)
        self.assertEqual(haxis.label, "Time (ns)")