コード例 #1
0
def continousresist(chip, device):
    global slope_plots, app
    global windows, plots, curves, figures
    '''
    Get channels,card
    '''
    cards = inpfunc.get_cards(device)
    card1 = cards[0]
    card2 = cards[1]
    channels = inpfunc.get_channels(device)
    channel1 = channels[0]
    channel2 = channels[1]
    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass
    num_plots = 1
    curves = initialization(num_plots)

    windows[0].move(
        -900, 0)  # move to other desktop, spyder had been blocking before
    windows[0].setWindowState(QtCore.Qt.WindowActive)
    windows[0].raise_()

    # this will activate the window (yellow flashing on icon)
    windows[0].activateWindow()

    iv.constantrun(app, curves, card1, card2, channel1, channel2)
コード例 #2
0
def continuousResistTemp_Nathan(chip, device, target, tempSetpoint, PID,
                                manual):
    global slope_plots, app
    global windows, plots, curves, figures

    cards = inpfunc.get_cards(device)
    card1 = cards[0]
    card2 = cards[1]
    channels = inpfunc.get_channels(device)
    channel1 = channels[0]
    channel2 = channels[1]

    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    windows = lpf.create_windows(1)
    plot = lpf.create_plots(windows, formatt='Nathan')
    curve1 = plot[0].plot()
    curve2 = plot[0].plot()

    windows[0].move(
        -900, 0)  # move to other desktop, spyder had been blocking before
    windows[0].setWindowState(QtCore.Qt.WindowActive)
    windows[0].raise_()
    windows[0].activateWindow()

    R, T = iv.constantruntemp(app, curve1, curve2, card1, card2, channel1,
                              channel2, target, tempSetpoint, PID, manual)
コード例 #3
0
def continousResistTemp(chip, devices, folder, save):
    global slope_plots, app
    global windows, plots, curves, figures, current_point

    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    num_plots = len(devices)
    #curves = initialization(num_plots)
    windows = lpf.create_windows(num_plots)
    plots = lpf.create_plots(windows, formatt='RvsT')
    curves = lpf.create_curves(plots)
    current_point = lpf.create_current_point(plots)

    windows[0].move(
        -900, 0)  # move to other desktop, spyder had been blocking before
    windows[0].setWindowState(QtCore.Qt.WindowActive)
    windows[0].raise_()

    # this will activate the window (yellow flashing on icon)
    windows[0].activateWindow()
    i = 0

    for device in devices:
        cards = inpfunc.get_cards(device)
        card1 = cards[0]
        card2 = cards[1]
        channels = inpfunc.get_channels(device)
        channel1 = channels[0]
        channel2 = channels[1]
        print("Device name is %s" % device.name)
        R, T, Tc = iv.tempandresrun(app, curves[i], current_point[i], card1,
                                    card2, channel1, channel2)
        print("Sweep Up Tc is %f" % Tc[0])
        print("Sweep Down Tc is %f" % Tc[1])
        Tc = np.mean(Tc)
        print("Averaged Tc is %f" % Tc)
        if save:
            name = ic.create_name(chip, device)
            name = name.replace(
                " ",
                "_")  #For fixing problem in Fix Tc with spaces in device name
            ic.create_dir((folder + name))
            filename = folder + name + "_ResistvsTemp_raw.dat"
            iv.save_rt_data_live(R, T, filename)  #Save data to sharepoint
            d.save_Crossbar_Tc(chip, Tc, folder, device)  #Save Tc to database
        i = i + 1
コード例 #4
0
    def deviceselectionchange(self):
        current = self.Device.currentText()
        if current != 'Device':
            device = d.find_device(current)
            Input = inpfunc.format_input_Ic_Ir_devices([device], self.Jc)
            # print(input)
            cards = Input[0]
            channels = Input[1]
            chan1 = channels[0]
            chan2 = channels[1]
            sweeps = Input[2]
            Imin = sweeps[0]
            # Imin = "%0.2E" % Imin
            Imax = sweeps[1]
            # Imax = "%0.2E" % Imax
            step = Input[3]
            step = (float)("%0.2E" % step[0])
            # step = step[0]
            num_sweep = Input[4]

            self.channel1_EditField.setCurrentIndex(chan1 - 1)
            self.channel2_EditField.setCurrentIndex(chan2 - 1)

            if self.mA_button.isChecked():
                multplier = 1000
            else:
                multplier = 1
            print(cards)
            if not self.lockbutton.isChecked():
                self.I_min_EditField.setText(str(Imin * multplier))
                self.I_max_EditField.setText(str(Imax * multplier))
                self.step_EditField.setText(str(step * multplier))
                self.card_EditField.setText(str(cards[0]))
                self.card2_EditField.setText(str(cards[1]))
                self.step_helper.setCurrentIndex(0)

                # print("ok")
                self.sweep_EditField.setText(str(num_sweep[0]))
