def chipselectionchange(self): current = self.Chip.currentText() if current != 'Chip': devices = d.show_devices_from_chip(current) dev_count = self.Device.count() for i in range(1, dev_count + 1): self.Device.removeItem(1) for i in range(0, len(devices)): self.Device.addItem(devices[i].name) self.Jc = d.chip_Jc(current)
def measure_JJs_Ic(chip, devices, optionalIc=0): ''' Takes just an I-V curve for the JJs, saves images but does not add to the database :param chip: Target chip :param devices: Array of target devices :param optionalIC: Optional input Ic Calls: -Measure_Ic-get_Ic_Iret_and_save ''' current_time = time.strftime("_%Y-%m-%d_%H-%M-%S") folder = dirname + str(chip) + current_time folder_link = web_link + str(chip) + current_time Jc = d.chip_Jc(chip) # take sweeps _ = ic.get_Ic_Iret_and_save(folder, folder_link, chip, devices, Jc, optionalIc)
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
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
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)
def measure_PCM_chip_warm(chip, devices): ''' This is the main function to call when PCM chip hasn't been dunked. Will measure the continuity of all the Junctions, then the resistances of the resistor arrays and vias, and save the resistances to the database. :param chip: Target chip :param devices: Array of target devices :return: funkygraph2-array of abnormal graphs :Graphs: Continuity Graphs, IV from 0 mA to 300 mA Called By: -Measurement_GUI_v3-warmmeasure Calls On: -Get_Resistance -get_resistance_arrays -get_resistance_Via -save_Resistance_Measurements_warm -save_Via_Measurements_warm ''' current_time = time.strftime("_%Y-%m-%d_%H-%M-%S_warm") 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]) device_resistance, funkygraphs = mdr.get_Resistance(folder, chip, JJs) # take the sweep to find the resistance of the Resistor Arrays Resistance_measurements = mra.get_resistance_arrays(folder, chip, RAs) #Resistance_measurements = mra.get_resistance_arrays(folder, chip, RAs) # save the resistance measurements for i in range(0, len(Resistance_measurements)): d.save_Resistance_Measurements_warm(chip, Resistance_measurements[i], folder_link, RAs[i]) # take the sweep for the vias Via_measurements = mvr.get_Resistance_Via(folder, chip, Vias) # save the via measurements for i in range(0, len(Via_measurements)): d.save_Via_Measurements_warm(chip, Via_measurements[i], folder_link, Vias[i]) print("Weblink: %s" % folder_link) return funkygraphs