def _waveform_loader(self, program: Union[pulse.Waveform, pulse.ParametricPulse]): """Load Waveform instance. This function is sub-routine of py:method:`load_program`. Args: program: `Waveform` to draw. """ chart = Chart(parent=self) # add waveform data fake_inst = pulse.Play(program, types.WaveformChannel()) inst_data = types.PulseInstruction( t0=0, dt=self.device.dt, frame=types.PhaseFreqTuple(phase=0, freq=0), inst=fake_inst, is_opaque=program.is_parameterized()) for gen in self.generator['waveform']: obj_generator = partial(gen, formatter=self.formatter, device=self.device) for data in obj_generator(inst_data): chart.add_data(data) self.charts.append(chart)
def create_instruction(inst, phase, freq, t0, dt, is_opaque=False): """A helper function to create InstructionTuple.""" frame_info = types.PhaseFreqTuple(phase=phase, freq=freq) return types.PulseInstruction(t0=t0, dt=dt, frame=frame_info, inst=inst, is_opaque=is_opaque)