Example #1
0
def sweep_current_flux(app, curves, current_point, card1, card2, channel1,
                       channel2, I_min, I_max, step, I_minflux, I_maxflux,
                       stepflux, down):
    """
    Inputs are min and max current for sweep, steps, card and channels for switch
    Returns an array with current steps, measured voltages, and calculated resistances
    
    """
    curve_colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k', 'w']

    I_values_all = []  #(Ibias)
    V_values_all = []

    current_x = []
    current_y = []

    ##INITIALIZATION OF HARDWARE##
    Voltmeter = vf.get_voltage()
    CurrentSource = vf.get_current()
    FluxSource = vf.get_current_flux()
    Switch = vf.get_switch()

    vf.intialize_switch_all(Switch)
    vf.intialize_current_yoko(CurrentSource, Irange, compliance_voltage)
    time.sleep(0.2)
    vf.intialize_current_yoko(FluxSource, Fluxrange, compliance_voltage)
    time.sleep(0.2)
    vf.intialize_voltage(Voltmeter, nplc, Vrange)
    vf.close_channel(Switch, card1, channel1)
    time.sleep(0.2)
    vf.close_channel(Switch, card2, channel2)  # instead of card, used to be 1
    time.sleep(0.2)
    vf.turnon_current_yoko(CurrentSource)
    time.sleep(0.2)
    vf.turnon_current_yoko(FluxSource)
    time.sleep(0.2)
    vf.open_short(Switch, card1, shorts)
    time.sleep(0.2)

    time.sleep(0.2)
    curve_counter = 0

    global go
    go = 1
    colorsused = []
    for Iflux in np.arange(I_minflux, I_maxflux, stepflux):
        I_values = []
        V_values = []
        vf.set_current_fast_yoko(FluxSource, Iflux)  #Set the flux current

        #vf.intialize_voltage(Voltmeter, nplc, Vrange)
        offset = vf.read_voltage_fast(Voltmeter, VDwellTime)
        time.sleep(0.2)
        ##CURRENT SWEEPS##
        #Sweep Current up
        print('Starting sweep up with Iflux =', Iflux)
        for I in np.arange(I_min, I_max, step):
            vf.set_current_fast_yoko(CurrentSource, I)
            V = vf.read_voltage_fast(Voltmeter, VDwellTime)
            I_values.append(I)
            V_values.append(V)

            current_x.append(I)
            current_y.append(V)

            curves[curve_counter].setData(
                I_values,
                V_values,
                symbol='o',
                symbolBrush=curve_colors[curve_counter % 8],
                symbolSize=5)

            current_point.setData(current_x,
                                  current_y,
                                  symbol='o',
                                  symbolBrush='r',
                                  symbolSize=7)
            app.processEvents()

            current_x = []
            current_y = []

            if go == 0:  #If the stop button on the GUI is pressed
                exitfunc(Switch, CurrentSource, card1, card2, channel1,
                         channel2)
                vf.set_current_fast_yoko(FluxSource, 0)
                return 0, 0, 0

        if down:
            print('Starting sweep down')
            #Sweep Current down
            for I in np.arange(I_max - step, I_min, -step):
                vf.set_current_fast_yoko(CurrentSource, I)
                V = vf.read_voltage_fast(Voltmeter, VDwellTime)
                I_values.append(I)
                V_values.append(V)

                current_x.append(I)
                current_y.append(V)

                curves[curve_counter].setData(
                    I_values,
                    V_values,
                    symbol='o',
                    symbolBrush=curve_colors[curve_counter % 8],
                    symbolSize=5)
                current_point.setData(current_x,
                                      current_y,
                                      symbol='o',
                                      symbolBrush='r',
                                      symbolSize=7)
                app.processEvents()

                current_x = []
                current_y = []

                if go == 0:  #If the stop button on the GUI is pressed
                    exitfunc(Switch, CurrentSource, card1, card2, channel1,
                             channel2)
                    vf.set_current_fast_yoko(FluxSource, 0)
                    return 0, 0, 0

        V_values = np.array(V_values)
        V_values = V_values - offset

        #SHUT IT DOWN!##
        print('Exited current sweep with Iflux =', Iflux)
        vf.set_current_fast_yoko(CurrentSource, 0)
        time.sleep(.1)
        I_values_all.append(I_values)
        V_values_all.append(V_values)
        colorsused.append(curve_colors[curve_counter % 8])
        curve_counter = curve_counter + 1

    print('Finished all current sweeps')
    #Safe all of the hardware
    vf.set_current_fast_yoko(FluxSource, 0)
    time.sleep(0.2)
    vf.close_short(Switch, card1, shorts)
    time.sleep(0.2)
    if channel1 != 10:
        vf.open_channel(Switch, card1, channel1)
        vf.open_channel(Switch, card2, channel2)

    #Iflux=np.arange(I_minflux, I_maxflux, stepflux)

    return I_values_all, V_values_all, colorsused
