def test_parsing_defwaveform(): parse_equals("DEFWAVEFORM foo:\n" " 1.0, 1.0, 1.0\n", DefWaveform("foo", [], [1.0, 1.0, 1.0])) parse_equals( "DEFWAVEFORM foo:\n" " 1.0+2.0*i, 1.0-2.0*i, 3.0\n", DefWaveform("foo", [], [1 + 2j, 1 - 2j, 3 + 0j]), ) parse_equals( "DEFWAVEFORM foo(%theta):\n" " 1.0+2.0*i, 1.0-2.0*i, 3.0*%theta\n", DefWaveform("foo", [Parameter("theta")], [1 + 2j, 1 - 2j, Mul(3.0, Parameter("theta"))]), ) parse_equals( "DEFWAVEFORM q0_ro_rx/filter:\n 1.0, 1.0, 1.0", DefWaveform("q0_ro_rx/filter", [], [1.0, 1.0, 1.0]), )
def def_waveform(self, name, params, matrix): return DefWaveform(name, params, matrix[0])