コード例 #5
0
def get_Ic_Iret_and_save(folder, folder_link, chip, devices,Jc, optionalic=0):
    '''
    Inputs is in format: [[cards], [channel1,channel2], [Imin,Imax], [steps], 
    [num_sweeps]]
    
    Chip must be the name of the chip. Devices should be in an array
    Folder_link is the web link to the folder
    

    :param Folder: Target folder for data to be saved
  
    :param Chip: Target Chip
   
    :param Devices: Devices on Target Chip
        
    :return: array of Ic(pos/neg) and Iret(pos/neg)
    
    :return: array of measurement ids (to pass to measure_Rn)
    
    :Graph: Overlays critical points in cyan on top of raw IV curve
    
    Called By: 
        
        -Measurement Functions
         
            -Measure_PCM_Chip_Cold
        
            -Measure_JJs_Ic
    
    Calls On:
        -automate_channel_IV_live
        
        -find_max_y_change_half_sweep
        
        -find_max_y_change
        
        -save_data_live
        
        -save_ic_data
        
        -save_JJ_Measurements_Ic
    '''
    global app
    global windows, plots, curves
    global my_exporters, current_point
    # get variables
    print("*******************")
    print(devices)
    inputs = inpfunc.format_input_Ic_Ir_devices(devices, Jc)
    cards = inputs[0]
    channels = inputs[1]
    currents = inputs[2]
    steps = inputs[3]
    sweeps = inputs[4]

    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    num_plots = len(devices)
    print("num plots: %d" %num_plots)

    # create windows, plots, and curves
    curves = initialization(num_plots)

    # we need two indexes, one for pairs, one for normal
    index_pairs = 0
    index = 0
    
    return_measurements = [] # the array that we will return
    meas_ids = [] # the array of measurment ids we will return

    my_exporters = [] # array to hold exporters (hopefully solves problem of C object being deleted)
    # create exporters
    for i in range(0, num_plots):
        exporter = exporters.ImageExporter(plots[i].scene())
        my_exporters.append(exporter)
    
    # take all the sweeps
    for i in range(0,num_plots):
        print("Begin Device %s sweep" %(i))
        # get two channels and two current limits that are needed
        my_channels = []
        my_currents = []
        my_channels.append(channels[index_pairs])
        my_channels.append(channels[index_pairs+1])
        
        # edit 7/19/18
        my_cards = []
        my_cards.append(cards[index_pairs])
        my_cards.append(cards[index_pairs+1])
        
        my_currents.append(currents[index_pairs])
        my_currents.append(currents[index_pairs+1])

        name = create_name(chip, devices[i]) # create the name
        plots[i].setTitle(name) # set title to name
        
        # show the grid
      

        # bring current window to focus        
        windows[i].move(-900, 0) # move to other desktop, spyder had been blocking before
        windows[i].setWindowState(QtCore.Qt.WindowActive)
        windows[i].raise_()
        
        # this will activate the window (yellow flashing on icon)
        windows[i].activateWindow()
        extra_res=0
        if "S1_1.5"  in devices[i].name  and devices[i].design_id[0].name =="PCM3A":
            extra_res=138.19 #originally 137.35
        if "A3_3.9" in devices[i].name and devices[i].design_id[0].name == "PCM3A":
            extra_res=138.37 #originally 138.33

        
        if optionalic !=0: # or design ==4: # higher precision around Ic, design is SingleJJ
            I,V,R = iv.automate_channel_IV_live(app, curves[index], current_point[index], my_cards, my_channels, my_currents, steps[index], sweeps[index], optionalic=optionalic,extra_res=extra_res)
