Esempio n. 1
0
def MBE(name,
        carbon_list=[1, 5, 2],
        carbon_init_list=[2, 5, 1],
        carbon_init_states=3 * ['up'],
        carbon_init_methods=3 * ['swap'],
        carbon_init_thresholds=3 * [0],
        number_of_MBE_steps=1,
        logic_state='X',
        mbe_bases=['Y', 'Y', 'Y'],
        MBE_threshold=1,
        RO_C=1,
        number_of_parity_msmnts=2,
        error_on_qubit='all',
        el_RO='positive',
        debug=False,
        error_sign=1,
        error_probability_list=np.linspace(0, 1, 3),
        parity_orientations=['positive', 'negative']):

    m = DD.Three_QB_det_QEC(name)
    funcs.prepare(m)

    phase_error = error_sign * 2 * np.arcsin(
        np.sqrt(error_probability_list)) * 180. / np.pi
    if error_on_qubit == 1:
        Qe = [1, 0, 0]
    elif error_on_qubit == 2:
        Qe = [0, 1, 0]
    elif error_on_qubit == 3:
        Qe = [0, 0, 1]
    elif error_on_qubit == 'all':
        Qe = [1, 1, 1]

    m.params['phase_error_array'] = np.transpose(
        [phase_error * Qe[0], phase_error * Qe[1], phase_error * Qe[2]])

    m.params['C13_MBI_threshold_list'] = carbon_init_thresholds

    m.params['Parity_a_RO_orientation'] = parity_orientations[0]
    m.params['Parity_b_RO_orientation'] = parity_orientations[1]
    ''' set experimental parameters '''

    m.params['reps_per_ROsequence'] = 500

    ### Carbons to be used
    m.params['carbon_list'] = carbon_list

    ### Carbon Initialization settings
    m.params['carbon_init_list'] = carbon_init_list
    m.params['init_method_list'] = carbon_init_methods
    m.params['init_state_list'] = carbon_init_states
    m.params['Nr_C13_init'] = len(carbon_init_list)

    ##################################
    ### RO bases (sweep parameter) ###
    ##################################
    '''Select right tomography basis '''

    if parity_orientations == ['positive', 'positive']:
        m.params['Tomo_Bases_00'] = TD.get_tomo_bases(Flip_qubit='',
                                                      Flip_axis='',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_01'] = TD.get_tomo_bases(Flip_qubit='2',
                                                      Flip_axis='Y',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_10'] = TD.get_tomo_bases(Flip_qubit='3',
                                                      Flip_axis='Y',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_11'] = TD.get_tomo_bases(Flip_qubit='1',
                                                      Flip_axis='Z',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]

    elif parity_orientations == ['negative', 'negative']:
        m.params['Tomo_Bases_11'] = TD.get_tomo_bases(Flip_qubit='',
                                                      Flip_axis='',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_10'] = TD.get_tomo_bases(Flip_qubit='2',
                                                      Flip_axis='Y',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_01'] = TD.get_tomo_bases(Flip_qubit='3',
                                                      Flip_axis='Y',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_00'] = TD.get_tomo_bases(Flip_qubit='1',
                                                      Flip_axis='Z',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]

    elif parity_orientations == ['positive', 'negative']:
        m.params['Tomo_Bases_01'] = TD.get_tomo_bases(Flip_qubit='',
                                                      Flip_axis='',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_00'] = TD.get_tomo_bases(Flip_qubit='2',
                                                      Flip_axis='Y',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_11'] = TD.get_tomo_bases(Flip_qubit='3',
                                                      Flip_axis='Y',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_10'] = TD.get_tomo_bases(Flip_qubit='1',
                                                      Flip_axis='Z',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]

    elif parity_orientations == ['negative', 'positive']:
        m.params['Tomo_Bases_10'] = TD.get_tomo_bases(Flip_qubit='',
                                                      Flip_axis='',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_11'] = TD.get_tomo_bases(Flip_qubit='2',
                                                      Flip_axis='Y',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_00'] = TD.get_tomo_bases(Flip_qubit='3',
                                                      Flip_axis='Y',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]
        m.params['Tomo_Bases_01'] = TD.get_tomo_bases(Flip_qubit='1',
                                                      Flip_axis='Z',
                                                      RO_list=logic_state +
                                                      '_list')[RO_C]

    ###################
    ### MBE settings ###
    ####################

    m.params['Nr_MBE'] = number_of_MBE_steps
    m.params['MBE_bases'] = mbe_bases
    m.params['MBE_threshold'] = MBE_threshold
    m.params['3qb_logical_state'] = logic_state

    ###################################
    ### Parity measurement settings ###
    ###################################

    m.params['Nr_parity_msmts'] = number_of_parity_msmnts
    m.params['Parity_threshold'] = 1

    m.params['Parity_a_carbon_list'] = [2, 1]
    m.params['Parity_b_carbon_list'] = [5, 1]

    m.params['Parity_a_RO_list'] = ['X', 'X']
    m.params['Parity_b_RO_list'] = ['X', 'X']

    ### Derive other parameters
    m.params['pts'] = len(error_probability_list)
    m.params['sweep_name'] = 'Error Probability'
    m.params['sweep_pts'] = error_probability_list

    ### RO params
    m.params['electron_readout_orientation'] = el_RO

    funcs.finish(m, upload=True, debug=debug)