Example #2
0
def sweep_current_vphi(app, curve, current_point, card1, card2, channel1,
                       channel2, I_minflux, I_maxflux, Iflux_step, Ibias_min,
                       Ibias_max, Ibias_step):
    """
    Inputs are min and max current for sweep for flux of the SQUIDs, step
    Returns an array with current steps, measured voltages, and calculated resistances
    *********NOTE: This will have to be modified if the second current source is wired through the switch matrix
    """
    ##VARIABLE DECLARATIONS##
    #Going to use lists to start with for flexibility, even though slower than arrays
    I_values = []
    V_values = []

    current_x = []
    current_y = []

    ##INITIALIZATION OF HARDWARE##
    Voltmeter = vf.get_voltage()
    CurrentSource = vf.get_current()
    FluxSource = vf.get_current_flux()
    Switch = vf.get_switch()

    vf.intialize_switch_all(Switch)
    vf.intialize_current_yoko(
        CurrentSource, Irange, compliance_voltage
    )  #50 mA instead of 10 mA because we want a larger range for periodicity tests
    time.sleep(0.2)
    vf.intialize_current_yoko(FluxSource, 50e-03, compliance_voltage)
    time.sleep(0.2)
    vf.intialize_voltage(Voltmeter, nplc, Vrange)
    vf.close_channel(Switch, card1, channel1)
    time.sleep(0.2)
    vf.close_channel(Switch, card2, channel2)  # instead of card, used to be 1
    time.sleep(0.2)
    vf.turnon_current_yoko(CurrentSource)
    time.sleep(0.2)
    vf.turnon_current_yoko(FluxSource)
    time.sleep(0.2)
    vf.open_short(Switch, card1, shorts)
    time.sleep(0.2)

    offset = vf.read_voltage_fast(Voltmeter, VDwellTime)

    global go
    go = 1

    for Ibias in np.arange(Ibias_min, Ibias_max, Ibias_step):
        vf.set_current_fast_yoko(CurrentSource, Ibias)

        I = []
        V = []
        ##CURRENT SWEEPS##
        #Sweep Current up
        print('Starting sweep with Ibias = %f' % Ibias)
        for Iflux in np.arange(I_minflux, I_maxflux, Iflux_step):
            vf.set_current_fast_yoko(FluxSource, Iflux)
            Vread = vf.read_voltage_fast(Voltmeter, VDwellTime)
            I.append(Iflux)
            V.append(Vread)

            current_x.append(Iflux)
            current_y.append(Vread)

            curve.setData(I, V, symbol='o', symbolBrush='w', symbolSize=5)
            current_point.setData(current_x,
                                  current_y,
                                  symbol='o',
                                  symbolBrush='r',
                                  symbolSize=7)
            app.processEvents()

            current_x = []
            current_y = []

            if go == 0:  #If the stop button on the GUI is pressed
                exitfunc(Switch, CurrentSource, card1, card2, channel1,
                         channel2)
                vf.set_current_fast_yoko(FluxSource, 0)
                return 0, 0, 0

        vf.set_current_fast_yoko(CurrentSource, 0)
        vf.set_current_fast_yoko(FluxSource, 0)

        I = np.array(I)
        V = np.array(V)
        I_values.append(I)
        V_values.append(V - offset)

        if go == 0:  #If the stop button on the GUI is pressed
            exitfunc(Switch, CurrentSource, card1, card2, channel1, channel2)
            vf.set_current_fast_yoko(FluxSource, 0)
            return 0, 0, 0

    print("Exited current sweep")
    vf.set_current_fast_yoko(CurrentSource, 0)
    time.sleep(.2)
    vf.set_current_fast_yoko(FluxSource, 0)
    time.sleep(.2)
    vf.close_short(Switch, card1, shorts)
    time.sleep(0.2)
    if channel1 != 10:
        vf.open_channel(Switch, card1, channel1)
        vf.open_channel(Switch, card2, channel2)
    x = I
    y = np.full(np.shape(I), np.mean(V))
    current_point.setData(x, y, symbol='o', symbolBrush='g', symbolSize=7)
    return find_period(I_values, V_values)