#           
        # sweep the current device
        else: # optional value was not passed in
            I,V,R = iv.automate_channel_IV_live(app, curves[index], current_point[index], my_cards, my_channels, my_currents, steps[index], sweeps[index],extra_res=extra_res)
    
        if I==0 and V==0 and R==0:
            return 0,0

        num_JJ = devices[i].num_JJs # get the number of JJs for this dev
        print("num JJ: %s" %num_JJ)
        
        if optionalic != 0: # or design==4:
            critical_currents = iv.find_max_y_change_half_sweep(I,V, num_JJ)
        elif devices[i].name == 'S1_1.5' or devices[i].name == 'A3_3.9':
            critical_currents = iv.find_max_y_change(I,V, num_JJ,envelope = 50e-06)
        else:
            critical_currents = iv.find_max_y_change(I,V, num_JJ)
            
        # Plotting Critical Currents

        # arrays that will be saved
        critical_currents_save_I = []
        critical_currents_save_V = []

        # setting labels
        for n1 in range(0,len(critical_currents)):
            if n1 < 2:
                type_of_current = "I"+str(n1)
                label = pg.TextItem(text="", color=(0, 0, 0), fill=(0, 255, 255), anchor=(0, -1))

            else:
                type_of_current = "I"+str(n1)
                label = pg.TextItem(text="", color=(0, 0, 0), fill=(0, 255, 255), anchor=(0, 2))

            I_c = type_of_current+':(' + '{:.2E}'.format(I[critical_currents[n1]]) + ','+ '{:.2E}'.format(V[critical_currents[n1]]) + ')'
            label.setText(I_c)
            label.setPos(I[critical_currents[n1]], V[critical_currents[n1]])
            graph = plots[i]
            graph.addItem(label)
            current_toplot = critical_currents[n1]
            new_curve = plots[i].plot()
            new_curve.setData(I[current_toplot:current_toplot+1], V[current_toplot:current_toplot+1], symbol='o', symbolBrush='c', symbolSize=10)

            critical_currents_save_I.append(I[current_toplot])
            critical_currents_save_V.append(V[current_toplot])
              
        # Saving locally
        filename = (folder + name)
        print(filename)
        create_dir(filename)
       
                
        sub_folder = "/RawData"
        filename = (folder+sub_folder+name+"_Ic_raw.dat")
        create_dir(filename) # function to create dir if doesn't exist
        print(filename)
        iv.save_data_live(I,V,R,(folder+sub_folder+name+"_Ic_raw.dat")) # save the raw data
        
        sub_folder = "/Ic_values"
        filename = (folder+sub_folder+name)
        print(filename)
        create_dir(filename) # function to create dir if doesn't exist
        save_ic_data(critical_currents_save_I, critical_currents_save_V,(folder+sub_folder+name)) # save the important data
        
        sub_folder = "/Graphs"
        filename = (folder + sub_folder + name + "_Ic.png")
        print(filename)
        create_dir(filename) # function to create dir if doesn't exist
        
        return_measurements.append(critical_currents_save_I) # append to the final return array

       # Save to database
        meas_id = d.save_JJ_Measurements_Ic(chip, critical_currents_save_I, folder_link, devices[i])
        
        meas_ids.append(meas_id)
    
        try:
            my_exporters[i].export(filename) # export the graph
        except:
            sys.stdout = sys.__stdout__
            print("Oh noooooo wrapped object was deleted\n")
            
        
        # repeat
        index = index + 1
        index_pairs = index_pairs + 2

        app.processEvents()
        print("End Device %s sweep\n" %(i))
    
    return return_measurements, meas_ids
コード例 #6
0
def get_Rn_Imax(folder, chip, devices):
    global slope_plots, app
    global windows, plots, curves, my_exporters, figures
    '''
     Inputs:
        Folder-Target folder for data to be saved
        Chip-Target Chip
        Devices-Devices on Target Chip
    Outputs:
        return_measurements_Rn-Array of rn measurements
        return_measurements_Imax-array of Imax measurements
        2 graphs for each device, one has Rn, Imax
        s
    Called By: 
        Measurement Functions- MEasure_JJs_Rn
    Calls On:
        sweep_current_live_Rn
        save_Rn_data
    '''
    # get variables
    inputs = inpfunc.format_input_Rn_Imax_devices(devices)
    channels = inputs[0]
    num_JJ = inputs[1]
    cards = inputs[2]

    # arrays that will be returned
    return_measurements_Rn = []
    return_measurements_Imax = []

    # check instance, so that it doesn't crash on exit (hopefully)
    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    num_plots = len(num_JJ)
    # create windows, plots, curves
    curves = initialization(num_plots)
    x, y = lpf.create_data(curves)

    slope_plots = lpf.create_slope_plots(plots)

    # data collection
    counter = 0
    steps = 0.00008
    # create exporters (trying to fix problem of C object being deleted
    my_exporters = []
    for i in range(0, num_plots):
        scene = plots[i].scene()
        exporter = exporters.ImageExporter(scene)
        my_exporters.append(exporter)

    # loop through and plot slope
    # i incremets by 2, counter by 1
    # get current number of JJ and channels
    for i in range(0, len(channels), 2):
        num_j = num_JJ[counter]
        chan1 = channels[i]
        chan2 = channels[i + 1]
        card1 = cards[i]
        card2 = cards[i + 1]

        dev = devices[counter]
        ic_pred = d.predict_Ic(d.chip_Jc(chip), dev.JJ_radius_nom * 1e-06)
        steps = (ic_pred * 16) / 100
        print("-----------------")
        print(steps)

        # bring current window to focus
        windows[counter].move(
            -900, 0)  # move to other desktop, spyder had been blocking before
        windows[counter].setWindowState(QtCore.Qt.WindowActive)
        windows[counter].raise_()

        # this will activate the window (yellow flashing on icon)
        windows[counter].activateWindow()

        # plot, from zero, to at least V_max (num_j*2.5e-03) and stop when slope exceeds certain amount
        # see iv.sweep_current_live_Rn
        I, V, R, slope, slope_index = iv.sweep_current_live_Rn(
            app, curves[counter], 1, 0, num_j * 2.5e-03, steps, card1, card2,
            chan1, chan2, dev)
        if I == 0 and V == 0 and R == 0:
            return 0, 0

        # plot the slope and get the location it was plotted
        try:
            slope_index, slope = plot_slope(I, V, counter, slope, slope_index)
        except:
            print("\nERROR!\n")
            slope_index = 0
            slope = 1e-09

        # set label
        label = pg.TextItem(text=("Slope: " + str(slope)),
                            color=(0, 0, 0),
                            fill=(255, 0, 0),
                            anchor=(-.5, -.5))
        label.setPos(I[slope_index], V[slope_index])
        plots[counter].addItem(label)

        # append to total data
        x[counter] = I
        y[counter] = V

        # create name
        name = ic.create_name(chip, devices[counter])
        plots[counter].setTitle(name)
        # new fig
        #fig = plt.figure()
        #figures.append(fig)

        # plot differential
        #Rdiff = np.diff(V)/np.diff(I)
        #plt.plot(V[0:-1], Rdiff)

        # saving
        filename = (folder + name + "_Rn.png")
        ic.create_dir(filename)
        print(filename)
        iv.save_data_live(I, V, R, (folder + name + "_Rn_raw.dat"))
        plt.savefig(folder + name + '_Rn_Diff.png')

        return_measurements_Rn.append(slope / num_JJ[counter])
        return_measurements_Imax.append(I[slope_index + 5])
        save_Rn_data((slope / num_JJ[counter]), I[slope_index + 5],
                     folder + name)

        try:
            my_exporters[counter].export(filename)
        except:
            print("oh noooo, wrapped object was deleted\n")

        counter += 1
    return return_measurements_Rn, return_measurements_Imax