Esempio n. 2
0
def MBE_test_msmt(name, carbon_list   = [1,5,2],

        carbon_init_list              = [2,5,1],
        carbon_init_states            = 3*['up'],
        carbon_init_methods           = 3*['swap'],
        carbon_init_thresholds        = 3*[0],

        number_of_MBE_steps           = 1,
        logic_state                   = 'X',
        mbe_bases                     = ['Y','Y','Y'],
        MBE_threshold                 = 1,
        RO_C                          = 1,

        number_of_parity_msmnts       = 2,
        error_on_qubit                = 'all',
        el_RO                         = 'positive',
        debug                         = False,
        error_sign1                    = 1,
        error_sign2                    = 1,
        error_probability_list        = np.linspace(0,1,3),
        parity_orientations           = ['positive','negative'],
        error_prob_magnitude          = '< 0.5'):

    m = DD.Three_QB_det_QEC(name)
    funcs.prepare(m)

    ### Calculate the new error probability p_e' for splitting up the error in two rounds ###

    ### for errors < 0.5
    if error_prob_magnitude == '< 0.5':
        error_probability_list_per_round = [0]#(1 - (1 - 2*error_probability_list)**0.5)/2.
    ### for errors > 0.5
    # elif error_prob_magnitude == '> 0.5':
    #     error_probability_list_per_round = 1 - (1 - (1 - 2*error_probability_list)**0.5)/2.
    #     error_probability_list_per_round = error_probability_list_per_round[::-1]


    phase_error_round1                   = error_sign1 * 2*np.arcsin(np.sqrt(error_probability_list_per_round))*180./np.pi
    phase_error_round2                   = error_sign2 * 2*np.arcsin(np.sqrt(error_probability_list_per_round))*180./np.pi
    
    if error_on_qubit ==1:
        Qe                            = [1,0,0]
    elif error_on_qubit ==2:
        Qe                            = [0,1,0]
    elif error_on_qubit ==3:
        Qe                            = [0,0,1]
    elif error_on_qubit =='all':
        Qe                            = [1,1,1]

    m.params['phase_error_array_1'] = np.transpose([phase_error_round1*Qe[0],phase_error_round1*Qe[1],phase_error_round1*Qe[2]])
    m.params['phase_error_array_2'] = np.transpose([phase_error_round2*Qe[0],phase_error_round2*Qe[1],phase_error_round2*Qe[2]])



    m.params['C13_MBI_threshold_list'] = carbon_init_thresholds

    m.params['Parity_a_RO_orientation'] = parity_orientations[0]
    m.params['Parity_b_RO_orientation'] = parity_orientations[1]

    ''' set experimental parameters '''

    m.params['reps_per_ROsequence'] = 500


    m.params['add_wait_gate'] = False
    m.params['wait_in_msm1']  = False

    m.params['free_evolution_time_1'] = np.ones(len(phase_error_round1))*0
    m.params['free_evolution_time_2'] = np.ones(len(phase_error_round1))*0

    ### Carbons to be used
    m.params['MBE_list']      = carbon_list
    m.params['carbon_list']         = carbon_list

    ### Carbon Initialization settings
    m.params['carbon_init_list']    = carbon_init_list
    m.params['init_method_list']    = carbon_init_methods
    m.params['init_state_list']     = carbon_init_states
    m.params['Nr_C13_init']         = len(carbon_init_list)

    ##################################
    ### RO bases (sweep parameter) ###
    ##################################

    '''Select right tomography basis '''

    if parity_orientations == ['positive','positive']:
        m.params['Tomo_Bases_00'] = TD.get_tomo_bases(Flip_qubit = '' ,  Flip_axis = '', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_01'] = TD.get_tomo_bases(Flip_qubit = '2',  Flip_axis = 'Y', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_10'] = TD.get_tomo_bases(Flip_qubit = '3',  Flip_axis = 'Y', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_11'] = TD.get_tomo_bases(Flip_qubit = '1',  Flip_axis = 'Z', RO_list = logic_state+'_list')[RO_C]

    elif parity_orientations == ['negative','negative']:
        m.params['Tomo_Bases_11'] = TD.get_tomo_bases(Flip_qubit = '' ,  Flip_axis = '', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_10'] = TD.get_tomo_bases(Flip_qubit = '2',  Flip_axis = 'Y', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_01'] = TD.get_tomo_bases(Flip_qubit = '3',  Flip_axis = 'Y', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_00'] = TD.get_tomo_bases(Flip_qubit = '1',  Flip_axis = 'Z', RO_list = logic_state+'_list')[RO_C]

    elif parity_orientations == ['positive','negative']:
        m.params['Tomo_Bases_01'] = TD.get_tomo_bases(Flip_qubit = '' ,  Flip_axis = '', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_00'] = TD.get_tomo_bases(Flip_qubit = '2',  Flip_axis = 'Y', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_11'] = TD.get_tomo_bases(Flip_qubit = '3',  Flip_axis = 'Y', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_10'] = TD.get_tomo_bases(Flip_qubit = '1',  Flip_axis = 'Z', RO_list = logic_state+'_list')[RO_C]

    elif parity_orientations == ['negative','positive']:
        m.params['Tomo_Bases_10'] = TD.get_tomo_bases(Flip_qubit = '' ,  Flip_axis = '', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_11'] = TD.get_tomo_bases(Flip_qubit = '2',  Flip_axis = 'Y', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_00'] = TD.get_tomo_bases(Flip_qubit = '3',  Flip_axis = 'Y', RO_list = logic_state+'_list')[RO_C]
        m.params['Tomo_Bases_01'] = TD.get_tomo_bases(Flip_qubit = '1',  Flip_axis = 'Z', RO_list = logic_state+'_list')[RO_C]

    ###################
    ### MBE settings ###
    ####################

    m.params['Nr_MBE']              = number_of_MBE_steps
    m.params['MBE_bases']           = mbe_bases
    m.params['MBE_threshold']       = MBE_threshold
    m.params['3qb_logical_state']   = logic_state

    ###################################
    ### Parity measurement settings ###
    ###################################

    m.params['Nr_parity_msmts']     = number_of_parity_msmnts
    m.params['Parity_threshold']    = 1

    m.params['Parity_a_carbon_list'] = [2,1]
    m.params['Parity_b_carbon_list'] = [5,1]

    m.params['Parity_a_RO_list'] = ['X','X']
    m.params['Parity_b_RO_list'] = ['X','X']

    ### Derive other parameters
    m.params['pts']                 = len(error_probability_list)
    m.params['sweep_name']          = 'Error Probability'
    m.params['sweep_pts']           = error_probability_list

    ### RO params
    m.params['electron_readout_orientation'] = el_RO

    funcs.finish(m, upload =True, debug=debug)