def detuning(self, name = 'detuning_pulse', length = 0, waiting_time = 0, refpulse = None, refpoint = 'end', **kw): AMP_C = kw.pop('amplitude_control', self.detuning_amplitude_C) AMP_T = kw.pop('amplitude_target', self.detuning_amplitude_T) voltage_pulse_C = SquarePulse(channel = self.channel_VP1, name = '%s_detuning_pulse_C'%self.name, amplitude = AMP_C, length = length, refpulse = refpulse) voltage_pulse_T = SquarePulse(channel = self.channel_VP2, name = '%s_detuning_pulse_T'%self.name, amplitude = AMP_T, length = length, refpulse = refpulse) detuning_pulse_C = { 'pulse': voltage_pulse_C, 'pulse_name': voltage_pulse_C.name, 'refpulse': None if refpulse == None else refpulse, 'refpoint': refpoint, 'waiting': waiting_time } detuning_pulse_T = { 'pulse': voltage_pulse_T, 'pulse_name': voltage_pulse_T.name, 'refpulse': '%s_detuning_pulse_C'%self.name, 'refpoint': 'start', 'waiting': 0 } self.pulses.append(detuning_pulse_C) self.pulses.append(detuning_pulse_T) return True
def _initialize_element(self, name, amplitudes=[], **kw): initialize = Element(name=name, pulsar=self.pulsar) for i in range(len(self.qubits)): refpulse = None if i == 0 else 'init1' initialize.add(SquarePulse(name='init', channel=self.channel_VP[i], amplitude=amplitudes[i], length=1e-6), name='init%d' % (i + 1), refpulse=refpulse, refpoint='start') initialize.add(SquarePulse(name='init_c1m2', channel=self.occupied_channel1, amplitude=2, length=1e-6), name='init%d_c1m2' % (i + 1), refpulse='init1', refpoint='start') initialize.add(SquarePulse(name='init_c5m2', channel=self.occupied_channel2, amplitude=2, length=1e-6), name='init%d_c5m2' % (i + 1), refpulse='init1', refpoint='start') return initialize
def XY_rotation(self, name, degree = 90, waiting_time = 0, refpulse = None, refpoint = 'end'): microwave_pulse_I = SquarePulse(channel = self.channel_I, name = '%s_microwave_pulse_I'%name, amplitude = np.cos(self.refphase), length = degree*self.Pi_pulse_length/180) microwave_pulse_Q = SquarePulse(channel = self.channel_Q, name = '%s_microwave_pulse_Q'%name, amplitude = np.sin(self.refphase), length = degree*self.Pi_pulse_length/180) component_I = { 'pulse': microwave_pulse_I, 'pulse_name': microwave_pulse_I.name, 'refpulse': refpulse, ## name of the refpulse 'refpoint': refpoint, 'waiting': waiting_time } component_Q = { 'pulse': microwave_pulse_Q, 'pulse_name': microwave_pulse_Q.name, 'refpulse': '%s_microwave_pulse_I'%name, 'refpoint': 'start', 'waiting': 0 } self.pulses.append(component_I) self.pulses.append(component_Q)
def initialize(num): initialize = Element('initialize%d' % num, pulsar=pulsar) initialize.add(SquarePulse(channel='ch%d' % plungerchannel, name='initialize_1', amplitude=initialize_amplitude, length=0.5e-6), name='initialize_1') initialize.add(SquarePulse( channel='ch%d' % plungerchannel, name='initialize_2', amplitude=0.5 * initialize_amplitude, length=0.5e-6, ), name='initialize_2', refpulse='initialize_1', refpoint='center') # initialize.add(CosPulse(channel = 'ch%d' % plungerchannel, name = 'initialize_3', frequency = 1e6, # amplitude = 0.5*initialize_amplitude, length =150e-6,), # name= 'initialize_3', refpulse = 'initialize_1', refpoint = 'end') elts.append(initialize) myseq.append( name='initialize%d' % num, wfname='initialize%d' % num, repetitions=350, trigger_wait=False, ) return initialize
def _manipulation_element(self, name, time, amplitudes = [], **kw): # waiting_time = kw.pop('waiting_time', None) # duration_time = kw.pop('duration_time', None) # frequency = kw.pop('frequency', None) # power = kw.pop('power', None) print('manip time:', time) parameter1 = kw.get('parameter1', None) parameter2 = kw.get('parameter2', None) manip_elem = kw.get('manip_elem', Element(name = name, pulsar = self.pulsar)) print(name) # manip = deepcopy(self.manip_elem) if manip_elem not in self.manipulation_elements: raise NameError('Manipulation Element [%s] not in Experiment.'%manip_elem) # manip = deepcopy(self.manipulation_elements[manip_elem]) # manip = Ramsey() manipulation = manip(name = name, qubits = self.qubits, pulsar = self.pulsar, **kw) # parameter1 = parameter1, parameter2 = parameter2,) # waiting_time = waiting_time, duration_time = duration_time, # frequency = frequency, power = power) manipulation.make_circuit(**kw) VP_start_point = -manip.VP_before # VP_end_point = manip.VP_after try: max_length = manipulation.ideal_length() except: wfs, tvals = manipulation.normalized_waveforms() max_length = max([len(tvals[ch]) for ch in tvals])/1e9 for i in range(len(self.qubits)): refpulse = None if i ==0 else 'manip1' start = VP_start_point if i ==0 else 0 time = max(time, max_length-VP_start_point)+100e-9 manipulation.add(SquarePulse(name='manip%d'%(i+1), channel=self.channel_VP[i], amplitude=amplitudes[i], length=time), name='manip%d'%(i+1), refpulse = refpulse, refpoint = 'start', start = start) manipulation.add(SquarePulse(name='manip_c1m2', channel=self.occupied_channel1, amplitude=0.1, length=time), name='manip%d_c1m2'%(i+1),refpulse = 'manip1', refpoint = 'start') manipulation.add(SquarePulse(name='manip_c5m2', channel=self.occupied_channel2, amplitude=2, length=time), name='manip%d_c5m2'%(i+1),refpulse = 'manip1', refpoint = 'start') manipulation.add(SquarePulse(name='manip_c1m2', channel='ch8_marker1', amplitude=2, length=time), name='mmanip%d_c1m2'%(i+1),refpulse = 'manip1', refpoint = 'start') manipulation.add(SquarePulse(name='manip_c5m2', channel='ch8_marker2', amplitude=2, length=time), name='mmanip%d_c5m2'%(i+1),refpulse = 'manip1', refpoint = 'start') return manipulation
def manipulation_element(self, name, time=0, amplitudes=[], **kw): manip = deepcopy(self.manip_elem) # manip = Ramsey(name=name, pulsar = self.pulsar) waiting_time = kw.pop('waiting_time', None) duration_time = kw.pop('duration_time', None) frequency = kw.pop('frequency', None) print(name) manipulation = manip(name=name, qubits=self.qubits, pulsar=self.pulsar, waiting_time=waiting_time, duration_time=duration_time, frequency=frequency) manipulation.make_circuit() for i in range(len(self.qubits)): refpulse = None if i == 0 else 'manip1' start = -500e-9 if i == 0 else 0 manipulation.add(SquarePulse(name='manip%d' % (i + 1), channel=self.channel_VP[i], amplitude=amplitudes[i], length=time), name='manip%d' % (i + 1), refpulse=refpulse, refpoint='start', start=start) return manipulation
def test_distorted_attribute(self): test_elt = element.Element('test_elt', pulsar=self.pulsar) self.assertTrue((len(test_elt._channels)) != 0) for ch, item in test_elt._channels.items(): self.assertFalse(item['distorted']) self.assertEqual(len(test_elt.distorted_wfs), 0) test_elt.add( SquarePulse(name='dummy_sqaure', channel='ch1', amplitude=.3, length=20e-9)) dist_dict = {'ch_list': ['ch1'], 'ch1': self.kernel_list} test_elt = fsqs.distort(test_elt, dist_dict) self.assertEqual(len(test_elt.distorted_wfs), 1) for ch, item in test_elt._channels.items(): if ch == 'ch1': self.assertTrue(item['distorted']) self.assertTrue(ch in test_elt.distorted_wfs.keys()) else: self.assertFalse(item['distorted'])
def test_timing(self): test_elt = element.Element('test_elt', pulsar=self.pulsar) refpulse = SquarePulse(name='dummy_square', channel='ch1', amplitude=0, length=20e-9) test_elt.add(refpulse, start=100e-9, name='dummy_square') test_elt.add(SquarePulse(name='dummy_square', channel='ch1', amplitude=.3, length=20e-9), refpulse='dummy_square', start=100e-9, refpoint='start') min_samples = 960 ch1_wf = test_elt.waveforms()[1]['ch1'] self.assertEqual(len(ch1_wf), min_samples) expected_wf = np.zeros(960) expected_wf[100:120] = .3 np.testing.assert_array_almost_equal(ch1_wf, expected_wf)
def Elzerman(self, qubit): self.channel = qubit.plunger_gate['channel_VP'] self.add(SquarePulse(name='Elzerman', channel=self.channel, amplitude=0.03, length=10e-6), name='Elzerman') return True
def Pauli_Blockade(self, qubit): self.channel = qubit.plunger_gate['channel_VP'] self.add(SquarePulse(name='Pauli_Blockade', channel=self.channel, amplitude=0.03, length=10e-6), name='Pauli_Blockade') return True
def fast_relax(self, qubit): self.channel = qubit.plunger_gate['channel_VP'] self.add(SquarePulse(name='Initialize', channel='ch1', amplitude=0.05, length=5e-6), name='Initialize') return True
def Prep_Read(self, qubit): self.channel = qubit.plunger_gate['channel_VP'] self.add(SquarePulse(name='Prep_Read', channel=self.channel, amplitude=0.03, length=10e-6), name='Prep_Read') return True
def test_fixpoint(self): # Fixed point should shift both elements by 2 ns test_elt = element.Element('test_elt', pulsar=self.pulsar) refpulse = SquarePulse(name='dummy_square', channel='ch1', amplitude=.5, length=20e-9) test_elt.add(refpulse, name='dummy_square') test_elt.add(SquarePulse(name='dummy_square', channel='ch1', amplitude=.3, length=20e-9), operation_type='RO', refpulse='dummy_square', start=98e-9, refpoint='start') min_samples = 1020 ch1_wf = test_elt.waveforms()[1]['ch1'] self.assertEqual(len(ch1_wf), min_samples) expected_wf = np.zeros(1020) expected_wf[902:922] = .5 expected_wf[1000:1020] = .3 np.testing.assert_array_almost_equal(ch1_wf, expected_wf)
def test_basic_element(self): test_elt = element.Element('test_elt', pulsar=self.pulsar) test_elt.add(SquarePulse(name='dummy_square', channel='ch1', amplitude=.3, length=20e-9)) min_samples = 960 ch1_wf = test_elt.waveforms()[1]['ch1'] self.assertEqual(len(ch1_wf), min_samples) expected_wf = np.zeros(960) expected_wf[:20] = .3 np.testing.assert_array_almost_equal(ch1_wf, expected_wf)
def shuttle(self, qubit, neighbor): self.channel = qubit.plunger_gate['channel_VP'] self.channel_neighbor = neighbor.plunger_gate['channel_VP'] self.add(SquarePulse(name='ShuttleOut', channel=self.channel, amplitude=0.03, length=10e-6), name='ShuttleOut') self.add(SquarePulse(name='ShuttleIn', channel=self.channel_neighbor, amplitude=0.03, length=10e-6), name='ShuttleIn', refpulse='ShuttleIn', refpoint='start') return True
def unload(self, qubit): self.channel = qubit.plunger_gate['channel_VP'] self.add(SquarePulse(name='UnLoad', channel=self.channel, amplitude=0.03, start=0, length=10e-6), name='UnLoad') return True
def _readout_element(self, name, amplitudes = [], trigger_digitizer = False, **kw): readout = Element(name = name, pulsar = self.pulsar) for i in range(len(self.qubits)): refpulse = None if i ==0 else 'read1' readout.add(SquarePulse(name='read', channel=self.channel_VP[i], amplitude=amplitudes[i], length=1e-6), name='read%d'%(i+1), refpulse = refpulse, refpoint = 'start') """ for trigger digitizer """ if trigger_digitizer: readout.add(SquarePulse(name='read_trigger1', channel='ch2_marker1', amplitude=2, length=1e-6), name='read%d_trigger1'%(i+1),refpulse = 'read1', refpoint = 'start', start = 0) readout.add(SquarePulse(name='read_trigger2', channel=self.digitizer_trigger_channel, amplitude=2, length=1e-6), name='read%d_trigger2'%(i+1),refpulse = 'read1', refpoint = 'start', start = 0) """ to make all elements equal length in different AWGs """ readout.add(SquarePulse(name='read_c1m2', channel=self.occupied_channel1, amplitude=2, length=1e-6), name='read%d_c1m2'%(i+1),refpulse = 'read1', refpoint = 'start') readout.add(SquarePulse(name='read_c5m2', channel=self.occupied_channel2, amplitude=2, length=1e-6), name='read%d_c5m2'%(i+1),refpulse = 'read1', refpoint = 'start') readout.add(SquarePulse(name='read_trigtest', channel='ch8', amplitude=0.3, length=1e-6), name='read_trigtest',refpulse = 'read1', refpoint = 'start') return readout
def manipulation(num): manipulation = Element('manipulation%d' % num, pulsar=pulsar) dd = [4, 0, 1, 2, 3, 4, 0] manipulation.add( SquarePulse(channel='ch%d' % plungerchannel, amplitude=0.35, length=30e-6), name='m0', ) manipulation.add( SquarePulse(channel='ch%d' % microwavechannel, amplitude=0.1, length=1e-6), name='m0_m', ) for i, d in enumerate(dd): manipulation.add(SquarePulse(channel='ch%d' % plungerchannel, amplitude=base_amplitude * d / np.max(dd), length=10e-6), name='m%d' % (i + 1), refpulse='m%d' % i, refpoint='end') manipulation.add(SquarePulse(channel='ch%d' % microwavechannel, amplitude=2 * base_amplitude * d / np.max(dd), length=5e-6), name='m%d_m' % (i + 1), refpulse='m%d_m' % i, refpoint='end') elts.append(manipulation) myseq.append( name='manipulation%d' % num, wfname='manipulation%d' % num, trigger_wait=False, ) return manipulation
def set_trigger(self, ): trigger_element = Element('trigger', self.pulsar) trigger_element.add( SquarePulse(name='TRG2', channel='ch8_marker2', amplitude=2, length=300e-9), name='trigger2', ) trigger_element.add(SquarePulse(name='TRG1', channel='ch4_marker2', amplitude=2, length=1376e-9), name='trigger1', refpulse='trigger2', refpoint='start', start=200e-9) trigger_element.add(SquarePulse(name='TRG_digi', channel='ch2_marker1', amplitude=2, length=800e-9), name='TRG_digi', refpulse='trigger2', refpoint='start', start=200e-9) trigger_element.add(SquarePulse(name='SIG_digi', channel='ch8', amplitude=0.5, length=800e-9), name='SIG_digi', refpulse='TRG_digi', refpoint='start', start=0) extra_element = Element('extra', self.pulsar) extra_element.add( SquarePulse(name='EXT2', channel='ch8_marker2', amplitude=2, length=5e-9), name='extra2', ) extra_element.add( SquarePulse(name='EXT1', channel='ch4_marker2', amplitude=2, length=2e-6), name='extra1', ) self.elts.insert(0, trigger_element) # self.elts.append(extra_element) self.sequence.insert_element(name='trigger', wfname='trigger', pos=0) # self.sequence.append(name ='extra', wfname = 'extra', trigger_wait = False) return True
def add_compensation(self, idx_j = 0, idx_i = 0): unit_length = 0 for segment in self.sequence_cfg: unit_length += len(segment) amplitude = [0,0] for i in range(unit_length): wfname = self.sequence.elements[-(i+1)]['wfname'] for elt in self.elts: if elt.name == wfname: element = elt break tvals, wfs = element.ideal_waveforms() repe = self.sequence.elements[-(i+1)]['repetitions'] amplitude[0] += np.sum(wfs[self.channel_VP[0]])*repe amplitude[1] += np.sum(wfs[self.channel_VP[1]])*repe comp_amp = [-amplitude[k]/3000000 for k in range(2)] if np.max(np.abs(comp_amp)) >= 0.5: raise ValueError('amp too large') compensation_element = Element('compensation_%d'%idx_i, self.pulsar) compensation_element.add(SquarePulse(name = 'COMPEN1', channel = self.channel_VP[0], amplitude=comp_amp[0], length=1e-6), name='compensation1',) compensation_element.add(SquarePulse(name = 'COMPEN2', channel = self.channel_VP[1], amplitude=comp_amp[1], length=1e-6), name='compensation2',refpulse = 'compensation1', refpoint = 'start', start = 0) compensation_element.add(SquarePulse(name='comp_c1m2', channel=self.occupied_channel1, amplitude=2, length=1e-6), name='comp%d_c1m2'%(i+1),refpulse = 'compensation1', refpoint = 'start') compensation_element.add(SquarePulse(name='comp_c5m2', channel=self.occupied_channel2, amplitude=2, length=1e-6), name='comp%d_c5m2'%(i+1),refpulse = 'compensation1', refpoint = 'start') self.elts.append(compensation_element) self.sequence.append(name = 'compensation_%d'%idx_i, wfname = 'compensation_%d'%idx_i, trigger_wait = False, repetitions = 3000) return True
def initialize_add(num): initialize_add = Element('initialize_add%d' % num, pulsar=pulsar) initialize_add.add(SquarePulse(channel='ch%d' % plungerchannel, name='initialize_1', amplitude=initialize_amplitude, length=1e-6), name='initialize_1') elts.append(initialize_add) myseq.append( name='initialize_add%d' % num, wfname='initialize_add%d' % num, repetitions=100, trigger_wait=False, ) return initialize_add
def readout_element(self, name, amplitudes=[]): readout = Element(name=name, pulsar=self.pulsar) for i in range(len(self.qubits)): refpulse = None if i == 0 else 'read1' readout.add(SquarePulse(name='read', channel=self.channel_VP[i], amplitude=amplitudes[i], length=1e-6), name='read%d' % (i + 1), refpulse=refpulse, refpoint='start') return readout
def initialize_element(self, name, amplitudes=[]): # print(amplitudes[0]) initialize = Element(name=name, pulsar=self.pulsar) for i in range(len(self.qubits)): refpulse = None if i == 0 else 'init1' initialize.add(SquarePulse(name='init', channel=self.channel_VP[i], amplitude=amplitudes[i], length=1e-6), name='init%d' % (i + 1), refpulse=refpulse, refpoint='start') return initialize
def Elzerman(self, qubit): self.channel = qubit.plunger_gate['channel_VP'] self.add(SquarePulse(name='Initialize', channel='ch1', amplitude=0.05, length=5e-6), name='Initialize') return True # def run_all(self, qubit): # self.unload() # self.initialize() # return True
# we copied the channel definition from out global pulsar print('Channel definitions: ') pprint.pprint(initialize._channels) print() plungerchannel = 4 Ichannel = 2 Qchannel = 3 microwavechannel = 2 VLP_channel = 4 base_amplitude = 0.25 # some safe value for the sample initialize_amplitude = 0.3 readout_amplitude = 0.5 initialize.add(SquarePulse(channel='ch%d' % plungerchannel, name='initialize_1', amplitude=initialize_amplitude, length=2e-6), name='initialize_1') initialize.add(SquarePulse( channel='ch%d' % plungerchannel, name='initialize_2', amplitude=0.5 * initialize_amplitude, length=0.5e-6, ), name='initialize_2', refpulse='initialize_1', refpoint='center') initialize.add(CosPulse( channel='ch%d' % plungerchannel,
def readout(num): readout = Element('readout%d' % num, pulsar=pulsar) readout.add(SquarePulse(channel='ch%d' % plungerchannel, amplitude=readout_amplitude, length=1e-6), name='readout_0') for i in range(3): readout.add(SquarePulse(channel='ch%d' % plungerchannel, amplitude=readout_amplitude / (i + 1), length=0.5e-6), name='readout_%d' % (i + 1), refpulse='readout_%d' % i, refpoint='end') readout.add(SquarePulse(channel='ch%d' % plungerchannel, amplitude=0 * readout_amplitude, length=3e-6), name='readout_4', refpulse='readout_3', refpoint='end') readout.add(CosPulse( channel='ch%d' % plungerchannel, name='readout_5', frequency=1e6, amplitude=0.5 * initialize_amplitude, length=1.5e-6, ), name='readout_5', start=-2e-6, refpulse='readout_4', refpoint='end') readout.add(SquarePulse(channel='ch%d' % plungerchannel, amplitude=0 * readout_amplitude, length=5e-6), name='readout_6', refpulse='readout_5', refpoint='end') readout.add(SquarePulse(channel='ch%d_marker1' % plungerchannel, amplitude=base_amplitude, length=0.1e-6), name='readout_marker1', refpulse='readout_0', refpoint='start') readout.add(SquarePulse(channel='ch%d_marker2' % plungerchannel, amplitude=base_amplitude, length=0.1e-6), name='readout_marker2', refpulse='readout_0', refpoint='start') elts.append(readout) myseq.append( name='readout%d' % num, wfname='readout%d' % num, reprtitions=800, trigger_wait=False, ) return readout
def AWG_Test(): station.pulsar = Pulsar() station.pulsar.AWG = station.components['awg'] marker1highs = [2, 2, 2.7, 2] for i in range(4): # Note that these are default parameters and should be kept so. # the channel offset is set in the AWG itself. For now the amplitude is # hardcoded. You can set it by hand but this will make the value in the # sequencer different. station.pulsar.define_channel( id='ch{}'.format(i + 1), name='ch{}'.format(i + 1), type='analog', # max safe IQ voltage high=.7, low=-.7, offset=0.0, delay=0, active=True) station.pulsar.define_channel(id='ch{}_marker1'.format(i + 1), name='ch{}_marker1'.format(i + 1), type='marker', high=marker1highs[i], low=0, offset=0., delay=0, active=True) station.pulsar.define_channel(id='ch{}_marker2'.format(i + 1), name='ch{}_marker2'.format(i + 1), type='marker', high=2.0, low=0, offset=0., delay=0, active=True) #Implementation of a sequence element. #Basic idea: add different pulses, and compose the actual numeric #arrays that form the amplitudes for the hardware (typically an AWG) V_empty = 0 V_load = 0.05 V_read = 0.025 t_empty = 20e-6 t_load = 10e-6 t_read = 20e-6 Npoints = 1 Empty_elt = Element('Empty_elt', pulsar=station.pulsar) Empty_elt.add(SquarePulse(name='square_empty', channel='ch1', amplitude=V_empty, start=0, length=t_empty), name='Empty') Load_elt = Element('Load_elt', pulsar=station.pulsar) Load_elt.add(SquarePulse(name='square_load', channel='ch1', amplitude=V_load, start=0, length=t_load), name='Load') Read_elt = Element('Read_elt', pulsar=station.pulsar) Read_elt.add(SquarePulse(name='square_read', channel='ch1', amplitude=V_read, start=0, length=t_read), name='Read') ReadEmpty_elt = Element('ReadEmpty_elt', pulsar=station.pulsar) ReadEmpty_elt.add(SquarePulse(name='square_read', channel='ch1', amplitude=V_read, start=0, length=t_read), name='Read') ReadEmpty_elt.add(SquarePulse(name='square_empty', channel='ch1', amplitude=V_empty, start=0, length=t_empty), name='Empty', refpulse='Read', refpoint='end', refpoint_new='start') elts = [Empty_elt, Load_elt, Read_elt, ReadEmpty_elt] T1_seq = Sequence('T1_Sequence') T1_seq.append('Empty_0', 'Empty_elt') for i in range(Npoints): name_Load = 'Load_{}'.format(i) name_ReadEmpty = 'ReadEmpty_{}'.format(i) T1_seq.append(name_Load, 'Load_elt', repetitions=i + 1) T1_seq.append(name_ReadEmpty, 'ReadEmpty_elt') ss = station.pulsar.program_awg(T1_seq, *elts) win = show_element_pyqt(ReadEmpty_elt, QtPlot_win=None, color_idx=None, channels=['ch1', 'ch2', 'ch3', 'ch4']) ch1_wf = test_elt.waveforms()[1]['ch1']
AWG=awg if i < 4 else awg2) return pulsar #%% program sequence pulsar = make5014pulsar(awg=station.components['awg'], awg2=station.components['awg2']) initialize = Element(name='initialize', pulsar=pulsar) manipulation = Element(name='manipulation', pulsar=pulsar) readout = Element(name='readout', pulsar=pulsar) initialize.add(SquarePulse(name='init', channel='ch1', amplitude=1, length=100e-6), name='init') manipulation.add(SquarePulse(name='manip1', channel='ch1', amplitude=0.4, length=0.5e-6), name='manip1') manipulation.add(CosPulse(name='manip2', channel='ch1', frequency=3e6, amplitude=0.3, length=200e-9), name='manip2',
def XY_rotation(self, degree = 90, length = None, waiting_time = 0, refgate = None, refpoint = 'end', refqubit = None): # global phase # IQ_Modulation = self.frequency if length is not None: pulse_length = length else: pulse_length = self.halfPi_pulse_length if degree == 90 else degree*self.Pi_pulse_length/180 pulse_amp = self.amplitude pulse_delay = Instrument.find_instrument(self.qubit).pulse_delay if self.qubit == 'qubit_2' and refqubit == 'qubit_2': pulse_delay = 0 ## voltage pulse is not used here voltage_pulse = SquarePulse(channel = self.channel_VP, name = '%s_voltage_pulse'%self.name, amplitude = 0, length = 0)#pulse_length + waiting_time) PM_pulse = SquarePulse(channel = self.channel_PM, name = '%s_PM_pulse'%self.name, amplitude = 2, length = pulse_length+self.PM_before+self.PM_after) if self.frequency_shift == 0: microwave_pulse_I = SquarePulse(channel = self.channel_I, name = '%s_microwave_pulse_I'%self.name, amplitude = pulse_amp*np.cos(-self.refphase + self.axis_angle), length = pulse_length) microwave_pulse_Q = SquarePulse(channel = self.channel_Q, name = '%s_microwave_pulse_Q'%self.name, amplitude = pulse_amp*np.sin(-self.refphase + self.axis_angle), length = pulse_length) elif self.frequency_shift != 0: ##here frequency and phase is not yet ready!!!!!!!!!!! phase = self.IQ_phase-self.refphase + self.axis_angle freq = self.frequency_shift microwave_pulse_I = CosPulse(channel = self.channel_I, name = '%s_microwave_pulse_I'%self.name, frequency = freq, amplitude = pulse_amp, length = pulse_length, phase = phase) microwave_pulse_Q = CosPulse(channel = self.channel_Q, name = '%s_microwave_pulse_Q'%self.name, frequency = freq, amplitude = pulse_amp, length = pulse_length, phase = phase-90) ''' adiabatic sweep for test ''' if type(self.frequency_shift) is list : phase = self.IQ_phase-self.refphase + self.axis_angle freq = self.frequency_shift start_freq = self.frequency_shift[0] end_freq = self.frequency_shift[1] microwave_pulse_I = AdiabaticCosPulse(channel = self.channel_I, name = '%s_microwave_pulse_I'%self.name, start_frequency = start_freq, end_frequency = end_freq, amplitude = pulse_amp, length = pulse_length, phase = phase) microwave_pulse_Q = AdiabaticCosPulse(channel = self.channel_Q, name = '%s_microwave_pulse_Q'%self.name, start_frequency = start_freq, end_frequency = end_freq, amplitude = pulse_amp, length = pulse_length, phase = phase-90) ''' ''' self.pulses[0] = { 'pulse': voltage_pulse, 'pulse_name': voltage_pulse.name, 'refpulse': None if refgate == None else refgate[0]['pulse_name'], 'refpoint': refpoint, 'waiting': 0 } self.pulses[1] = { 'pulse': microwave_pulse_I, 'pulse_name': microwave_pulse_I.name, 'refpulse': None if refgate == None else refgate[-2]['pulse_name'], ## name of the refpulse 'refpoint': refpoint, 'waiting': waiting_time + pulse_delay } self.pulses[2] = { 'pulse': microwave_pulse_Q, 'pulse_name': microwave_pulse_Q.name, 'refpulse': '%s_microwave_pulse_I'%self.name, 'refpoint': 'start', 'waiting': 0 } ## here you just construct a dictionary which contains all the information of pulses you use self.pulses[3] = { 'pulse': PM_pulse, 'pulse_name': PM_pulse.name, 'refpulse': '%s_microwave_pulse_I'%self.name, 'refpoint': 'start', 'waiting': -self.PM_before } return True
def _manipulation_element(self, name, time, amplitudes=[], **kw): # waiting_time = kw.pop('waiting_time', None) # duration_time = kw.pop('duration_time', None) # frequency = kw.pop('frequency', None) # power = kw.pop('power', None) print('manip time:', time) parameter1 = kw.pop('parameter1', None) parameter2 = kw.pop('parameter2', None) manip_elem = kw.pop('manip_elem', None) print(name) manip = deepcopy(self.manip_elem) if manip_elem not in self.manipulation_elements: raise NameError('Manipulation Element [%s] not in Experiment.' % manip_elem) # manip = deepcopy(self.manipulation_elements[manip_elem]) # manip = Ramsey() manipulation = manip( name=name, qubits=self.qubits, pulsar=self.pulsar, parameter1=parameter1, parameter2=parameter2, ) # waiting_time = waiting_time, duration_time = duration_time, # frequency = frequency, power = power) manipulation.make_circuit() VP_start_point = -manip.VP_before VP_end_point = manip.VP_after for i in range(len(self.qubits)): refpulse = None if i == 0 else 'manip1' start = VP_start_point if i == 0 else 0 manipulation.add(SquarePulse(name='manip%d' % (i + 1), channel=self.channel_VP[i], amplitude=amplitudes[i], length=time), name='manip%d' % (i + 1), refpulse=refpulse, refpoint='start', start=start) manipulation.add(SquarePulse(name='manip_c1m2', channel=self.occupied_channel1, amplitude=0.1, length=time), name='manip%d_c1m2' % (i + 1), refpulse='manip1', refpoint='start') manipulation.add(SquarePulse(name='manip_c5m2', channel=self.occupied_channel2, amplitude=2, length=time), name='manip%d_c5m2' % (i + 1), refpulse='manip1', refpoint='start') return manipulation