# system setup
nmrObj.initNmrSystem()  # necessary to set the GPIO initial setting

nmrObj.deassertAll()

nmrObj.assertControlSignal(nmrObj.PSU_5V_TX_N_EN_msk | nmrObj.PSU_5V_ADC_EN_msk
                           | nmrObj.PSU_5V_ANA_P_EN_msk
                           | nmrObj.PSU_5V_ANA_N_EN_msk)

if ((target_freq < sta_freq) | (target_freq > sto_freq)):
    print("Warning: Target frequency out of range")

if (load_para):
    # parameter from
    (FreqList_S21, PeakVoltage,
     VvaracList, VbiasList) = data_parser.parse_csv_float4col_s11(
         para_folder, '/genS21Table_input_10k.txt')  # read file
    Vbias = VbiasList[[
        i for i, elem in enumerate(FreqList_S21)
        if abs(elem - target_freq) < 0.01
    ][0]]
    Vvarac = VvaracList[[
        i for i, elem in enumerate(FreqList_S21)
        if abs(elem - target_freq) < 0.01
    ][0]]

else:
    Vbias = -2.0
    Vvarac = 2.8

# (vbias vvarac)
nmrObj.setPreampTuning(Vbias, Vvarac)  #-2.5,  2.8)  # try -2.7, -1.8 if fail
    print('----------------------------------')
    print('plength = ' + str(pulse_us_sw[i]) + ' us')

    pulse1_us = pulse_us_sw[i]  # pulse pi/2 length
    pulse2_us = 1.5 * pulse_us_sw[i]  #pulse1_us*1.8   # pulse pi length
    P90[i] = pulse1_us
    P180[i] = pulse2_us
    #cpmg_freq=cpmg_freq

    # compensate for setup
    freq_comp = cpmg_freq + 0.10
    freqS21_comp = cpmg_freq
    if (load_para):
        # parameter from
        (FreqList, s11List, CparList,
         CserList) = data_parser.parse_csv_float4col_s11(
             para_folder, '/genS11Table_final_input_10k.txt')  # read file
        Cpar = int(CparList[[
            i for i, elem in enumerate(FreqList)
            if abs(elem - freq_comp) < 0.01
        ][0]])
        Cser = int(CserList[[
            i for i, elem in enumerate(FreqList)
            if abs(elem - freq_comp) < 0.01
        ][0]])

        (FreqList_S21, PeakVoltage, VvaracList,
         VbiasList) = data_parser.parse_csv_float4col_s11(
             para_folder, '/genS21Table_input_10k.txt')  # read file
        Vbias = VbiasList[[
            i for i, elem in enumerate(FreqList_S21)
            if abs(elem - freqS21_comp) < 0.01
Example #3
0
min_freq = 0.001
max_freq = 4#12.5

# system setup
nmrObj.initNmrSystem()  # necessary to set the GPIO initial setting
nmrObj.assertControlSignal( nmrObj.PSU_15V_TX_P_EN_msk | nmrObj.PSU_15V_TX_N_EN_msk | nmrObj.PSU_5V_TX_N_EN_msk |
                           nmrObj.PSU_5V_ADC_EN_msk | nmrObj.PSU_5V_ANA_P_EN_msk |
                           nmrObj.PSU_5V_ANA_N_EN_msk )
nmrObj.deassertControlSignal( 
    nmrObj.PSU_15V_TX_P_EN_msk | nmrObj.PSU_15V_TX_N_EN_msk )

freq_comp = target_freq+0.10
freqS21_comp = target_freq
if (load_para):
    # parameter from 
    ( FreqList, s11List, CparList, CserList ) = data_parser.parse_csv_float4col_s11( 
        para_folder, '/genS11Table_final_input_10k.txt' )  # read file
    Cpar = int(CparList[[i for i, elem in enumerate( FreqList ) if abs( elem - freq_comp) < 0.01][0]])
    Cser = int(CserList[[i for i, elem in enumerate( FreqList ) if abs( elem - freq_comp) < 0.01][0]])
    
    #Cpar = 0
    #Cser = 0
    
    ( FreqList_S21, PeakVoltage, VvaracList, VbiasList ) = data_parser.parse_csv_float4col_s11( 
        para_folder, '/genS21Table_input_10k.txt' )  # read file
    Vbias = VbiasList[[i for i, elem in enumerate( FreqList_S21 ) if abs( elem - freqS21_comp) < 0.01][0]]
    Vvarac = VvaracList[[i for i, elem in enumerate( FreqList_S21 ) if abs( elem - freqS21_comp) < 0.01][0]]
    
else:
    Cpar = 563
    Cser = 327
    Vbias = -2.0
Example #4
0
    return S11dB, minS11_freq


if ((target_freq < sta_freq) | (target_freq > sto_freq)):
    print("Warning: Target frequency out of range")

# find reference
print('Generate reference.')
S11mV_ref, minS11Freq_ref = runExpt(
    0, 0, 0,
    0)  # background is computed with no capacitor connected -> max reflection
freq = target_freq - 0.04  # freq compensation
if (load_para):
    # parameter from
    (FreqList, s11List,
     CparList, CserList) = data_parser.parse_csv_float4col_s11(
         para_folder, '/genS11Table_final_input.txt')  # read file
    Cpar = int(CparList[[
        i for i, elem in enumerate(FreqList) if abs(elem - freq) < 0.05
    ][0]])
    Cser = int(CserList[[
        i for i, elem in enumerate(FreqList) if abs(elem - freq) < 0.05
    ][0]])

else:
    Cpar = 598
    Cser = 352

while True:
    runExpt(Cpar, Cser, S11mV_ref, 1)