コード例 #7
0
def get_Rn_Imax_and_save(folder, folder_link, chip, devices, meas_ids):
    global slope_plots, app
    global windows, plots, curves
    global my_exporters
    '''
    
    :param folder: Target folder for data to be saved
    
    :param folder_link: Web Link to Folder
    
    :param chip: Target Chip
   
    :param devices: Array of Target devices
   
    :param  Meas_IDs: Array of Measurement Ids
   
    :return: return_measurements_Rn- Array of rn measurements
        
    :return: return_measurements_Imax-array of Imax measurements
      
    :Graphs: 1 Rn, 1 Imax for each device
    
    Saves in database after every run
   
    Called By: 
      
        -Measurement Functions- Measure_PCM_chip_cold
    
    Calls On:
       
        -sweep_current_live_Rn
        
        -save_Rn_data
    '''

    # get variables
    inputs = inpfunc.format_input_Rn_Imax_devices(devices)
    channels = inputs[0]
    num_JJ = inputs[1]
    cards = inputs[2]

    # arrays that will be returned
    return_measurements_Rn = []
    return_measurements_Imax = []

    # check instance, so that it doesn't crash on exit
    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    num_plots = len(num_JJ)

    # create windows, plots, curves
    curves = initialization(num_plots)
    x, y = lpf.create_data(curves)

    slope_plots = lpf.create_slope_plots(plots)

    # data collection
    counter = 0

    # create exporters (trying to fix problem of C object being deleted
    my_exporters = []
    for i in range(0, num_plots):
        scene = plots[i].scene()
        exporter = exporters.ImageExporter(scene)
        my_exporters.append(exporter)

    # loop through and plot slope
    # i incremets by 2, counter by 1
    for i in range(0, len(channels), 2):
        # get current number of JJ and channels
        num_j = num_JJ[counter]
        chan1 = channels[i]
        chan2 = channels[i + 1]
        card1 = cards[i]
        card2 = cards[i + 1]
        # create steps based on device, method: Ic*16/100
        dev = devices[counter]
        ic_pred = d.predict_Ic(d.chip_Jc(chip), dev.JJ_radius_nom * 1e-06)
        steps = (ic_pred * 16) / 100
        print("-----------------")
        print(steps)

        # bring current window to focus
        windows[counter].move(
            -900, 0)  # move to other desktop, spyder had been blocking before
        windows[counter].setWindowState(QtCore.Qt.WindowActive)
        windows[counter].raise_()

        # this will activate the window (yellow flashing on icon)
        windows[counter].activateWindow()

        # plot, from zero, to at least V_max (num_j*2.5e-03) and stop when slope exceeds certain amount
        # see iv.sweep_current_live_Rn

        I, V, R, slope, slope_index = iv.sweep_current_live_Rn(
            app, curves[counter], 1, 0, num_j * 4e-03, steps, card1, card2,
            chan1, chan2, dev)
        if slope is None:
            slope = 1e-09

        if I == 0 and V == 0 and R == 0:
            return 0, 0

        # plot the slope and get the location it was plotted
        try:
            slope_index_old, slope_old = plot_slope(I, V, counter, slope,
                                                    slope_index)
        except:
            print("\nERROR!\n")
            slope_index = 0
            slope = 1e-09
        # set label
        label = pg.TextItem(text=("Slope: " + str(slope)),
                            color=(0, 0, 0),
                            fill=(255, 0, 0),
                            anchor=(-.5, -.5))
        label.setPos(I[slope_index], V[slope_index])
        plots[counter].addItem(label)

        # append to total data
        x[counter] = I
        y[counter] = V

        # create name
        name = ic.create_name(chip, devices[counter])
        plots[counter].setTitle(name)

        # new fig
        #        fig = plt.figure()

        # plot differential
        #       Rdiff = np.diff(V)/np.diff(I)
        #     plt.plot(V[0:-1], Rdiff)

        #Saving Locally
        filename = (folder + name)
        print(filename)
        ic.create_dir(filename)

        sub_folder = "/RawData_Rn"
        filename = (folder + sub_folder + name + "_Rn_raw.dat")
        ic.create_dir(filename)  # function to create dir if doesn't exist
        print(filename)
        iv.save_data_live(
            I, V, R,
            (folder + sub_folder + name + "_Rn_raw.dat"))  # save the raw data
        # changed to here 2/15
        plt.savefig(folder + sub_folder + name + '_Rn_Diff.png')

        sub_folder = "/Rn_values"
        filename = (folder + sub_folder + name)
        print(filename)
        ic.create_dir(filename)  # function to create dir if doesn't exist

        return_measurements_Rn.append(slope / num_JJ[counter])
        try:
            return_measurements_Imax.append(I[slope_index + 5])
            save_Rn_data((slope / num_JJ[counter]), I[slope_index + 5],
                         filename)
        except:
            return_measurements_Imax.append(1e-09)
            save_Rn_data((slope / num_JJ[counter]), 1e-09, folder + name)

        sub_folder = "/Graphs"
        filename = (folder + sub_folder + name + "_Rn.png")
        print(filename)
        ic.create_dir(filename)  # function to create dir if doesn't

        try:
            my_exporters[counter].export(filename)
        except:
            print("oh noooo, wrapped object was deleted\n")

        # saving to database
        Rn = return_measurements_Rn[counter]
        Imax = return_measurements_Imax[counter]
        device = devices[counter]
        d.save_JJ_Measurements_Rn(chip, Rn, Imax, meas_ids[counter], device)

        counter = counter + 1
    return return_measurements_Rn, return_measurements_Imax
