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 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 _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 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(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 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 _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 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']
high=2, low=0, offset=0., delay=0, active=True, AWG=awg) return pulsar #%% pulsar = make5014pulsar(awg=station.components['awg'], awg2=station.components['awg2']) # Generating an example sequence test_element = Element('test_element', pulsar=pulsar) # we copied the channel definition from out global pulsar print() #%% awg = station.awg awg2 = station.awg2 awg.clock_freq(1e9) awg2.clock_freq(1e9) basechannel = 1 VT_channel = 5 VLP_channel = 8 base_amplitude = 0.25 # some safe value for the sample
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
name='ch{}_marker2'.format(i + 1), type='marker', high=2, low=0, offset=0., delay=0, active=True, 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),
'JUMP_TIMING': 1, # Sync | Async 'RUN_MODE': 4, # Continuous | Triggered | Gated | Sequence 'RUN_STATE': 0, # On | Off } return pulsar pulsar = make5014pulsar(station.components['awg']) station.pulsar = pulsar #%% MAKE test segment. awg = stationF006.awg initialize = Element('initialize', pulsar=pulsar) # 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,