def tryitout():

    options = [
        "datacollect", "manualguess", "gridsearch", "least sq", "indexknot"
    ]
    for num, option in enumerate(options, 1):
        print(num, option)
    method = int(input("Pick an method: \n"))

    if method == 1:
        '''
        Collect and saves data in Python Dictionary
        '''
        print("Data successfully saved with filename %s" % collectData())

    elif method == 2:
        '''
            Mainly used for data exploration in early stages, allows you to manually tune the <a> and <b> parameters
            '''
        with open('measureRNData.pickle', 'rb') as handle:
            fulldict = pickle.load(handle)
        chipname = "D180802-I6"
        chip = db.find_chip(chipname)
        for i, dev in enumerate(db.show_devices_from_chip(chip)):
            print("%d : %s" % (i, dev.name))
        devnum = int(input("Pick a device to use"))
        #for i in range(len(db.show_devices_from_chip(chip))-1,0,-1):
        happy = False
        device = db.show_devices_from_chip(chip)[devnum]
        if chip.name + "_" + device.name in exceptionlist:
            pass
        else:
            numjjs = device.num_JJs
            sconst = (device.JJ_radius_nom - .12) / 1000
            while not happy:
                a = int(input("Enter an alpha"))
                b = int(input("Enter an Beta"))
                I = fulldict[chip.name][device.name]["Ivals"]
                index = fulldict[chip.name][device.name]["Index"]
                I2 = I[:index]
                V = fulldict[chip.name][device.name]["Vvals"]
                V2 = V[:index]
                mse = 0
                for i in range(0, len(I2)):
                    iguess = numjjs * sconst * (
                        a * np.abs(V2[i]) +
                        b * np.power(np.abs(V2[i]), (7 / 3)))
                    mse += (I2[i] - iguess)**2
                mse = mse / len(I2) * 100000

                print("Min Mse is %.6f with min b is %d" % (mse, b))
                plt.figure()
                plt.plot(V, I, 'b')
                plt.plot(V2, I2, 'r')
                plt.plot(
                    V2,
                    numjjs * sconst *
                    (a * np.abs(V2) + b * np.power(np.abs(V2), (7 / 3))), 'g')
                plt.show()
                happy = int(input("1 if happy,0 otherwise"))

    elif method == 3:
        '''
            Naive linear grid search for best parameters for <a> and <b>
            '''
        with open('measureRNData.pickle', 'rb') as handle:
            fulldict = pickle.load(handle)
        for chipend in chipsused:
            chipname = "D180802-" + chipend
            chip = db.find_chip(chipname)
            minchipmse = 1000000000000000
            minchipa = 0
            minchipb = 0
            devname = 0

            for device in db.show_devices_from_chip(chipname):
                if chip.name + "_" + device.name in exceptionlist:
                    pass
                else:
                    numjjs = device.num_JJs
                    sconst = (device.JJ_radius_nom - .12) / 1000
                    alpha = np.linspace(1, 3, num=40)
                    beta = np.linspace(2000, 5000, num=40)
                    index = fulldict[chip.name][device.name]["Index"]
                    I = fulldict[chip.name][device.name]["Ivals"]
                    I = I[:index]
                    V = fulldict[chip.name][device.name]["Vvals"]
                    V = V[:index]
                    fulldict[chip.name][device.name]["Alphabeta"] = [0, 0]
                    fulldict[chip.name][device.name]["MSE"] = 0
                    fulldict[chip.name][device.name]["r2"] = 3
                    minmse = 1000000
                    mina = 0
                    minb = 0

                    for a in alpha:
                        for b in beta:
                            mse = 0
                            for i in range(0, len(I)):
                                iguess = numjjs * sconst * (
                                    a * V[i] + b * np.power(V[i], (7 / 3)))
                                mse += (I[i] - iguess)**2
                            mse = mse / len(I)
                            if mse < minmse:
                                mina = a
                                minb = b
                                minmse = mse
                                fulldict[chip.name][
                                    device.name]["Alphabeta"] = [a, b]
                                fulldict[chip.name][
                                    device.name]["MSE"] = minmse

                                fulldict[chip.name][
                                    device.name]["r2"] = r2_score(
                                        I,
                                        numjjs * sconst *
                                        (a * V + b * np.power(V, (7 / 3))))
                    if minmse < minchipmse:
                        minchipmse = minmse
                        minchipa = mina
                        minchipb = minb
                        devname = device.name

            print("Minmse for chip %s is %f with a %f and b %f on device %s" %
                  (chipname, minmse, minchipa, minchipb, devname))
        alla = []
        allb = []
        allr = []
        devnames = []
        for chipend in chipsused:
            chipname = "D180802-" + chipend
            chip = db.find_chip(chipname)
            for device in db.show_devices_from_chip(chipname):
                if chip.name + "_" + device.name in exceptionlist:
                    pass
                else:
                    if device.device_type != "SingleJunction":
                        devnames.append(device.name)
                        alla.append(
                            fulldict[chip.name][device.name]["Alphabeta"][0])
                        allb.append(
                            fulldict[chip.name][device.name]["Alphabeta"][1])
                        allr.append(fulldict[chip.name][device.name]["r2"])
                        plt.bar(devnames, alla)
        pdb.set_trace()

    elif method == 4:
        '''
        Using Scipy's least squares optimizer to find the best alpha and beta for each graph, both with and without the equality constraint at the knot
        
        Found large deviation in the single junctions but some promise in the arrays
        '''

        constraint = int(input("1 for index constraint, 0 for no constraint"))

        alla = []
        allb = []
        allsc = []

        with open('measureRNData.pickle', 'rb') as handle:
            fulldict = pickle.load(handle)
        for chipend in chipsused:
            chipname = "D180802-" + chipend
            chip = db.find_chip(chipname)
            for device in db.show_devices_from_chip(chipname):
                if chip.name + "_" + device.name in exceptionlist:
                    pass
                else:
                    numjjs = device.num_JJs
                    sconst = (device.JJ_radius_nom - .12) / 1000
                    allsc.append(sconst)
                    index = fulldict[chip.name][device.name]["Index"]
                    I = fulldict[chip.name][device.name]["Ivals"]
                    I = I[:index]
                    V = fulldict[chip.name][device.name]["Vvals"]
                    V = V[:index]

                    if constraint == 1:
                        lam = 10000
                        '''
                        Least squares objective function with additional constraint that the point passes through the index point
                        '''
                        func = lambda x: numjjs * sconst * (x[0] * V + x[
                            1] * np.power(V, (7 / 3))) - I + lam * (
                                numjjs * sconst * (x[0] * V[-1] + x[
                                    1] * np.power(V[-1], (7 / 3))) - I[-1])

                    else:
                        func = lambda x: numjjs * sconst * (x[0] * V + x[
                            1] * np.power(V, (7 / 3))) - I
                    est_a, est_b = leastsq(func, [2, 200])[0]

                    if np.isnan(est_a):
                        est_a = 0
                    if np.isnan(est_b):
                        est_b = 0
                    fulldict[chip.name][device.name]["Alphabeta"] = [
                        est_a, est_b
                    ]
                    alla.append(
                        fulldict[chip.name][device.name]["Alphabeta"][0])
                    allb.append(
                        fulldict[chip.name][device.name]["Alphabeta"][1])

        plt.figure()
        xvals = list(range(len(alla)))

        #Graph of the <a>'s found for each device and the difference between them
        plt.subplot(1, 3, 1)
        plt.plot(xvals, alla)
        plt.plot(xvals[:-1], np.diff(alla))

        #Graph of the <b>'s found for each device
        plt.subplot(1, 3, 2)
        plt.plot(xvals, allb)
        plt.subplot(1, 3, 3)
        plt.plot(xvals, np.array(alla) * np.array(allsc))
        plt.show()

    elif method == 5:
        with open('measureRNData.pickle', 'rb') as handle:
            fulldict = pickle.load(handle)
            delta = []
            delta2 = []
        for chipend in chipsused:
            chipname = "D180802-" + chipend
            chip = db.find_chip(chipname)
            for device in db.show_devices_from_chip(chipname):
                guesses = []
                alla = []
                allb = []
                allm = []
                alli = []
                if chip.name + "_" + device.name in exceptionlist:
                    pass
                else:
                    numjjs = device.num_JJs
                    sconst = (device.JJ_radius_nom - .12) / 1000
                    I = fulldict[chip.name][device.name]["Ivals"]
                    V = fulldict[chip.name][device.name]["Vvals"]
                    index = fulldict[chip.name][device.name]["Index"]
                    # count=1
                    passes = 0
                    #plt.figure()
                    if index is None:
                        pass
                    else:
                        offset = 20
                        step = 2
                        leftcut = 6
                        rightcut = 50
                        lam = 10000
                        rightimp = 7
                        leftimp = 3
                        for xpos in range(index - offset, index + offset,
                                          step):

                            Ileft = I[leftcut:xpos]
                            Iright = I[xpos:xpos + rightcut]
                            Vleft = V[leftcut:xpos]
                            Vright = V[xpos:xpos + rightcut]
                            if len(Vright) > 0:
                                Iknot = Ileft[-1]
                                Vknot = Vleft[-1]
                                guess = lambda x: numjjs * sconst * (x[
                                    0] * Vleft + x[1] * np.power(
                                        Vleft, (7 / 3))) - Ileft + lam * (
                                            numjjs * sconst *
                                            (x[0] * Vknot + x[1] * np.power(
                                                Vknot, (7 / 3))) - Iknot)
                                a, b = leastsq(guess, [2, 200])[0]

                                if np.isnan(a) or np.isnan(
                                        b):  # or np.isnan(right_m):
                                    pass
                                    passes += 1

                                else:
                                    m, intercept, r, _, _ = linregress(
                                        Vright, Iright)
                                    leftrscore = r2_score(
                                        Ileft,
                                        numjjs * sconst *
                                        (a * Vleft +
                                         b * np.power(Vleft, (7 / 3))))
                                    rightrscore = r**2
                                    fit = rightimp * leftrscore + leftimp * rightrscore
                                    alla.append(a)
                                    allb.append(b)
                                    allm.append(m)
                                    alli.append(intercept)
                                    guesses.append(fit)
                            else:
                                pass
                        '''
                        plt.subplot(5,8,count)
                        count+=1
                        plt.title("%s with xpos %d" %(device.name,xpos))
                        plt.plot(V,I,'b')
                        plt.plot(Vleft,Ileft,'r')
                        plt.plot(Vleft,numjjs*sconst*(a*np.abs(Vleft)+b*np.power(np.abs(Vleft),(7/3))),'g')
                        plt.plot(Vright,intercept+m*Vright)
                        plt.show()
                        '''
                        #pdb.set_trace()
                    if guesses and index is not None:
                        guess = np.argmax(guesses)
                        xbest = index - offset + step * guess + step * passes

                        print("Guess is %d and ground truth is %d" %
                              (xbest, index))
                        delta.append(abs(xbest - index))
                        delta2.append(xbest - index)
                    else:
                        print(
                            "Something is wrong with chip %s,device %s, no guesses"
                            % (chip.name, device.name))
                    '''
                    plt.figure()
                    plt.title("Best found position for %s"%device.name)
                    plt.plot(V,I,'b')
                    plt.plot(V[:xbest],numjjs*sconst*(a*np.abs(V[:xbest])+b*np.power(np.abs(V[:xbest]),(7/3))),'g')
                    plt.plot(V[xbest:],intercept+m*V[xbest:])
                    plt.show()
                    '''
        print("Average is %f" % np.mean(delta))
        plt.figure()
        plt.plot(range(len(delta)), delta2)
        plt.show()
        pdb.set_trace()
    elif method == 6:
        '''
예제 #2
0
    def plotter(self):
        # Clear graph
        try:
            self.my_graph1.plot.clear()
        except:
            pass
        # Get inputs
        inputs = self.getInput()

        # Format: [I_min, I_max, step, card, card2, channel1, channel2, sweep]
        # -1 if all are numbers, gives location of error otherwise
        wrong_box = self.checkValues(inputs)

        # units
        if self.mA_button.isChecked():
            multiplier = 1e-03
        else:
            multiplier = 1
        # Plotting:
        if wrong_box == -1:
            # converting from strings to int or float
            #for i in range(len(inputs)):
            #   try:
            #      inputs[i] = int(inputs[i])
            # except:
            #    inputs[i] = float(inputs[i])
            # print(variables) # for test purposes
            if "Increment" in self.step_helper.currentText():
                number = False
            else:
                number = True

            inputs[2] = iv.calc_steps(inputs[0], inputs[1], inputs[2], number)
            # print(inputs[2])
            title_text = "I-V Curve for %s_%s" % (self.Chip.currentText(),
                                                  self.Device.currentText())
            g = self.my_graph1
            plot = g.plot
            g.plot.setTitle(title_text)
            self.data = [0]
            curves = []
            for i in range(0, inputs[6]):
                self.curve = g.plot.getPlotItem().plot()
                curves.append(self.curve)
            # print("here")
            # print(inputs)
#            iv.plot_IV_test(app,curves,inputs[6],inputs[0],inputs[1],inputs[2],inputs[3],inputs[4],inputs[5])
# print("here1")
# order of inputs: app, curve, num_sweeps, min, max, step, card, chan1, chan2
#            print(float(self.step_EditField.text()))

# Format: [I_min, I_max, step, card, card2, channel1, channel2, sweep]

            I_min = inputs[0] * multiplier
            I_max = inputs[1] * multiplier
            step = inputs[2] * multiplier
            card1 = inputs[3]
            card2 = inputs[4]
            channel1 = inputs[5]
            channel2 = inputs[6]
            sweep = inputs[7]
            chip = d.find_chip(self.Chip.currentText())
            device = d.find_device(self.Device.currentText())
            iv.sweep_current_live_GUI(app, plot, curves, sweep, I_min, I_max,
                                      step, card1, card2, channel1, channel2,
                                      self.Save, chip, device)
            # Format: (app, curves, number_of_sweeps, I_min, I_max, step, card1, card2, channel1, channel2)

        # self.timer = QtCore.QTimer()
        # self.timer.timeout.connect(self.update)
        # self.timer.start(0)

        else:
            warning_box = QtWidgets.QMessageBox()
            if (wrong_box == 0):
                warning_box.setText("Increment is too big.")
            else:
                warning_box.setText(
                    self.whichBox(wrong_box) + " needs to be a number.")
            warning_box.exec_()
예제 #3
0
def measure_PCM_chip_cold(chip, devices, optionalic=0):
    '''
    This is the main function to call when PCM chip is fully dunked. Will 
    measure and save the ICs of all the Junctions, then the resistances of the
    resistor arrays and vias, then the normal resistance of the junctions.
    
    :param chip: Target chip
    
    :param devices: Array of target devices
   
    :param optionalIC: Optional input Ic
    
    :Graphs: IV and RN graphs
    
    Called By:
        
        -Measurement_GUI_v3-coldmeasure
    
    Calls On:
        
        -Get_Ic_Iret_and_save
        
        -get_resistance_arrays
        
        -get_resistance_Via
        
        -save_Resistance_Measurements_cold
        
        -save_Via_Measurements_cold
        
        -get_Rn_Imax_and_save
    '''
    current_time = time.strftime("_%Y-%m-%d_%H-%M-%S_cold")
    folder = dirname + str(chip) + current_time
    folder_link = web_link + str(chip) + current_time
    Jc = d.chip_Jc(chip)
    print("Weblink: %s" % folder_link)

    # sort the devices into Junctions, Resistors, and Vias
    JJs = []
    RAs = []
    Vias = []

    for i in range(0, len(devices)):
        if devices[i].device_type == 'ResistorArray':
            RAs.append(devices[i])
        elif devices[i].device_type == 'Via':
            Vias.append(devices[i])
        else:
            JJs.append(devices[i])

    # added 1/18/18, not tested yet
    design = d.find_chip(chip).design_id

    if design == 4 and optionalic == 0:
        print("\nYou are measuring a SingleJJ design without passing in an \
              optional ic. In order to take a high point density sweep you \
              must pass in an optional ic.")

    # take IV curves for all Junctions, save after each device
    if optionalic == 0:  # optional was not passed in
        Ic_measurements, meas_ids = ic.get_Ic_Iret_and_save(
            folder, folder_link, chip, JJs, Jc)
    else:  # optional was passed in, pass on to next function
        Ic_measurements, meas_ids = ic.get_Ic_Iret_and_save(
            folder, folder_link, chip, JJs, Jc, optionalic=optionalic)

    # if there was a keyboard interrupt, do not continue
    if Ic_measurements == 0 and meas_ids == 0:
        return

    # take the sweep to find the resistance of the Resistor Arrays
    Resistance_measurements = mra.get_resistance_arrays(folder, chip, RAs)
    # save the resistance measurements
    for i in range(0, len(Resistance_measurements)):
        try:
            d.save_Resistance_Measurements_cold(chip,
                                                Resistance_measurements[i],
                                                folder_link, RAs[i])
        except:
            pass

    # take the sweep to find the resistance of the Vias
    Via_measurements = mvr.get_Resistance_Via(folder, chip, Vias)
    # save the via measurements
    for i in range(0, len(Via_measurements)):
        try:
            d.save_Via_Measurements_cold(chip, Via_measurements[i],
                                         folder_link, Vias[i])
        except:
            pass

    # find normal resistance for all Junctions, save after each
    if optionalic == 0 and meas_ids != 0:  # only do if Ic was not passed in, and there was a return for meas_id
        # Note: meas_ids will be 0 iff there was a keyboard interrupt handled
        Rn_measurements, Imax_measurements = rn.get_Rn_Imax_and_save(
            folder, folder_link, chip, JJs, meas_ids)

    print("Weblink: %s" % folder_link)
예제 #4
0
def plot_Rn_radius_from_GUI(app, plot, Chip, dev_type):
    """
    Plots 1/RN vs Device Radius
    
    :param app: pyqtgraph construct
    
    :param plot: pyqtgraph constuct
    
    :param Chip: Target Chip
    
    :param dev_type: Device Type
    
    :return: m- slope of trendline
    
    :return: b- intercept of trendline
    
    :return: r2- R^2 fit (number between 0 and 1), gives linearity of trendline
   
    :Graphs:  1/RN on y axis and Device Radius on x axis
    
    Called By:
   
        -Measurement_GUI_V3-rnReport
    
    Calls On:
   
        -Database V4
            
            -show_devices_from_chip
            
            -show_measurements_from_device
        
    """

    import database_v4 as d
    from math import sqrt

    plot.clear()

    chip = d.find_chip(Chip)

    if not chip:
        return -1

    unfiltered_devices = d.show_devices_from_chip(chip.id)
    devices = []

    for dev in unfiltered_devices:
        if dev.device_type == dev_type:
            devices.append(dev)

    if not devices:
        return -1

    curve = plot.plot()
    curve2 = plot.plot()

    # curve.showButtons()

    radii = []
    i_root_rn = []
    zero_radii = []
    zero_rn = []

    for dev in devices:
        radii.append(dev.JJ_radius_nom * 1e-06)
        rn = d.show_measurements_from_device(chip, dev)[1]
        print(rn)
        if rn <= 0:
            i_root_rn.append(0)

        else:
            i_root_rn.append(1 / sqrt(rn))
    # linear fit, remove zero's
    for index, element in enumerate(i_root_rn):
        if element == 0:
            zero_radii.append(radii[index])
            zero_rn.append(i_root_rn[index])
            del i_root_rn[index]
            del radii[index]

    plot.showGrid(x=True, y=True, alpha=0.3)
    plot.setLabel('left', '1/Rn', 'Ohms')
    plot.setLabel('bottom', 'Device Radius', 'm')
    plot.getAxis('bottom').setTicks(None)
    curve.setData(radii,
                  i_root_rn,
                  symbol='o',
                  symbolBrush='w',
                  symbolSize=5,
                  pen=None)
    curve2.setData(zero_radii,
                   zero_rn,
                   symbol='o',
                   symbolBrush='r',
                   symbolSize=5,
                   pen=None)

    import numpy as np
    m, b = np.polyfit(radii, i_root_rn, 1)
    a, c, r, p, std_err = stats.linregress(radii, i_root_rn)
    r2 = r**2
    lin_x = []
    lin_y = []
    lin_curve = plot.plot()
    for i in np.arange(0, radii[-1] * 2, (radii[-1] * 2) / 100):
        lin_x.append(i)
        lin_y.append(m * i + b)
        lin_curve.setData(lin_x, lin_y)

    return m, b, r2
예제 #5
0
def plot_product_device_from_GUI(app, plot, Chip):
    """
    Plots Ic*RN for each Device on a Chip
   
    :param app: pyqtgraph construct
    
    :param plot: pyqtgraph constuct
    
    :param Chip: Target Chip
    
    :param dev_type: Device Type
    
    
    :return: m- slope of trendline
    
    :return: b- intercept of trendline
    
    :return: r2- R^2 fit (number between 0 and 1), gives linearity of trendline
   
    :Graphs: Ic*RN product on y axis and device on x axis
    
    Called By:
   
        -Measurement_GUI_V3-productReport
    
    Calls On:
   
        -Database V4
            
            -show_devices_from_chip
            
            -show_measurements_from_device
    """

    import database_v4 as d

    plot.clear()

    chip = d.find_chip(Chip)

    if not chip:
        return -1

    devices = d.show_devices_from_chip(chip.id)

    curve = plot.plot()

    ic_rn_product = []

    x_axis = []
    x_label = []
    for j in range(0, len(devices)):
        # Query database, returns [Ic, Rn]
        data = d.show_measurements_from_device(chip, devices[j])
        ic_rn_product.append(data[0] * data[1])

        x_axis.append(j)
        x_label.append(devices[j].name)

        curve.setData(x_axis,
                      ic_rn_product,
                      pen=None,
                      symbol='o',
                      symbolSize=5,
                      symbolBrush='w')

    x_label = dict(enumerate(x_label))

    plot.getAxis('bottom').setTicks([x_label.items()])
    plot.showGrid(x=True, y=True, alpha=0.3)
    plot.setLabel('left', 'Ic*Rn', 'A*Ohms')
    plot.setLabel('bottom', 'Device')
예제 #6
0
def plot_IV_from_GUI(app, plot, Chip, Device):
    """
    Plots an Raw IV curve for a single device
    
    :param app: pyqtgraph construct
    
    :param plot: pyqtgraph constuct
    
    :param Chip: Target Chip
    
    :param Device: Target Device 
    
    
    :Graphs: Voltage on y axis and Current on x axis
   
    Called By:
    
        -Measurement_GUI_V3-Plot
    
    Calls on:
    
        -Database V4
        
            -Show_devices_from_chip
            
            -show_measurements_from_device

    """
    import numpy as np
    from urllib.request import urlopen
    import database_v4 as d
    import pyqtgraph as pg
    path = "C:/Users/sdk/Downloads/"
    path = "E:/Users/volt.686QVACTEST/National Institute of Standards and Technology (NIST)/SEG - SFQ_Circuits/"

    directories = d.get_data_directory(Chip)
    ic_locatoins = []
    raw_locations = []

    if directories == -1:
        return -1

    for directory in directories:
        path = "http://132.163.82.9:3000/"
        d_location = find_D(directory, Chip)

        if (d_location == -1):
            return -1

        path = path + directory[d_location:]

        chip = d.find_chip(Chip)
        device = d.find_device(Device,
                               output=0,
                               optional_designid=chip.design_id)
        if (device == -1):
            return -1
        size = device.JJ_radius_nom

        chip_info_name = Chip + "_" + Device + "_" + (str)(size)

        raw_data_filename = path + "/RawData/" + chip_info_name + "_Ic_raw.dat"

        ic_filename = path + "/Ic_values/" + chip_info_name + "_Ic.dat"

        ic_locatoins.append(ic_filename)
        raw_locations.append(raw_data_filename)

    for i, raw in enumerate(raw_locations):
        try:

            raw_file = urlopen(raw, timeout=5)
            Ic_file = urlopen(ic_locatoins[i], timeout=5)

        except:
            pass

    try:
        I, V, R = np.loadtxt(raw_file, unpack=True)

        Ic, Vc = np.loadtxt(Ic_file)
    except:
        print("Problem reading file")
        return -1

    plot.showGrid(x=True, y=True, alpha=0.3)
    plot.setLabel('left', 'V', 'V')
    plot.setLabel('bottom', 'I', 'A')
    plot.getAxis('bottom').setTicks(None)

    curve = plot.plot()
    curve.setData(I, V, symbol='o', symbolBrush='w', symbolSize=5)

    for n1 in range(0, len(Ic)):
        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(
            Ic[n1]) + ',' + '{:.2E}'.format(Vc[n1]) + ')'
        label.setText(I_c)
        label.setPos(Ic[n1], Vc[n1])
        plot.addItem(label)
        new_curve = plot.plot()
        new_curve.setData(Ic[n1:n1 + 1],
                          Vc[n1:n1 + 1],
                          symbol='o',
                          symbolBrush='c',
                          symbolSize=10)

    app.processEvents()