コード例 #8
0
def measure_SQUID_periodicity(folder, folder_link, chip, devices, save, manual,
                              minIflux, maxIflux, step, Ibias):
    global slope_plots, app
    global windows, plots, curves, figures

    number_of_sweeps = 5  #Changes the number of different Ibiases the Iflux sweep is done at

    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    num_plots = len(devices)
    windows = lpf.create_windows(num_plots)
    plots = lpf.create_plots(windows, formatt='VvsIflux')
    curves = lpf.create_curves(plots)
    current_point = lpf.create_current_point(plots)

    windows[0].move(
        -900, 0)  # move to other desktop, spyder had been blocking before
    windows[0].setWindowState(QtCore.Qt.WindowActive)
    windows[0].raise_()
    windows[0].activateWindow()

    i = 0
    for device in devices:
        cards = inpfunc.get_cards(device)
        card1 = cards[0]
        card2 = cards[1]
        channels = inpfunc.get_channels(device)
        channel1 = channels[0]
        channel2 = channels[1]

        if manual:
            period, Iflux_min_Ic, I, V = iv.sweep_current_vphi(
                app, curves[i], current_point[i], card1, card2, channel1,
                channel2, minIflux, maxIflux, step, Ibias, Ibias + 1, 1)
        else:
            measurements = d.show_squid_measurements_from_device(chip, device)
            average_Ic = get_average_Ic(measurements)
            Ibias_step = average_Ic / (number_of_sweeps + 1)
            Ibias_min = Ibias_step
            Ibias_max = average_Ic - Ibias_step
            period, Iflux_min_Ic, I, V = iv.sweep_current_vphi(
                app, curves[i], current_point[i], card1, card2, channel1,
                channel2, 0, 3e-03, 0.5e-05, Ibias_min, Ibias_max, Ibias_step)

        if save:
            new, meas = d.save_SQUID_periodicity(chip, period, Iflux_min_Ic,
                                                 folder, device)
            name = ic.create_name(chip, device)
            if new:
                ic.create_dir(folder + name)
            else:
                folder = 'E:/Users/volt.686QVACTEST/National Institute of Standards and Technology (NIST)/SEG - SFQ_Circuits' + '/' + meas.data_directory[
                    pg.find_D(meas.data_directory, chip):]
            iv.save_data(
                I, V,
                (folder + name + "_period_raw.dat"))  #Save data to sharepoint

        i = i + 1
コード例 #9
0
def measure_SQUID_IV_no_flux(folder, folder_link, chip, devices, save, manual,
                             min_Ibias, max_Ibias, step_Ibias):
    global slope_plots, app
    global windows, plots, curves, figures

    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    num_plots = len(devices)
    windows = lpf.create_windows(num_plots)
    plots = lpf.create_plots(windows, formatt='IV')
    curves = lpf.create_curves(plots)
    current_point = lpf.create_current_point(plots)
    ic_curves_all = []
    for i in range(len(plots)):
        ic_curves = []
        for j in range(4):
            ic_curves.append(plots[i].plot())
        ic_curves_all.append(ic_curves)

    windows[0].move(
        -900, 0)  # move to other desktop, spyder had been blocking before
    windows[0].setWindowState(QtCore.Qt.WindowActive)
    windows[0].raise_()
    windows[0].activateWindow()

    i = 0
    for device in devices:
        cards = inpfunc.get_cards(device)
        card1 = cards[0]
        card2 = cards[1]
        channels = inpfunc.get_channels(device)
        channel1 = channels[0]
        channel2 = channels[1]

        if manual:
            I, V, Ics = iv.sweep_current(app, curves[i], current_point[i],
                                         ic_curves_all[i], plots[i], card1,
                                         card2, channel1, channel2, min_Ibias,
                                         max_Ibias, step_Ibias)
        else:
            I, V, Ics = iv.sweep_current(app, curves[i], current_point[i],
                                         ic_curves_all[i], plots[i], card1,
                                         card2, channel1, channel2, -0.4e-03,
                                         0.4e-03, 0.005e-03)

        if save:
            new, meas = d.save_SQUID_no_flux(chip, Ics, folder, device)
            name = ic.create_name(chip, device)
            if new:  #If a new measurement was created, create a new folder
                ic.create_dir(folder + name)
            else:  #If the data was added to an existing measurement, add to existing folder
                folder = 'E:/Users/volt.686QVACTEST/National Institute of Standards and Technology (NIST)/SEG - SFQ_Circuits' + '/' + meas.data_directory[
                    pg.find_D(meas.data_directory, chip):]
            iv.save_data(
                I, V,
                (folder + name + "_Ic_raw.dat"))  #Save data to sharepoint

        i = i + 1
