def create_pulse_lib(awgs): pulse = pulselib(backend='M3202A') channels = [] # add to pulse_lib for i, awg in enumerate(awgs): pulse.add_awgs(awg.name, awg) # define channels for ch in range(1, 5): channel_name = f'{awg.name}_{ch}' pulse.define_channel(channel_name, awg.name, ch) channels.append(channel_name) n_ch = len(channels) # set a virtual gate matrix virtual_gate_set_1 = virtual_gates_constructor(pulse) virtual_gate_set_1.add_real_gates(*channels) virtual_gate_set_1.add_virtual_gates(*[f'vP{i+1}' for i in range(n_ch)]) # copy data of AWG1 to all other AWG inv_matrix = np.zeros((n_ch, ) * 2) for i in range(4): inv_matrix[i::4, i] = 1.0 for i in range(4, n_ch): inv_matrix[i, i] = 1.0 virtual_gate_set_1.add_virtual_gate_matrix(np.linalg.inv(inv_matrix)) pulse.finish_init() return pulse
def init_pulselib(awgs, virtual_gates=False, bias_T_rc_time=None): pulse = pulselib() for awg in awgs: pulse.add_awgs(awg.name, awg) # define channels pulse.define_channel('P1', 'AWG1', 1) pulse.define_channel('P2', 'AWG1', 2) # add limits on voltages for DC channel compenstation (if no limit is specified, no compensation is performed). pulse.add_channel_compensation_limit('P1', (-200, 500)) pulse.add_channel_compensation_limit('P2', (-200, 500)) if bias_T_rc_time: pulse.add_channel_bias_T_compensation('P1', bias_T_rc_time) pulse.add_channel_bias_T_compensation('P2', bias_T_rc_time) if virtual_gates: # set a virtual gate matrix virtual_gate_set_1 = virtual_gates_constructor(pulse) virtual_gate_set_1.add_real_gates('P1', 'P2') virtual_gate_set_1.add_virtual_gates('vP1', 'vP2') inv_matrix = 1.2 * np.eye(2) - 0.1 virtual_gate_set_1.add_virtual_gate_matrix(np.linalg.inv(inv_matrix)) pulse.finish_init() return pulse
def init_pulselib(awgs): """ return pulse library object Args: awgs : AWG instances you want to add (qcodes AWG object) """ pulse = pulselib() # add to pulse_lib for i, awg in enumerate(awgs): pulse.add_awgs(awg.name, awg) # define channels if i == 0: # AWG-3 pulse.define_channel(f'P1', awg.name, 1) # digitizer pulse.define_channel(f'P2', awg.name, 2) # digitizer pulse.define_marker(f'M3', awg.name, 3, setup_ns=50, hold_ns=50) # Scope pulse.define_channel(f'P4', awg.name, 4) elif i == 1: # AWG-7 pulse.define_channel(f'B1', awg.name, 1) pulse.define_channel(f'B2', awg.name, 2) # Scope pulse.define_channel(f'B3', awg.name, 3) # digitizer pulse.define_marker(f'M4', awg.name, 4, setup_ns=50, hold_ns=50) # digitizer else: for ch in range(1, 5): pulse.define_channel(f'{awg.name}.{ch}', awg.name, ch) pulse.define_marker(f'M{i+1}.T', awg.name, 0, setup_ns=50, hold_ns=50) pulse.add_channel_compensation_limit('P1', (-100, 100)) pulse.finish_init() return pulse
def init_pulselib(awgs, digitizer): p = pulselib(backend='Keysight_QS') for awg in awgs: p.add_awg(awg) p.add_digitizer(digitizer) awg1, awg2 = awgs p.define_channel('P1', awg1.name, 1) p.define_channel('P2', awg1.name, 2) p.define_channel('P3', awg1.name, 3) p.define_channel('P4', awg1.name, 4) set_channel_props(p, 'P1', compensation_limits=(-500,500), attenuation=2.0, delay=0, bias_T_rc_time=0.001) set_channel_props(p, 'P2', compensation_limits=(-250,250), attenuation=1.0, delay=0, bias_T_rc_time=0.001) set_channel_props(p, 'P3', compensation_limits=(-280,280), attenuation=1.0, delay=0, bias_T_rc_time=0.001) set_channel_props(p, 'P4', bias_T_rc_time=0.001) p.define_digitizer_channel('SE1', digitizer.name, 1) p.finish_init() # add virtual channels. virtual_gate_set_1 = virtual_gates_constructor(p) virtual_gate_set_1.add_real_gates('P1','P2','P3','P4') virtual_gate_set_1.add_virtual_gates('vP1','vP2','vP3','vP4') virtual_gate_set_1.add_virtual_gate_matrix(0.9*np.eye(4) + 0.1) return p
def return_pulse_lib(hardware=None): """ return pulse library object Returns: pulse : pulse lib main class """ pulse = pulselib(backend="DEMO") # define channels pulse.define_channel('B0', 'AWG1', 1) pulse.define_channel('P1', 'AWG1', 2) pulse.define_channel('B1', 'AWG1', 3) pulse.define_channel('P2', 'AWG1', 4) pulse.define_channel('B2', 'AWG2', 1) pulse.define_channel('P3', 'AWG2', 2) pulse.define_channel('B3', 'AWG2', 3) pulse.define_channel('P4', 'AWG2', 4) pulse.define_channel('B4', 'AWG3', 1) pulse.define_channel('P5', 'AWG3', 2) pulse.define_channel('B5', 'AWG3', 3) pulse.define_channel('P6', 'AWG3', 4) # pulse.define_channel('B6','AWG4', 1) pulse.define_channel('S6', 'AWG4', 2) pulse.define_channel('SD1_P', 'AWG4', 3) pulse.define_channel('SD2_P', 'AWG4', 4) pulse.define_channel('I_MW', 'AWG5', 1) pulse.define_channel('Q_MW', 'AWG5', 2) pulse.define_marker('M1', 'AWG5', 0) pulse.define_marker('M2', 'AWG6', 0) pulse.define_marker('M_SD1', 'AWG1', 0) pulse.define_marker('M_SD2', 'AWG2', 0) pulse.define_channel('SCOPE1', 'AWG6', 2) if hardware is None: hardware = hardware_test('test1') pulse.load_hardware(hardware) IQ_chan_set_1 = IQ_channel_constructor(pulse) # set right association of the real channels with I/Q output. IQ_chan_set_1.add_IQ_chan("I_MW", "I") IQ_chan_set_1.add_IQ_chan("Q_MW", "Q") IQ_chan_set_1.add_marker("M1") IQ_chan_set_1.set_LO(11.25e9) IQ_chan_set_1.add_virtual_IQ_channel('qubit1_MW', LO_freq=11.0) IQ_chan_set_1.add_virtual_IQ_channel('qubit2_MW', LO_freq=11.1) IQ_chan_set_1.add_virtual_IQ_channel('qubit3_MW', LO_freq=11.2) IQ_chan_set_1.add_virtual_IQ_channel('qubit4_MW', LO_freq=11.3) IQ_chan_set_1.add_virtual_IQ_channel('qubit5_MW', LO_freq=11.4) IQ_chan_set_1.add_virtual_IQ_channel('qubit6_MW', LO_freq=11.5) IQ_chan_set_1.add_virtual_IQ_channel('pre_pulse', LO_freq=11.5) return pulse
def create_pulse_lib(awgs): pulse = pulselib(backend='M3202A') # add to pulse_lib for i, awg in enumerate(awgs): pulse.add_awgs(awg.name, awg) # define channels for ch in range(1, 5): pulse.define_channel(f'{awg.name}_{ch}', awg.name, ch) pulse.finish_init() return pulse
def create_pulse_lib(awgs): pulse = pulselib() for awg in awgs: pulse.add_awgs(awg.name, awg) # define channels for ch in range(1, 5): pulse.define_channel(f'{awg.name}.{ch}', awg.name, ch) pulse.finish_init() return pulse
def return_pulse_lib_quad_dot(): """ return pulse library object Returns: pulse : pulse lib main class """ pulse = pulselib(backend="DEMO") # define channels pulse.define_channel('B0', 'AWG1', 1) pulse.define_channel('P1', 'AWG1', 2) pulse.define_channel('B1', 'AWG1', 3) pulse.define_channel('P2', 'AWG1', 4) pulse.define_channel('B2', 'AWG2', 1) pulse.define_channel('P3', 'AWG2', 2) pulse.define_channel('B3', 'AWG2', 3) pulse.define_channel('P4', 'AWG2', 4) pulse.define_channel('B4', 'AWG3', 1) pulse.define_channel('SD1_P', 'AWG3', 3) pulse.define_channel('SD2_P', 'AWG3', 4) pulse.define_channel('I_MW', 'AWG4', 1) pulse.define_channel('Q_MW', 'AWG4', 2) pulse.define_marker('M1', 'AWG4', 3) quad_hardware = hardware('test') pulse.load_hardware(quad_hardware) IQ_chan_set_1 = IQ_channel_constructor(pulse) # set right association of the real channels with I/Q output. IQ_chan_set_1.add_IQ_chan("I_MW", "I") IQ_chan_set_1.add_IQ_chan("Q_MW", "Q") IQ_chan_set_1.add_marker("M1", -60, 60) IQ_chan_set_1.set_LO(1e8) IQ_chan_set_1.add_virtual_IQ_channel('qubit1_MW') IQ_chan_set_1.add_virtual_IQ_channel('qubit2_MW') IQ_chan_set_1.add_virtual_IQ_channel('qubit3_MW') IQ_chan_set_1.add_virtual_IQ_channel('qubit4_MW') # just to make qcodes happy quad_hardware.close() return pulse
def init_pulselib(awgs, virtual_gates=False, bias_T_rc_time=None): pulse = pulselib() for awg in awgs: pulse.add_awg(awg) # define channels pulse.define_channel('P1','AWG1', 1) pulse.define_channel('P2','AWG1', 2) pulse.define_channel('I1','AWG1', 3) pulse.define_channel('Q1','AWG1', 4) pulse.define_digitizer_channel('SD1', 'Digitizer', 1) # add limits on voltages for DC channel compensation (if no limit is specified, no compensation is performed). pulse.add_channel_compensation_limit('P1', (-200, 500)) pulse.add_channel_compensation_limit('P2', (-200, 500)) if bias_T_rc_time: pulse.add_channel_bias_T_compensation('P1', bias_T_rc_time) pulse.add_channel_bias_T_compensation('P2', bias_T_rc_time) if virtual_gates: # set a virtual gate matrix virtual_gate_set_1 = virtual_gates_constructor(pulse) virtual_gate_set_1.add_real_gates('P1','P2') virtual_gate_set_1.add_virtual_gates('vP1','vP2') inv_matrix = 1.2*np.eye(2) - 0.1 virtual_gate_set_1.add_virtual_gate_matrix(np.linalg.inv(inv_matrix)) # define IQ output pair IQ_pair_1 = IQ_channel_constructor(pulse) IQ_pair_1.add_IQ_chan("I1", "I") IQ_pair_1.add_IQ_chan("Q1", "Q") # frequency of the MW source IQ_pair_1.set_LO(2.40e9) # add 1 qubit: q1 IQ_pair_1.add_virtual_IQ_channel("q1") pulse.finish_init() return pulse
def create_pulse_lib(awgs): """ return pulse library object Args: hardware : hardware class (if not present, put None) *args : AWG instances you want to add (qcodes AWG object) """ pulse = pulselib() # add to pulse_lib for i, awg in enumerate(awgs): pulse.add_awgs(awg.name, awg) # define channels for ch in range(1, 5): pulse.define_channel(f'{awg.name}.{ch}', awg.name, ch) pulse.finish_init() return pulse
def init_pulselib(awgs): pulse = pulselib(backend=backend) for awg in awgs: pulse.add_awgs(awg.name, awg) # define channels pulse.define_channel('I1', 'AWG1', 1) pulse.define_channel('Q1', 'AWG1', 2) pulse.define_channel('I2', 'AWG1', 3) pulse.define_channel('Q2', 'AWG1', 4) pulse.add_channel_offset('I2', 10) pulse.add_channel_offset('Q2', -5) # define IQ output pair IQ_pair_1 = IQ_channel_constructor(pulse) IQ_pair_1.add_IQ_chan("I1", "I") IQ_pair_1.add_IQ_chan("Q1", "Q") # frequency of the MW source IQ_pair_1.set_LO(2.40e9) IQ_pair_2 = IQ_channel_constructor(pulse) IQ_pair_2.add_IQ_chan("I2", "I") IQ_pair_2.add_IQ_chan("Q2", "Q") # frequency of the MW source IQ_pair_2.set_LO(2.40e9) IQ_pair_1.add_virtual_IQ_channel("q0", 2.420e9) IQ_pair_2.add_virtual_IQ_channel("q1", 2.420e9, correction_gain=(0.9, 1.0)) IQ_pair_2.add_virtual_IQ_channel("q2", 2.420e9, correction_gain=(1.0, 0.9)) IQ_pair_2.add_virtual_IQ_channel("q3", 2.420e9, correction_phase=0.3) pulse.finish_init() return pulse
def return_pulse_lib(): pulse = pulselib() # add to pulse_lib # pulse.add_awgs('AWG1',None) # pulse.add_awgs('AWG2',None) # pulse.add_awgs('AWG3',None) # pulse.add_awgs('AWG4',None) # define channels pulse.define_channel('B3', 'AWG1', 1) pulse.define_channel('B4', 'AWG1', 2) pulse.define_channel('P5', 'AWG1', 3) pulse.define_channel('P4', 'AWG1', 4) pulse.define_channel('P1', 'AWG2', 1) pulse.define_channel('B1', 'AWG2', 2) pulse.define_channel('P2', 'AWG2', 3) pulse.define_channel('B0', 'AWG2', 4) pulse.define_channel('B5', 'AWG3', 1) pulse.define_channel('A2', 'AWG3', 2) pulse.define_channel('A3', 'AWG3', 3) pulse.define_channel('A4', 'AWG3', 4) pulse.define_channel('A5', 'AWG4', 1) pulse.define_channel('M1', 'AWG4', 2) pulse.define_channel('A6', 'AWG4', 3) pulse.define_marker('M2', 'AWG4', 4) # format : channel name with delay in ns (can be posive/negative) # pulse.add_channel_delay('I_MW',50) # pulse.add_channel_delay('Q_MW',50) # pulse.add_channel_delay('M1',20) # pulse.add_channel_delay('M2',-25) # add limits on voltages for DC channel compenstation (if no limit is specified, no compensation is performed). pulse.add_channel_compensation_limit('B0', (-1000, 500)) pulse.add_channel_compensation_limit('B1', (-1000, 500)) pulse.add_channel_compensation_limit('B3', (-1000, 500)) pulse.add_channel_compensation_limit('B4', (-1000, 500)) pulse.add_channel_compensation_limit('P1', (-1000, 500)) pulse.add_channel_compensation_limit('P2', (-1000, 500)) pulse.add_channel_compensation_limit('P4', (-1000, 500)) pulse.add_channel_compensation_limit('P5', (-1000, 500)) pulse.add_channel_compensation_limit('B5', (-1000, 500)) # set a virtual gate matrix (note that you are not limited to one matrix if you would which so) virtual_gate_set_1 = virtual_gates_constructor(pulse) virtual_gate_set_1.add_real_gates('P4', 'P5', 'B3', 'B4', 'B5') virtual_gate_set_1.add_virtual_gates('vP4', 'vP5', 'vB3', 'vB4', 'vB5') virtual_gate_set_1.add_virtual_gate_matrix(np.eye(5)) # # make virtual channels for IQ usage (also here, make one one of these object per MW source) # IQ_chan_set_1 = IQ_channel_constructor(pulse) # # set right association of the real channels with I/Q output. # IQ_chan_set_1.add_IQ_chan("I_MW", "I") # IQ_chan_set_1.add_IQ_chan("Q_MW", "Q") # IQ_chan_set_1.add_marker("M1", -15, 15) # IQ_chan_set_1.add_marker("M2", -15, 15) # # set LO frequency of the MW source. This can be changed troughout the experiments, bit only newly created segments will hold the latest value. # IQ_chan_set_1.set_LO(1e9) # # name virtual channels to be used. # IQ_chan_set_1.add_virtual_IQ_channel("MW_qubit_1") # IQ_chan_set_1.add_virtual_IQ_channel("MW_qubit_2") # finish initialisation (! important if using keysight uploader) # pulse.finish_init() return pulse
if __name__ == '__main__': from pulse_lib.segments.utility.looping import linspace from pulse_lib.base_pulse import pulselib @loops_to_numpy def triangle(height:np.ndarray, slope1:np.ndarray, slope2:np.ndarray) -> np.ndarray: ''' height: height in mV slope1: rising slope in mV/ns slope2: falling slope in mV/ns ''' t_ramp1 = height/slope1 t_ramp2 = -height/slope2 return t_ramp1, t_ramp2 p = pulselib('') p.define_channel('P1', 'AWG1', 1) slope1 = linspace(10, 100, 10, axis=0) slope2 = -linspace(20, 100, 5, axis=1) height = 400 t_ramp1, t_ramp2 = triangle(height, slope1, slope2) s = p.mk_segment() s.P1.add_ramp_ss(0, t_ramp1, 0, height) s.reset_time() s.P1.add_ramp_ss(0, t_ramp2, height, 0) s.plot([0,0]) s.plot([0,5]) s.plot([1,0])
def init_pulselib(awg1, awg2, awg3): p = pulselib() p.add_awg(awg1) p.add_awg(awg2) p.add_awg(awg3) p.define_channel('P1', awg1.name, 1) p.define_channel('P2', awg1.name, 2) p.define_channel('P3', awg1.name, 3) p.define_channel('P4', awg1.name, 4) p.define_marker('M1', awg3.name, 3, setup_ns=40, hold_ns=20) p.define_marker('M2', awg3.name, 0, setup_ns=40, hold_ns=20) set_channel_props(p, 'P1', compensation_limits=(-100, 100), attenuation=2.0, delay=0) set_channel_props(p, 'P2', compensation_limits=(-50, 50), attenuation=1.0, delay=0) set_channel_props(p, 'P3', compensation_limits=(-80, 80), attenuation=1.0, delay=0) p.define_channel('I1', awg2.name, 1) p.define_channel('Q1', awg2.name, 2) p.define_channel('I2', awg2.name, 3) p.define_channel('Q2', awg2.name, 4) set_channel_props(p, 'I1', compensation_limits=(-80, 80), attenuation=1.0, delay=0) p.finish_init() # add virtual channels. virtual_gate_set_1 = virtual_gates_constructor(p) virtual_gate_set_1.add_real_gates('P1', 'P2', 'P3', 'P4') virtual_gate_set_1.add_virtual_gates('vP1', 'vP2', 'vP3', 'vP4') virtual_gate_set_1.add_virtual_gate_matrix(0.9 * np.eye(4) + 0.1) #make virtual channels for IQ usage (also here, make one one of these object per MW source) IQ_chan_set_1 = IQ_channel_constructor(p) # set right association of the real channels with I/Q output. IQ_chan_set_1.add_IQ_chan("I1", "I") IQ_chan_set_1.add_IQ_chan("Q1", "Q") IQ_chan_set_1.add_marker("M1") # frequency of the MW source IQ_chan_set_1.set_LO(2e9) IQ_chan_set_1.add_virtual_IQ_channel("MW_qubit_1") IQ_chan_set_1.add_virtual_IQ_channel("MW_qubit_2") IQ_chan_set_2 = IQ_channel_constructor(p) # set right association of the real channels with I/Q output. IQ_chan_set_2.add_IQ_chan("I2", "I") IQ_chan_set_2.add_IQ_chan("Q2", "Q") IQ_chan_set_2.add_marker("M2") # frequency of the MW source IQ_chan_set_2.set_LO(2e9) IQ_chan_set_2.add_virtual_IQ_channel("MW_qubit_3") IQ_chan_set_2.add_virtual_IQ_channel("MW_qubit_4") return p