Пример #1
0
    def test_visible(self):
        """Test pulse truncation."""
        fake_canvas = core.DrawerCanvas(stylesheet=self.style,
                                        device=self.device)
        fake_canvas.disable_chans = {pulse.DriveChannel(0)}
        fake_canvas.disable_types = {types.WaveformType.REAL}

        chart = core.Chart(parent=fake_canvas)

        test_data = drawings.ElementaryData(
            data_type=types.WaveformType.REAL,
            xvals=np.array([0]),
            yvals=np.array([0]),
            channels=[pulse.DriveChannel(0)],
        )
        self.assertFalse(chart._check_visible(test_data))

        test_data = drawings.ElementaryData(
            data_type=types.WaveformType.IMAG,
            xvals=np.array([0]),
            yvals=np.array([0]),
            channels=[pulse.DriveChannel(0)],
        )
        self.assertFalse(chart._check_visible(test_data))

        test_data = drawings.ElementaryData(
            data_type=types.WaveformType.IMAG,
            xvals=np.array([0]),
            yvals=np.array([0]),
            channels=[pulse.DriveChannel(1)],
        )
        self.assertTrue(chart._check_visible(test_data))
Пример #2
0
 def generate_dummy_obj(self, data: types.PulseInstruction, **kwargs):
     dummy_obj = drawings.ElementaryData(data_type='test',
                                         xvals=np.arange(
                                             data.inst.pulse.duration),
                                         yvals=data.inst.pulse.samples,
                                         channels=[data.inst.channel])
     return [dummy_obj]