コード例 #10
0
def measure_SQUID_IV_with_flux(folder, folder_link, chip, device, save, down,
                               manual, min_Iflux, max_Iflux, step_Iflux,
                               min_Ibias, max_Ibias, step_Ibias):
    global slope_plots, app
    global windows, plots, curves, figures

    if manual:
        number_of_sweeps = len(np.arange(min_Iflux, max_Iflux, step_Iflux))
    else:
        number_of_sweeps = 5  #Changes the number of different Ifluxes that the I-V curve is taken at

    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    num_plots = 1
    windows = lpf.create_windows(num_plots)
    plots = lpf.create_plots(windows, formatt='VvsIbias')
    curves_full = []
    for i in range(0, len(plots)):
        curves = []
        for j in range(0, number_of_sweeps):
            curves.append(plots[i].plot())
        curves_full.append(curves)
    current_point = lpf.create_current_point(plots)

    windows[0].move(
        -900, 0)  # move to other desktop, spyder had been blocking before
    windows[0].setWindowState(QtCore.Qt.WindowActive)
    windows[0].raise_()
    windows[0].activateWindow()

    i = 0

    cards = inpfunc.get_cards(device)
    card1 = cards[0]
    card2 = cards[1]
    channels = inpfunc.get_channels(device)
    channel1 = channels[0]
    channel2 = channels[1]

    if manual:
        I, V, colorsused = iv.sweep_current_flux(app, curves_full[i],
                                                 current_point[i], card1,
                                                 card2, channel1, channel2,
                                                 min_Ibias, max_Ibias,
                                                 step_Ibias, min_Iflux,
                                                 max_Iflux, step_Iflux, down)
    else:
        measurements = d.show_squid_measurements_from_device(chip, device)
        period = get_average_period(measurements)
        Iflux_min_Ic = get_average_Iflux_min_Ic(measurements)
        I, V, colorsused = iv.sweep_current_flux(
            app, curves_full[i], current_point[i], card1, card2, channel1,
            channel2, -3e-03, 3e-03, 0.1e-03, Iflux_min_Ic - (period / 12),
            Iflux_min_Ic + (period / 12),
            (period / 6) / (number_of_sweeps - 1), True)

    return I, V, colorsused, windows[0]
