def test_parametrized_frame_change(self): """Test generating waveforms that are parameterized. Parametrized phase should be ignored when calculating waveform frame. This is due to phase modulated representation of waveforms, i.e. we cannot calculate the phase factor of waveform if the phase is unbound. """ param = circuit.Parameter('phase') test_fc1 = pulse.ShiftPhase(param, pulse.DriveChannel(0)) test_fc2 = pulse.ShiftPhase(1.57, pulse.DriveChannel(0)) test_waveform = pulse.Play(pulse.Constant(10, 0.1), pulse.DriveChannel(0)) ch_events = events.ChannelEvents(waveforms={0: test_waveform}, frames={0: [test_fc1, test_fc2]}, channel=pulse.DriveChannel(0)) # waveform frame pulse_inst = list(ch_events.get_waveforms())[0] self.assertFalse(pulse_inst.is_opaque) self.assertEqual(pulse_inst.frame.phase, 1.57) # framechange pulse_inst = list(ch_events.get_frame_changes())[0] self.assertTrue(pulse_inst.is_opaque) self.assertEqual(pulse_inst.frame.phase, param + 1.57)
def test_parameterized_parametric_pulse(self): """Test generating waveforms that are parameterized.""" param = circuit.Parameter('amp') test_waveform = pulse.Play(pulse.Constant(10, param), pulse.DriveChannel(0)) ch_events = events.ChannelEvents(waveforms={0: test_waveform}, frames={}, channel=pulse.DriveChannel(0)) pulse_inst = list(ch_events.get_waveforms())[0] self.assertTrue(pulse_inst.is_opaque) self.assertEqual(pulse_inst.inst, test_waveform)