def setup_keithley(address='GPIB::24'): #set up Keithley 2420 for electrical measurements smu = Keithley2400(address) smu.reset() smu.use_front_terminals() smu.measure_current(current=0.01) #set current compliance return smu
def __init__(self, serial_port, gpib_address, serial_timeout=0.1): # Grab kwarg variables self.port = serial_port self.address = gpib_address self.serial_timeout = serial_timeout # Initialize state variables as properties self._measurement_mode = None @property def measurement_mode(self): return self._measurement_mode self._source_enabled = False @property def source_enabled(self): return self._source_enabled # Initialize the instrument upon creation self.adapter = PrologixAdapter(self.port, address=self.address, serial_timeout=self.serial_timeout) self._instrument = Keithley2400(self.adapter) # Ensure the Prologix adapter timeout is set to 100ms self._instrument.write("++read_tmo_ms 100") # Make sure the connection is properly established if not self._instrument.id.stratswith("KEITHLEY"): raise IOError("Instrument connection failed")
def config_keithley(self, **kwargs): self.to_log.emit( '<span style=\" color:#000000;\" >Trying to connect to: ' + str(self.gpib_port) + '.</span>') if str(self.gpib_port) == 'dummy': return try: self.sourcemeter = Keithley2400(str(self.gpib_port)) self.to_log.emit('<span style=\" color:#32cd32;\" >Connected to ' + str(self.gpib_port) + '.</span>') except pyvisa.errors.VisaIOError: self.to_log.emit( '<span style=\" color:#ff0000;\" >Failed to connect with ' + str(self.gpib_port) + '.</span>') self.gpib_port = 'dummy' return self.sourcemeter.reset() self.sourcemeter.use_front_terminals() self.sourcemeter.compliance_current = kwargs.get( 'compliance_current', self.compliance_current) self.sourcemeter.measure_current() time.sleep(0.1) # wait here to give the instrument time to react self.averages = kwargs.get('averages', self.averages) self.sourcemeter.config_buffer(self.averages) self.sourcemeter.enable_source()
def IVcurve( gpib_adr, vMax, compCurr, stepSize, mydelay ): #silicon: IVcuvre(vMax=0, compCurr=0.0001, stepSize=10, delay=1) keith_str = "GPIB::" + str(gpib_adr) #print('IV-CURVE DONE') length = int(vMax * 1.0 / stepSize) vArray = [None for i in range(length)] iArray = [[None for j in range(5)] for i in range(length)] iArray_median = [None for i in range(length)] keith = Keithley2400(keith_str) keith.reset() keith.apply_voltage(None, compCurr) keith.enable_source() keith.measure_current(1, compCurr, True) for i in range(length): vArray[i] = stepSize * (i + 1) keith.ramp_to_voltage(vArray[i], 2, 0.02) sleep(mydelay) for j in range(5): #vArray[i]=300-stepSize*(i) iArray[i][j] = keith.current * 1000 sleep(0.5) print(iArray[i]) iArray_median[i] = np.median(np.array(iArray[i])) print('Voltages:' + str(vArray)) print('milli-Amps:' + str(iArray_median)) keith.shutdown() return (vArray, iArray_median)
def initialize(unit): unit = Keithley2400("GPIB::24::INSTR") unit.reset() unit.use_front_terminals() unit.measure_current() unit.write("SYST:RSEN ON") sleep(3) # wait here to give the instrument time to react
def startup(self): self.source = Keithley2400("GPIB::24::INSTR") self.source.apply_voltage(voltage_range=None, compliance_current=0.1) self.source.measure_current(nplc=1, current=self.max_current, auto_range=True) # self.source.apply_current() # self.source.source_current_range = self.max_current*1e-3 # A # self.source.complinance_voltage = self.voltage_range self.source.enable_source() sleep(2)
def startup(self): log.info("Setting up instruments") self.meter = Keithley2000("GPIB::25") self.meter.measure_voltage() self.meter.voltage_range = self.voltage_range self.meter.voltage_nplc = 1 # Integration constant to Medium self.source = Keithley2400("GPIB::1") self.source.apply_current() self.source.source_current_range = self.max_current * 1e-3 # A self.source.compliance_voltage = self.voltage_range self.source.enable_source() sleep(2)
def initialize(device_address): '''Set up Keithley device using the GPIB address of the multimeter. This can be done using a GPIB-to-USB cable connecting the Keithley to the PC and setting the GPIB address on the Keithley front panel. Example inputs: device_address = 'GPIB::24' Returns a device instance. ''' dev = Keithley2400(device_address) dev.reset() dev.use_front_terminals() dev.measure_current(current=0.1) # set current compliance return dev
def testScript(): keithley = Keithley2400("GPIB1::24") keithley.apply_current() # Sets up to source current keithley.source_current_range = 10e-3 # Sets the source current range to 10 mA keithley.compliance_voltage = 10 # Sets the compliance voltage to 10 V keithley.source_current = 0 # Sets the source current to 0 mA keithley.enable_source() # Enables the source output keithley.measure_voltage() # Sets up to measure voltage keithley.ramp_to_current(5e-3) # Ramps the current to 5 mA print(keithley.voltage) # Prints the voltage in Volts keithley.shutdown()
def connect(self, keithley_address='GPIB0::20::INSTR', shutter_port='COM3'): self.keithley = Keithley2400(keithley_address) self.keithley.reset() # self.keithley.output_off_state = 'HIMP' self.keithley.use_front_terminals() self.keithley.wires = 4 self.keithley.apply_voltage() self.keithley.compliance_current = 1.05 self.souce_voltage = 0 self.keithley.buffer_points = 2
def startup(self): # log.info("Setting up instruments") # self.meter = Keithley2182("GPIB::7::INSTR") # self.meter.measure_voltage() # self.meter.voltage_range = self.voltage_range # self.meter.voltage_nplc = 1 # Integration constant to Medium self.source = Keithley2400("GPIB::24::INSTR") self.source.apply_voltage() self.source.measure_current() self.source.voltage_nplc = 1 # Integration constant to Medium self.source.complinance_current = self.current_range self.source.enable_source() sleep(2)
def startup(self): log.info("Setting up instruments") """ To use the Nanovoltmeter instead of the Sourcemeter to measure potential, uncomment the following section and change the corresponding section in execute routine to measure from meter instead of source """ # self.meter = Keithley2182("GPIB::7::INSTR") # self.meter.measure_voltage() # self.meter.voltage_range = self.voltage_range # self.meter.voltage_nplc = 1 # Integration constant to Medium self.source = Keithley2400("GPIB::24::INSTR") self.source.apply_current() self.source.measure_voltage() self.source.source_current_range = self.plate_current * 1.1 # Current range is 10% over target self.source.compliance_voltage = self.voltage_range self.source.enable_source() sleep(2)
in_e = in_e/1000 lo_e = lo_e/1000 hi_e = hi_e/1000 e_step = 0.001*sweep_rate/deltat sweep1 = np.arange(in_e, hi_e, e_step) sweep2 = np.arange(hi_e, lo_e, -e_step) sweep3 = np.arange(lo_e, hi_e, e_step) potentials = np.concatenate((sweep2, sweep3)) potentials = np.tile(potentials, np.int(repeats)) sweep4 = np.arange(hi_e, in_e, -e_step) potentials = np.concatenate((sweep1, potentials)) potentials = np.concatenate((potentials, sweep4)) source = Keithley2400("GPIB::24::INSTR") source.apply_voltage() source.measure_current() source.enable_source() for e in potentials: # log.debug("Measuring potential: %g V" % e) source.source_voltage = e sleep(1/deltat) current = source.current data = { 'Potential (V)': e, 'Current (A)': current } """
def applyConfigs(self): if(self.config['Keithley2400']['active'] == 'true'): self.scm = Keithley2400("GPIB0::24") try: self.sourcetype = self.config['Keithley2400']['sourcetype'] self.interval = float(self.config['Keithley2400']['interval']) self.metertype = self.config['Keithley2400']['metertype'] self.source_i = float(self.config['Keithley2400']['source_i']) self.source_f = float(self.config['Keithley2400']['source_f']) self.number_samples = int(self.config['Keithley2400']['number_samples']) if(self.config['Keithley2400']['rear']=='true'): self.scm.use_rear_terminals() elif(self.config['Keithley2400']['rear']=='false'): self.scm.use_front_terminals() else : print('rear must be true/false') except Exception as e: raise e exit('Config error!') if(self.config['Keithley2400']['metertype']=='v'): self.scm.measure_voltage() print('measure voltage!') elif(self.config['Keithley2400']['metertype']=='a'): self.scm.measure_current() else : print('invalid config: keithley meter type must be `a` or `v` ') exit() else : self.scm = False if(self.config['B2901A']['active'] == 'true'): self.scm2 = B2901A("GPIB1::23") try: self.scm2.sourcetype = self.config['B2901A']['sourcetype'] self.b_metertype = self.config['B2901A']['metertype'] self.b_source_i = float(self.config['B2901A']['source_i']) self.b_source_f = float(self.config['B2901A']['source_f']) self.b_interval = float(self.config['B2901A']['interval']) self.b_number_samples = int(self.config['B2901A']['number_samples']) except Exception as e: raise e exit('Config error!') if(self.config['B2901A']['sourcetype'] == 'v'): self.scm2.setVoltageOutput() elif(self.config['B2901A']['sourcetype']=='a'): self.scm2.setCurrentOutput() else : print ('invalid config: b2901a sourcetype type must be `a` or `v`') exit() self.scm2.setMaxVoltage(float(self.config['B2901A']['max_voltage'])) if(self.config['B2901A']['metertype'] == 'v'): self.scm2.setMeasureVoltage() elif(self.config['B2901A']['metertype']=='a'): self.scm2.setMeasureCurrent() else : print ('invalid config') exit() else : self.scm2 = False if((not (self.scm and self.scm2)) and self.isParametrizedExperiment()): print('invalid config: for parametrized experiments both instruments must be active') exit()
def keith_vac_seq(keith_dict, df, df_i): # measure keithley functions during vacuum sequence keith_dict['keith_busy'] = True keith_dict['keith_seq_running'] = True if keith_dict['iv_vac_seq'].isChecked(): measure_iv(keith_dict, df, df_i) keith_dict['keith_busy'] = True time.sleep(2) if keith_dict['cv_vac_seq'].isChecked(): measure_multi_cv(keith_dict, df, df_i) keith_dict['keith_busy'] = True time.sleep(2) if keith_dict['bs_vac_seq'].isChecked(): measure_bias_seq(keith_dict, df, df_i) keith_dict['keith_busy'] = True time.sleep(2) time.sleep(float(keith_dict['pause_after_cycle'].value()) * 60) keith_dict['keith_busy'] = False keith_dict['keith_seq_running'] = False if __name__ == '__main__': print('testing device...') dev = Keithley2400('GPIB2::24') dev.reset() dev.use_front_terminals() dev.measure_current(current=0.1) # set current compliance close(dev) print('test successful')
e5.grid(row=4,column=1) b1=Button(top,text='SUBMIT',width=10, command=main) b1.grid(row=5,columnspan=2) # Set the input parameters p=int(e1.get()) #port number c=float(e2.get()) #compliance voltage d=int(e3.get()) #datapoints imin=float(e4.get()) #minimum current imax=float(e5.get()) #maximum current def main(): fp=open("sweepi.txt","w") keithley = Keithley2400("GPIB::"+p) keithley.reset() keithley.use_front_terminals() keithley.apply_current() # Sets up to source current keithley.measure_voltage(auto_range=True) ##keithley.source_current_range = 1e-6 # Sets the source current range to 10 mA keithley.compliance_voltage = c # Sets the compliance voltage to 10 V keithley.enable_source() currents = np.linspace(imin, imax, num=d) voltages = np.zeros_like(currents) keithley.shutdown()# Ramps the current to 0 mA and disables output fp.write("current voltage\n") for i in range(d):
import os import glob import math # for creating time varying voltage and temperature maps import time from random import randint from random import seed from datetime import datetime # For the GUI from tkinter import * from multiprocessing import Process from gpiozero import LED, Button # Importing and setting up keithley for measurements. Beep indicates code is interfacing with keithley from pymeasure.instruments.keithley import Keithley2400 from smky import k_measure_v, k_measure_I, k_set_I, k_set_V keithley = Keithley2400("GPIB::1") keithley.beep(100, 3) time.sleep(10) # from temperature_sensor_code import * # For the resetting # for the time part # For DS18B20 # Temperature sesnor is goig to be connected to GPIO 4 ''' To input the starting parameters of the test, use the class parameters and change the actual values of A (Atmopsheric Temp), t(Time of the test) and g (Gas 1 and 2 percentages). To control the measurement intervals use the parameters class - variable M. To control the temperature, use the parameters class - variable T
## It will sweep a current from the set min current to the set max current with the given steps """ ### Import ### #Required packages import numpy as np import time #Drivers from pymeasure.instruments.keithley import Keithley2400 from pymeasure.instruments.keithley import Keithley2000 nvm = Keithley2000("GPIB::15") source = Keithley2400("GPIB::21") ### Setup nvm ### ### Setup 2400 ### currentmax = 1e-6 currentmin = 0 currentstep = 1e-8 currentrange = int((currentmax-currentmin)/currentstep+1) source.apply_current() print(nvm.voltage) #Test the nvm connection nvm.beep_state = 'disabled' source.source_current = .1e-6
startI = 0 endI = 1 nPoints = 10 ppms = 0 ''' ppms = Dynacool(ip) ppms.purgeChamber() ppms.waitForChamber() ppms.setField() ppms.waitForField() ppms.setTemperature() ppms.waitForTemperature() ''' voltageMeter = Keithley2400("GPIB::0") currentMeter = Keithley2400("GPIB::1") dataFile = open('WS2_Data.txt', 'w') dataFile.write('Time V1 I1 V2 I2 BField Temp\n') voltageMeter.apply_voltage(voltage_range=50, compliance_current=.001) voltageMeter.source_voltage = 0 voltageMeter.measure_current(nplc=1, current=.05) currentMeter.apply_current(current_range=5, compliance_voltage=10) currentMeter.source_current = 0 currentMeter.measure_voltage(nplc=1, voltage=2) data = np.zeros(8) voltages = np.linspace(startV, endV, nPoints, dtype='f8')
### User defined variables: Editable! measurement_frequency = 1 # frequency in Hz max_current = 0.1 # Max current, in A min_current = -max_current # Min current, opposite of max cutoff = -0.005 # cutoff current, in A potential = -1.55 # potential at which to hold WE ### Experimental variables: Edit with caution date = datetime.datetime.now() date = date.strftime('%Y-%m-%d_%H-%M-%S') starttime = perf_counter() data = np.reshape(('Time', 'Potential (V)', 'Current (A)'), (1, 3)) # Connect and Configure the instrument sourcemeter = Keithley2400("GPIB::24::INSTR") initialize(sourcemeter) sourcemeter.enable_source() sourcemeter.source_voltage = potential sourcemeter.compliance_current = max_current # Loop through each current point, measure and record the voltage while sourcemeter.current <= cutoff: try: time = perf_counter() time = time - starttime # sourcemeter.measure_voltage() potential2 = potential # potential = sourcemeter.voltage # sourcemeter.measure_current()
def run_test(): os.system("rm yamlConfigOutput data IV_LOG") os.system("mkdir -p " + datadir + "module"+str(glb_options['moduleNumber'])+'/raw') os.system("mkdir -p " + datadir + "module"+str(glb_options['moduleNumber'])+'/yaml') os.system("mkdir -p " + datadir + "module"+str(glb_options['moduleNumber'])+'/iv') os.system("ln -s -F " + datadir + "module"+str(glb_options['moduleNumber'])+'/raw'+" data") os.system("ln -s -F " + datadir + "module"+str(glb_options['moduleNumber'])+'/yaml'+" yamlConfigOutput") os.system("ln -s -F " + datadir + "module"+str(glb_options['moduleNumber'])+'/iv'+" IV_LOG") """print('AFTER:') pprint("Global options = "+yaml.dump(glb_options)) pprint("DAQ options = "+yaml.dump(daq_options))""" #pprint("testswitches = "+yaml.dump(testswitches)) the_time=datetime.datetime.now() if testswitches['IV_curve']==True: (voltArray,currArray)=IV_curve.IVcurve(iv_stuff['gpib_adr'], iv_stuff['vMax'], iv_stuff['compCurr'],iv_stuff['stepSize'], iv_stuff['delay']) #gpib_adr, vMax, complianceCurrent, stepSize, delay_between_steps plt.figure(1) plt.xlabel('Voltage (V)') plt.ylabel('Current (mA)') plt.title('Module '+str(glb_options['moduleNumber'])) plt.plot(voltArray,currArray) #plt.plot(voltArray,currArray[0],'r',voltArray,currArray[1],'b',voltArray,currArray[2],'g',voltArray,currArray[3],'k',voltArray,currArray[4],'y') ivName=str(glb_options['outputCommonPath']) + "module"+str(glb_options['moduleNumber'])+'/iv/' ivName=ivName+'Module'+str(glb_options['moduleNumber'])+"_"+str(the_time.day)+"-"+str(the_time.month)+"-"+str(the_time.year)+"_"+str(the_time.hour)+"-"+str(the_time.minute)+"-"+str(the_time.second) if (int(daq_options['hv'])==0): ivName+='_HV_OFF' ivName=ivName+".pdf" plt.savefig(ivName) #plt.show() plt.close(1) ivName=str(glb_options['outputCommonPath']) + "module"+str(glb_options['moduleNumber'])+'/iv/' ivName=ivName+'Module'+str(glb_options['moduleNumber'])+"_"+str(the_time.day)+"-"+str(the_time.month)+"-"+str(the_time.year)+"_"+str(the_time.hour)+"-"+str(the_time.minute)+"-"+str(the_time.second) if (int(daq_options['hv'])==0): ivName+='_HV_OFF' ivName=ivName+".csv" csvfile = open(ivName, "w") firstrow='Date:'+str(the_time.day)+"-"+str(the_time.month)+"-"+str(the_time.year)+"_Time:"+str(the_time.hour)+"-"+str(the_time.minute)+"-"+str(the_time.second) secondrow='Module_Number:'+str(glb_options['moduleNumber']) thirdrow='vMAX='+str(iv_stuff['vMax'])+'-'+'compcurrent='+str(iv_stuff['compCurr'])+'-'+'stepsize='+str(iv_stuff['stepSize'])+'-'+'delay='+str(iv_stuff['delay']) fourthrow='temp:'+iv_stuff['temperature']+'_humidity:'+iv_stuff['humidity'] csvfile.writelines([str(firstrow)+'\n',str(secondrow)+'\n',str(thirdrow)+'\n',str(fourthrow)+'\n']) for i in range(len(voltArray)): csvfile.write(str(voltArray[i])+' '+str(currArray[i])+'\n') #csvfile.write(str(voltArray[i])+' '+str(currArray[0][i])+' '+str(currArray[1][i])+' '+str(currArray[2][i])+' '+str(currArray[3][i])+' '+str(currArray[4][i])+'\n') csvfile.close() #Set HV keith_str="GPIB::"+str(iv_stuff['gpib_adr']) keith = Keithley2400(keith_str) #keith.reset() if (int(daq_options['nEvent'])>0): keith.apply_voltage(None,iv_stuff['compCurr']) keith.enable_source() keith.ramp_to_voltage(int(daq_options['hv'])) keith.measure_current(1,iv_stuff['compCurr'],True) sleep(5) if glb_options['startServerManually']==False: os.system("ssh -T hgsensor@"+glb_options['serverIpAdress']+" \"nohup python "+glb_options['serverCodePath']+"/daq-zmq-server.py > log.log 2>&1& \"") context = zmq.Context() socket = context.socket(zmq.REQ) print("Send request to server") socket.connect("tcp://"+glb_options['serverIpAdress']+":5555") cmd="DAQ_CONFIG" print(cmd) socket.send_string(cmd) status=socket.recv_string() print(status) if status=="READY_FOR_CONFIG": socket.send_string(config.dump()) the_config=socket.recv_string() print("Returned DAQ_CONFIG:\n%s"%the_config) else: print("WRONG STATUS -> exit()",status) exit() dataSize=30786 # 30784 + 2 for injection value if daq_options['compressRawData']==True: dataSize=15394 # 30784/2 + 2 for injection value dataStringUnpacker=struct.Struct('B'*dataSize) outputFile=None if options.dataNotSaved==False: while True: rawFileName=str(glb_options['outputCommonPath']) + "module"+str(glb_options['moduleNumber'])+'/raw/' rawFileName=rawFileName+'Module'+str(glb_options['moduleNumber'])+"_"+str(the_time.day)+"-"+str(the_time.month)+"-"+str(the_time.year)+"_"+str(the_time.hour)+"-"+str(the_time.minute)+"-"+str(the_time.second) if (int(daq_options['hv'])==0): rawFileName+='_HV_OFF' rawFileName=rawFileName+".raw" if os.path.exists(rawFileName): #to avoid overwriting continue else: print("open output file : ",rawFileName) outputFile = open(rawFileName,'wb') if glb_options['storeYamlFile']==True: yamlFileName=str(glb_options['outputCommonPath']) + "module"+str(glb_options['moduleNumber'])+'/yaml/' yamlFileName=yamlFileName+'Module'+str(glb_options['moduleNumber'])+"_"+str(the_time.day)+"-"+str(the_time.month)+"-"+str(the_time.year)+"_"+str(the_time.hour)+"-"+str(the_time.minute)+"-"+str(the_time.second) if (int(daq_options['hv'])==0): yamlFileName+='_HV_OFF' yamlFileName=yamlFileName+".yaml" print("save yaml file : ",yamlFileName) config.dumpToYaml(yamlFileName) break '''-------Write Configuration to Pi-------''' cmd="CONFIGURE" print(cmd) socket.send_string(cmd) return_bitstring = socket.recv_string() print("Returned bit string = ",return_bitstring) bitstring=[int(i,16) for i in return_bitstring.split()] print("\t write bits string in output file") byteArray = bytearray(bitstring) if options.dataNotSaved==False: outputFile.write(byteArray) '''the_bit_string=sk2conf.bit_string() if daq_options['externalChargeInjection']==True: the_bit_string.set_channels_for_charge_injection(daq_options['channelIds']) if daq_options['preampFeedbackCapacitance']>63: print("!!!!!!!!! WARNING :: preampFeedbackCapacitance should not be higher than 63 !!!!!!!") the_bit_string.set_preamp_feedback_capacitance(daq_options['preampFeedbackCapacitance']) the_bit_string.set_channels_to_mask(daq_options['channelIdsToMask']) the_bit_string.set_channels_to_disable_trigger_tot(daq_options['channelIdsDisableTOT']) the_bit_string.set_channels_to_disable_trigger_toa(daq_options['channelIdsDisableTOA']) the_bit_string.set_lg_shaping_time(daq_options['shapingTime']) the_bit_string.set_hg_shaping_time(daq_options['shapingTime']) the_bit_string.set_tot_dac_threshold(daq_options['totDACThreshold']) a=the_bit_string.get_48_unsigned_char_p() #the_bit_string.Print() print( "outputBitString", [hex(a[i]) for i in range(len(a))] )''' #still wrong!!!! Config Test missing! '''-----------Read Events and Online Data-analysis---------''' cmd="PROCESS_AND_PUSH_N_EVENTS" socket.send_string(cmd) mes=socket.recv_string() print('\t***',mes,'***') puller=context.socket(zmq.PULL) puller.connect("tcp://"+glb_options['serverIpAdress']+":5556") try: while True: full_noise_counter=[[0 for i in range(64)]for sk in testswitches['chip_array']] full_broken_counter=[[0 for i in range(64)] for sk in testswitches['chip_array']] full_to_counter=[[0 for i in range(64)] for sk in testswitches['chip_array']] for i in range(daq_options['nEvent']): daq_options['currEvent']=i str_data=puller.recv() rawdata=dataStringUnpacker.unpack(str_data) print("\n \n \n Receive event ",i) ''' #######ONLINE DATA TESTS######''' '''Setup''' byteArray = bytearray(rawdata) up=unpacker() up.unpack(byteArray) #up.showData(i) data_to_check=checker(up.sk2cms_data,up.rollMask,config) '''Perform tests: (see rpi_data_tests.py for details)''' if(testswitches['RollMask_full_ON']): rm=data_to_check.check_full_RollMask() for sk in testswitches['chip_array']: if(rm[sk] == True): #Once a Rollmask issue = everytime a Rollmask issue common_variables.rollMask_issue[sk]=True else: common_variables.rollMask_issue[sk]=False #if common_variables.rollMask_issue[0]==True: # break if(testswitches['SCA_full_ON']): noisy_ch_counter=0; noisy_channels=[]; broken_ch_counter=0; broken_channels=[] #initialization of the output variables of the current test (noisy_ch_counter,noisy_channels,broken_ch_counter,broken_channels)=data_to_check.check_full_sca() current_ch_broken_limit=math.ceil(config.sca_variables['th_n_ev_broken']*float(i+1)) #How many times a channel needs to be broken in order to be considered as broken common_variables.broken_ch_list=[[None for i in range(0)] for sk in testswitches['chip_array']] current_ch_noisy_limit=math.ceil(config.sca_variables['th_n_ev_noisy']*float(i+1)) #How many times a channel needs to be noisy in order to be considered as noisy common_variables.noisy_ch_list=[[None for i in range(0)] for sk in testswitches['chip_array']] for sk in testswitches['chip_array']: for j in broken_channels[sk]: full_broken_counter[sk][j]+=1 for j in noisy_channels[sk]: full_noise_counter[sk][j]+=1 for j in range(64): if(full_broken_counter[sk][j]>=current_ch_broken_limit): #print(len(common_variables.broken_ch_list[1])) common_variables.broken_ch_list[sk].append(j) if(full_noise_counter[sk][j]>=current_ch_noisy_limit): common_variables.noisy_ch_list[sk].append(j) common_variables.n_noisy_ch_chip[sk]=len(common_variables.noisy_ch_list[sk]) #global for all event done so far common_variables.n_broken_ch_chip[sk]=len(common_variables.broken_ch_list[sk]) #global for all event done so far common_variables.chip_broken[sk]=(common_variables.n_broken_ch_chip[sk]>=config.sca_variables['th_broken_ch_chip']) common_variables.chip_noisy[sk]=(common_variables.n_noisy_ch_chip[sk]>=config.sca_variables['th_noisy_ch_chip']) if common_variables.chip_broken[sk]==True: common_variables.hexaboard_broken=True if common_variables.chip_noisy[sk]==True: common_variables.hexaboard_noisy=True if(testswitches['ToT_ToA_full_ON']): less_counts_than_threshold=[True for sk in testswitches['chip_array']]; wrong_To_list=[[] for sk in testswitches['chip_array']] (less_counts_than_threshold,wrong_To_list)=data_to_check.check_full_TOA_TOT() current_to_issue_limit=math.ceil(config.toa_tot_variables['th_n_ev_to_issue']*float(i+1)) common_variables.to_issue_ch_list=[[None for i in range(0)] for sk in testswitches['chip_array']] for sk in testswitches['chip_array']: for j in wrong_To_list[sk]: full_to_counter[sk][j]+=1 for j in range(64): if(full_to_counter[sk][j]>=current_to_issue_limit): common_variables.to_issue_ch_list[sk].append(j) common_variables.n_to_issues_chip[sk]=len(common_variables.to_issue_ch_list[sk]) #global for all event done so far common_variables.chip_to_issue[sk]=(common_variables.n_to_issues_chip[sk]>=config.toa_tot_variables['th_to_ch_issue_chip']) if common_variables.chip_to_issue[sk]==True: common_variables.hexaboard_to_issue=True if(testswitches['printUnusualData_ON']): data_to_check.printUnusualData()#full test '''print file''' if True: #options.dataNotSaved==False: outputFile.write(byteArray) #calculate final result for chips and the HB for sk in testswitches['chip_array']: bool_tests_executed_passed=((not testswitches['RollMask_full_ON'] or not common_variables.rollMask_issue[sk])and(not testswitches['SCA_full_ON'] or not common_variables.chip_broken[sk])) #only RM and SCA-broken can make the whole test fail if(bool_tests_executed_passed): common_variables.chip_results[sk]='PASS' if common_variables.chip_noisy[sk]: common_variables.chip_results[sk]+=' -NOISY' if common_variables.chip_to_issue[sk]: common_variables.chip_results[sk]+=' -TO_ISSUE' else: common_variables.chip_results[sk]='FAIL' common_variables.DUT_result='PASS' for sk in testswitches['chip_array']: if common_variables.chip_results[sk]=='FAIL': common_variables.DUT_result='FAIL' break elif common_variables.chip_results[sk]=='PASS -NOISY': common_variables.DUT_result+=' '+str(sk)+'-NOISY' elif common_variables.chip_results[sk]=='PASS -TO_ISSUE': common_variables.DUT_result+=' '+str(sk)+'-TO_ISSUE' elif common_variables.chip_results[sk]=='PASS -NOISY -TO_ISSUE': common_variables.DUT_result+=' '+str(sk)+'-NOISY-TO_ISSUE' puller.close() socket.send_string("END_OF_RUN") if socket.recv_string()=="CLOSING_SERVER": print("CLOSING SERVER") socket.close() context.term() break except KeyboardInterrupt: print("keyboard interruption") keith.shutdown() os.system("ssh -T pi@"+glb_options['serverIpAdress']+" \" killall python\"") keith.shutdown()
from time import sleep from pymeasure.instruments.keithley import Keithley2400 keithley = Keithley2400("GPIB::26") def inject_i(current, compliance_voltage): keithley.reset() keithley.use_front_terminals() keithley.apply_current() keithley.measure_voltage(auto_range=True) keithley.compliance_voltage = compliance_voltage keithley.enable_source() keithley.source_current = current voltage = keithley.voltage def shutdown_i(): keithley.shutdown()
# Import necessary packages from pymeasure.instruments.keithley import Keithley2400 import numpy as np import pandas as pd from time import sleep # Set the input parameters data_points = 50 averages = 50 max_current = 0.01 min_current = -max_current # Connect and configure the instrument sourcemeter = Keithley2400("GPIB::4") sourcemeter.reset() sourcemeter.use_front_terminals() sourcemeter.measure_voltage() sourcemeter.config_current_source() sleep(0.1) # wait here to give the instrument time to react sourcemeter.set_buffer(averages) # Allocate arrays to store the measurement results currents = np.linspace(min_current, max_current, num=data_points) voltages = np.zeros_like(currents) voltage_stds = np.zeros_like(currents) # Loop through each current point, measure and record the voltage for i in range(data_points): sourcemeter.current = currents[i] sourcemeter.reset_buffer() sleep(0.1)
from time import sleep from pymeasure.instruments.keithley import Keithley2400 keithley = Keithley2400("GPIB::24") def applyv(voltage, compliance_current): keithley.reset() keithley.use_front_terminals() keithley.apply_voltage() keithley.measure_current(auto_range=True) keithley.compliance_current = compliance_current keithley.enable_source() keithley.source_voltage = voltage current = keithley.current def shutdown_v(): keithley.shutdown()
def launch_tests(self, obj): self.config.default_options['daq_options']['nEvent'] = int( self.ids.ev.text) self.config.default_options['daq_options'][ 'acquisitionType'] = self.ids.acqtype.text self.config.default_options['daq_options']['injectionDAC'] = int( self.ids.injDAC.text) self.config.default_options['daq_options']['pulseDelay'] = int( self.ids.delay.text) self.config.default_options['glb_options']['moduleNumber'] = int( self.ids.DUT.text) self.config.default_options['glb_options'][ 'type_of_hardware'] = self.ids.Hardwaretype.text self.config.default_options['glb_options'][ 'manufacturer'] = self.ids.Manufacturer.text self.config.iv_variables['gpib_adr'] = int(self.ids.gpib.text) self.config.iv_variables['vMax'] = int(self.ids.vmax.text) self.config.iv_variables['compCurr'] = float(self.ids.compcurr.text) self.config.iv_variables['stepSize'] = int(self.ids.stepsize.text) self.config.iv_variables['delay'] = float(self.ids.ivdelay.text) self.config.iv_variables['humidity'] = self.ids.hum.text self.config.iv_variables['temperature'] = self.ids.temperature.text #self.config.default_options['daq_options']['hv']=int(self.ids.hv.text) channels = [] if self.ids.inputch.text == 'all': for i in range(64): channels.append(int(i)) self.config.default_options['daq_options']['channelIds'] = channels elif (self.ids.inputch.text == '') or (self.ids.inputch.text == ' '): self.config.default_options['daq_options']['channelIds'] = [] else: channels = self.ids.inputch.text.split(',') channels = [int(i) for i in channels] self.config.default_options['daq_options']['channelIds'] = channels if self.ids.hv.text == ('' or ' '): self.config.default_options['daq_options']['hv'] = [float(0)] else: hv_values = self.ids.hv.text.split(',') hv_values = [float(i) for i in hv_values] self.config.default_options['daq_options']['hv'] = hv_values '''Perform tests: (see rpi_data_tests.py for details)''' #Read GUI-Input '''common_variables.DuT_name=self.ids.DUT.text common_variables.n_ev=int(self.ids.ev.text) common_variables.Type_of_hardware=self.ids.Hardwaretype.text common_variables.Manufacturer=self.ids.Manufacturer.text common_variables.acquisitionType=self.ids.acqtype.text common_variables.injectionDAC=int(self.ids.injDAC.text) common_variables.pulse_delay=int(self.ids.delay.text) common_variables.inputch=[int(self.ids.inputch.text)]''' """#Reset Result Colors self.col_chip0=self.gray self.col_chip1=self.gray self.col_chip2=self.gray self.col_chip3=self.gray self.col_chip0RM=self.gray self.col_chip1RM=self.gray self.col_chip2RM=self.gray self.col_chip3RM=self.gray self.col_chip0SCA=self.gray self.col_chip1SCA=self.gray self.col_chip2SCA=self.gray self.col_chip3SCA=self.gray self.col_chip0TO=self.gray self.col_chip1TO=self.gray self.col_chip2TO=self.gray self.col_chip3TO=self.gray self.col_DUT=self.gray""" #Perform tests if self.config.default_options['daq_options'][ 'externalChargeInjection'] == False: self.my_run() else: for i in channels: self.config.default_options['daq_options']['channelIds'] = [i] self.my_run() keith_str = "GPIB::" + str(self.config.iv_variables['gpib_adr']) keith = Keithley2400(keith_str) keith.reset() keith.shutdown() """#Change Result Label colours if(self.config.default_options['testswitches']['RollMask_full_ON']): if(common_variables.rollMask_issue[0]): self.col_chip0RM=self.red else: self.col_chip0RM=self.green if(common_variables.rollMask_issue[1]): self.col_chip1RM=self.red else: self.col_chip1RM=self.green if(common_variables.rollMask_issue[2]): self.col_chip2RM=self.red else: self.col_chip2RM=self.green if(common_variables.rollMask_issue[3]): self.col_chip3RM=self.red else: self.col_chip3RM=self.green if(self.config.default_options['testswitches']['SCA_full_ON']): if(common_variables.chip_broken[0]): self.col_chip0SCA=self.red elif(common_variables.chip_noisy[0]): self.col_chip0SCA=self.yellow else: self.col_chip0SCA=self.green if(common_variables.chip_broken[1]): self.col_chip1SCA=self.red elif(common_variables.chip_noisy[1]): self.col_chip1SCA=self.yellow else: self.col_chip1SCA=self.green if(common_variables.chip_broken[2]): self.col_chip2SCA=self.red elif(common_variables.chip_noisy[2]): self.col_chip2SCA=self.yellow else: self.col_chip2SCA=self.green if(common_variables.chip_broken[3]): self.col_chip3SCAs=self.red elif(common_variables.chip_noisy[3]): self.col_chip3SCA=self.yellow else: self.col_chip3SCA=self.green if(self.config.default_options['testswitches']['ToT_ToA_full_ON']): if(common_variables.chip_to_issue[0]): self.col_chip0TO=self.red else: self.col_chip0TO=self.green if(common_variables.chip_to_issue[1]): self.col_chip1TO=self.red else: self.col_chip1TO=self.green if(common_variables.chip_to_issue[2]): self.col_chip2TO=self.red else: self.col_chip2TO=self.green if(common_variables.chip_to_issue[3]): self.col_chip3TO=self.red else: self.col_chip3TO=self.green""" if ((self.config.default_options['testswitches']['RollMask_full_ON'] or self.config.default_options['testswitches']['ToT_ToA_full_ON']) or self.config.default_options['testswitches']['SCA_full_ON']): #yaml_writer.writeLogfile() """if(common_variables.chip_results[0]=='FAIL'):
# -*- coding: utf-8 -*- """ Created on Tue Jul 3 13:41:10 2018 @author: Cole """ from pymeasure.instruments.keithley import Keithley2400 from ppms import Dynacool import numpy as np SourceMeter = Keithley2400("GPIB::24") ppms = Dynacool(1)