コード例 #11
0
def get_Resistance(folder, chip, devices, OptionalCurrent=0):
    '''
    Sweep the current from 0 to 3mA and return the resistance.
    
    :param Folder: Target folder for data to be saved
  
    :param Chip: Target Chip
   
    :param Devices: Devices on Target Chip
        
    :return: return_measurements_Resistance-I,V,R arrays
    
    :return: funkygraphlist-List of abnormal graphs
    
    Called By: 
        
        -Measurement Functions
         
            -check_connections
        
            -Measure_PCM_Chip_Warm
    
    Calls On:
        
        -plot_Resistance_Array_live
        
        -save_Resistance_data_device
        
        -save_data_live
    
    '''

    # globals- necesarry to avoid automatic deletion of objects
    global app
    global windows, plots, curves, my_exporters
    # get variables
    inputs = inpfunc.format_input_resistance(devices)
    cards = inputs[0]
    channels = inputs[1]

    # create instance of the app
    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    # detect the number of plots need based on the cards, since there is a 1:1 ratio
    # between devices and cards (%use devices?)
    num_plots = len(devices)
    print("num plots: %d" % num_plots)

    # initialize by opening correct number of windows
    # each window contains a plot, each plot a curve and they are all stored in arrays
    curves = initialization(num_plots)

    # we need two indexes, one for pairs, one for normal
    index_pairs = 0
    index = 0

    my_exporters = []  # array to hold exporters

    # create exporters
    for i in range(0, num_plots):
        exporter = exporters.ImageExporter(plots[i].scene())
        my_exporters.append(exporter)

    return_measurements = []
    funkygraphlist = []
    # take all the sweeps
    for i in range(0, num_plots):
        print("Begin Device %s sweep" % (i))
        # get two channels and two current limits that are needed
        my_channels = []
        my_channels.append(channels[index_pairs])
        my_channels.append(channels[index_pairs + 1])

        my_cards = []
        my_cards.append(cards[index_pairs])
        my_cards.append(cards[index_pairs + 1])

        name = ic.create_name(chip, devices[i])  # create the name
        plots[i].setTitle(name)  # set title to name

        # bring current window to focus
        windows[i].move(
            -900, 0)  # move to other desktop, spyder had been blocking before
        windows[i].setWindowState(QtCore.Qt.WindowActive)
        windows[i].raise_()

        # this will activate the window (yellow flashing on icon)
        windows[i].activateWindow()
        extra_res = 0
        if "2x20" in devices[i].name and devices[i].design_id[
                0].name == "PCMRS":
            extra_res = 138.19
        if "10x40" in devices[i].name and devices[i].design_id[
                0].name == "PCMRS":
            extra_res = 138.37
        # sweep the current device
        max_current = 2e-03
        if OptionalCurrent != 0:
            max_current = OptionalCurrent
        I, V, R, funkygraphs = rc.plot_Resistance_Array_live(
            app,
            curves[i],
            my_cards[0],
            my_cards[1],
            my_channels[0],
            my_channels[1],
            max_current,
            continuity=True,
            extra_res=extra_res)

        try:
            m, b, r2, p, stdev = stats.linregress(I, V)
        except:
            m = 1e-09

        if funkygraphs:
            funkygraphlist.append(devices[i].name)

        if I == 0 and V == 0 and R == 0:
            return 0, 0

        slope = (V[-1] - V[0]) / (I[-1] - I[0])

        # Plotting Critical Currents #

        # arrays that will be returned
        return_measurements.append(m)

        # setting labels
        label = pg.TextItem(text="",
                            color=(0, 0, 0),
                            fill=(255, 0, 0),
                            anchor=(0, -1))

        # label text
        label_text = ("Resistance: %s" % slope)
        label.setText(label_text)
        label.setPos(I[int(len(I) / 2)], V[int(len(V) / 2)])
        graph = plots[i]
        graph.addItem(label)
        new_curve = plots[i].plot()
        new_curve.setData([I[0], I[-1]], [V[0], V[-1]],
                          symbol='o',
                          symbolBrush='r',
                          pen='r',
                          symbolSize=10)

        # Saving #

        filename = (folder + name + "_Resistance.png")
        print(filename)
        ic.create_dir(filename)  # function to create dir if doesn't exist

        iv.save_data_live(
            I, V, R,
            (folder + name + "_Resistance_raw.dat"))  # save the raw data
        save_Resistance_data_device(slope,
                                    (folder + name))  # save the important data

        try:
            my_exporters[i].export(filename)  # export the graph
        except:
            print("Oh no wrapped object was deleted!!!!!")

        # repeat
        index = index + 1
        index_pairs = index_pairs + 2

        app.processEvents()
        print("End Device %s sweep\n" % (i))
    return return_measurements, funkygraphlist
コード例 #12
0
def get_resistance_arrays(folder, chip, devices):
    '''
    Takes a sweep from 0 to 3mA and returns the slope
    
    :param Folder: Target folder for data to be saved
  
    :param Chip: Target Chip
   
    :param Devices: Devices on Target Chip
        
    :return: return_measurements_Resistance-I,V,R arrays
    
   
    
    Called By: 
        
        -Measurement Functions
         
            -Measure_PCM_Chip_Cold
        
            -Measure_PCM_Chip_Warm
    
    Calls On:
        
        -plot_Resistance_Array_live
        
        -plot_slope_Resistance_arrays
        
        -save_data_live
        
        -save_resistance_data
        
        -save_JJ_Measurements_Ic
    

    '''
    global slope_plots, app
    global windows, plots, curves, my_exporters

    # get variables
    inputs = inpfunc.format_input_resistance(devices)
    cards = inputs[0]
    channels = inputs[1]

    # arrays that will be returned
    return_measurements_Resistance = []

    # check instance, so that it doesn't crash on exit (hopefully)
    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    num_plots = int(len(cards) / 2)

    # create windows, plots, curves
    curves = initialization(num_plots)

    # data collection
    counter = 0

    # create exporters (trying to fix problem of C object being deleted)
    my_exporters = []
    for i in range(0, num_plots):
        scene = plots[i].scene()
        exporter = exporters.ImageExporter(scene)
        my_exporters.append(exporter)

    # loop through and plot slope
    # i incremets by 2, counter by 1
    for i in range(0, len(channels), 2):

        slope_plots = lpf.create_slope_plots_resistor_arrays(plots)

        # get current number of JJ and channels
        chan1 = channels[i]
        chan2 = channels[i + 1]
        card1 = cards[i]
        card2 = cards[i + 1]

        # bring current window to focus
        windows[counter].move(
            -900, 0)  # move to other desktop, spyder had been blocking before
        windows[counter].setWindowState(QtCore.Qt.WindowActive)
        windows[counter].raise_()

        # this will activate the window (yellow flashing on icon)
        windows[counter].activateWindow()

        # Sweep from 0 to 3 mA
        max_current = 3e-03
        # import pdb;pdb.set_trace()
        I, V, R, _ = rc.plot_Resistance_Array_live(app, curves[counter], card1,
                                                   card2, chan1, chan2,
                                                   max_current)
        # plot the slope and get the location it was plotted
        resistances, indicies = plot_slope_Resistor_Arrays(I, V, counter)
        print(resistances)

        # set label
        for i in range(0, len(resistances)):
            index = indicies[i]
            label = pg.TextItem(text=("Slope: " + str(resistances[i])),
                                color=(0, 0, 0),
                                fill=(255, 0, 0),
                                anchor=(-.5, -.5))
            label.setPos(I[index], V[index])
            plots[counter].addItem(label)

        # append to total data
        return_measurements_Resistance.append(resistances)

        # create name
        name = ic.create_name(chip, devices[counter])
        plots[counter].setTitle(name)

        # saving

        filename = (folder + name + "_Resistor_Array.png")
        print(filename)
        ic.create_dir(filename)

        iv.save_data_live(I, V, R, (folder + name + "_Resistor_Array_raw.dat"))

        save_resistance_data(resistances, folder + name)

        try:
            my_exporters[counter].export(filename)
        except:
            print("oh noooo, wrapped object was deleted\n")

        counter += 1

    return return_measurements_Resistance
コード例 #13
0
def get_Resistance_Via(folder, chip, devices):
    '''
    Sweeps from 0 to 3mA and returns the slope
    
    :param folder: folder name of where data will be saved
        
    :param chip: Target chip
    
    :param devices: Array of target devices
   
    :return:   return_measurements: I,V,R arrays
    
    Called By:
        
        Measurement_Functions
            
            -measure pcm cold and warm
   
    Calls On:
        
        -plot_Resistance_Array_live
        
        -save_data_live
        
        -save_Resistance_data_Via
    '''
    # globals- necesarry to avoid automatic deletion of objects
    global app
    global windows, plots, curves, my_exporters
    # get variables
    inputs = inpfunc.format_input_resistance(devices)
    cards = inputs[0]
    channels = inputs[1]

    # create instance of the app
    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    else:
        pass

    # detect the number of plots need based on the cards, since there is a 1:1 ratio
    # between devices and cards (%use devices?)
    num_plots = len(cards)
    print("num plots: %d" % num_plots)

    # initialize by opening correct number of windows
    # each window contains a plot, each plot a curve and they are all stored in arrays
    curves = initialization(num_plots)

    # we need two indexes, one for pairs, one for normal
    index_pairs = 0
    index = 0

    my_exporters = []  # array to hold exporters

    # create exporters
    for i in range(0, num_plots):
        exporter = exporters.ImageExporter(plots[i].scene())
        my_exporters.append(exporter)

    return_measurements = []
    # take all the sweeps
    for i in range(0, num_plots):
        print("Begin Device %s sweep" % (i))
        # get two channels and two current limits that are needed
        my_channels = []
        my_channels.append(channels[index_pairs])
        my_channels.append(channels[index_pairs + 1])

        name = ic.create_name(chip, devices[i])  # create the name
        plots[i].setTitle(name)  # set title to name

        # bring current window to focus
        windows[i].move(
            -900, 0)  # move to other desktop, spyder had been blocking before
        windows[i].setWindowState(QtCore.Qt.WindowActive)
        windows[i].raise_()

        # this will activate the window (yellow flashing on icon)
        windows[i].activateWindow()

        # sweep the current device
        max_current = .6e-03

        I, V, R = rc.plot_Resistance_Array_live(app, curves[i], cards[i],
                                                my_channels[0], my_channels[1],
                                                max_current)

        # find the slope
        slope = (V[-1] - V[0]) / (I[-1] - I[0])

        # Plotting Critical Currents #

        # arrays that will be returned
        return_measurements.append(slope)

        # setting labels
        label = pg.TextItem(text="",
                            color=(0, 0, 0),
                            fill=(255, 0, 0),
                            anchor=(0, -1))

        # label text
        label_text = ("Resistance: %s" % slope)
        label.setText(label_text)
        label.setPos(I[int(len(I) / 2)], V[int(len(V) / 2)])
        graph = plots[i]
        graph.addItem(label)

        # add red line to represent slope
        new_curve = plots[i].plot()
        new_curve.setData([I[0], I[-1]], [V[0], V[-1]],
                          symbol='o',
                          symbolBrush='r',
                          pen='r',
                          symbolSize=10)

        #Saving
        filename = (folder + name + "_Via.png")
        print(filename)
        ic.create_dir(filename)  # function to create dir if doesn't exist

        iv.save_data_live(
            I, V, R, (folder + name + "_Via_Raw.dat"))  # save the raw data
        save_Resistance_data_Via(slope,
                                 (folder + name))  # save the important data

        try:
            my_exporters[i].export(filename)  # export the graph
        except:
            print("Oh no wrapped object was deleted!!!!!")

        # repeat
        index = index + 1
        index_pairs = index_pairs + 2

        app.processEvents()
        print("End Device %s sweep\n" % (i))

    return return_measurements