def confirm_devs( self, Keithley_add, SIM900_add ): #Confirms the device choices and opens the devices for use under the Master object, then switches views to the cooldown view self.Keithley = self.rm.open_resource(Keithley_add) self.Keithley.write("SYSTEM:REMOTE") #needed to work on pi/linux self.SIM900 = SIM900(SIM900_add) cooldown_widget = Cooldown(self) self.central_widget.addWidget(cooldown_widget) self.central_widget.setCurrentWidget(cooldown_widget)
def start_meas(self, controller, start_bias, stop_bias, bias_step, bias_r): controller.DCR_filename = os.path.dirname(os.path.abspath(__file__))+"\\Data\\"+time.ctime().replace(" ", "_").replace(":","_")+"_DCR.txt" with open (controller.DCR_filename, 'a+') as DCR_file: writer_csv = csv.writer(DCR_file, delimiter=',') writer_csv.writerow(['Time(s)', 'VSrc(V)', 'ISrc(A)', 'Counts(CPS)']) self.biases = np.arange(float(start_bias), float(stop_bias)+float(bias_step), float(bias_step)) self.bias_r = bias_r controller.PCounter = ResourceManager.open_resource(controller.instr_address_dict['pulse_c_address']) controller.sim900 = SIM900(controller.instr_address_dict['sim900_address']) self.get_DCR_data(controller)
def start_meas(self, controller, bias_r, bias_point): controller.Filename = os.path.dirname(os.path.abspath(__file__))+"\\Data\\"+time.ctime().replace(" ", "_").replace(":","_")+"_RT.txt" with open (controller.Filename, 'a+') as RT_file: writer_csv = csv.writer(RT_file, delimiter=',') writer_csv.writerow(['Time(s)', 'T1(K)', 'T2(K)', 'T3(K)', 'VSrc(V)', 'VDev(V)', 'RDev']) self.bias_r = float(bias_r) #open sim900 and set the bias point controller.sim900 = SIM900(controller.instr_address_dict['sim900_address']) controller.sim900.write(controller.SIM_slots['VSource'], 'VOLT '+bias_point) controller.sim900.write(controller.SIM_slots['VSource'],'OPON') self.working_label['text']="Measurement running!" self.working_label['foreground']='green' self.get_RT_data(controller)
def start_meas(self, controller, start_bias, stop_bias, bias_step, bias_r): controller.DCR_filename = os.path.dirname(os.path.abspath(__file__))+"\\Data\\"+time.ctime().replace(" ", "_").replace(":","_")+"_DCR.txt" with open (controller.DCR_filename, 'a+') as DCR_file: writer_csv = csv.writer(DCR_file, delimiter=',') writer_csv.writerow(['Time(s)', 'VSrc(V)', 'ISrc(A)', 'Counts(CPS)']) self.biases = np.arange(float(start_bias), float(stop_bias)+float(bias_step), float(bias_step)) self.bias_r = bias_r controller.PCounter = controller.rm.open_resource(controller.instr_address_dict['pulse_c_address']) #setup pulse counter controller.PCounter.write(':INP1:COUP AC;IMP 50 OHM') controller.PCounter.write('SENS:TOT:ARM:STOP:TIM 1') #open sim900 controller.sim900 = SIM900(controller.instr_address_dict['sim900_address']) self.working_label['text']="Measurement running!" self.working_label['foreground']='green' self.get_DCR_data(controller)
def do_IV(self, controller): #isSaved to False for new IV controller.isSaved = False controller.dataTaken=False #Sets up SIM controller.sim900 = SIM900(self.SIM900_add_entry.get()) #Calculate parameters for IV VLower=controller.VLower.get() VUpper=controller.VUpper.get() VStep=controller.VStep.get() self.SupplyResistor=controller.R.get() self.numberDatapoints=len(np.arange(VLower,VUpper+VStep,VStep))*2 self.progressInterval=100/(self.numberDatapoints+1) #Voltages - probably a better way to do this? self.Voltages=[] self.Voltage_ID=0 #0 to upper for i in np.arange(0,(VUpper+VStep),VStep): self.Voltages.append(i) #Back to 0 for i in np.arange(VUpper,(0-VStep),-VStep): self.Voltages.append(i) #0 to lower for i in np.arange(0,(VLower-VStep),-VStep): self.Voltages.append(i) #back to 0 for i in np.arange(VLower,(0+VStep),VStep): self.Voltages.append(i) #Time started self.timeStart=time.time() #Data holders self.Voltage1=[] self.Voltage2=[] self.TimeStamps=[] self.LockInSig = [] #Do the IV if controller.NoIVs.get() == 1: #if just doing the one self.take_IV_data(controller, self.Voltage_ID) else: #multi IV and save self.heating_points = np.linspace(controller.HeaterLowerV.get(), controller.HeaterUpperV.get(),controller.NoIVs.get()) self.heater_point_id = 0 controller.sim900.write(controller.HeaterSlot.get(),'OPON') controller.sim900.write(controller.HeaterSlot.get(), 'VOLT {}'.format(round(self.heating_points[self.heater_point_id],2))) #wait for temo to settle and start taking data (5 mins) controller.after(300000, self.take_IV_data, controller, self.Voltage_ID)
def setup_data_gather(self, controller): #sets up header data and connects all isntruments required controller.Filename = os.path.dirname( os.path.abspath(__file__)) + "\\Data\\" + time.ctime().replace( " ", "_").replace(":", "_") if controller.SIM_slots['ThermSlot'] != '': controller.headers + ['T1', 'T2', 'T3'] controller.Filename += '_temp' if controller.SIM_slots['VSource'] != '': controller.headers.append('V_Source(V)') controller.Filename += '_VSrc' if controller.SIM_slots['VMeter'] != '': controller.Filename += '_VMeas' for i in range(controller.SIM_slots['NumberOfVMeters']): controller.headers.append('V_' + str(i + 1) + '(V)') if controller.instr_address_dict['power_m_address'] != '': controller.headers.append('Power(W)') controller.Filename += '_power' #setup pwr meter connection pwr_m_address = controller.rm.open_resource( controller.instr_address_dict['power_m_address'] ) #put this in one line controller.PM100 = ThorlabsPM100.ThorlabsPM100(inst=pwr_m_address) if controller.instr_address_dict['pulse_c_address'] != '': controller.headers.append('Counts') controller.Filename += '_counts' #setup pulse counter connection controller.PCounter = ResourceManager.open_resource( controller.instr_address_dict['pulse_c_address']) #PRINT HEADERS TO FILE# controller.Filename += '.txt' try: os.makedirs(os.path.dirname(controller.Filename)) except OSError: pass with open(controller.Filename, 'a+') as file_handle: writer_csv = csv.writer(file_handle, delimiter=',') writer_csv.writerow(controller.headers) #setup connections to SIM9000 if required if (controller.SIM_slots['ThermSlot'], controller.SIM_slots['VMeter'], controller.SIM_slots['VSource']) != ('', '', ''): controller.sim900 = SIM900( controller.instr_address_dict['sim900_address'])
def start_meas(self, controller, start_bias, stop_bias, bias_step, bias_r, attens, wav, ip_pwr): if start_bias == '': messagebox.showerror('Error', 'Enter a valid start bias value') elif stop_bias == '': messagebox.showerror('Error', 'Enter a valid stop bias value') elif bias_step == '': messagebox.showerror('Error', 'Enter a valid bias step value') elif bias_r == '': messagebox.showerror('Error', 'Enter a valid bias resistor value') elif attens == '': messagebox.showerror('Error', 'Enter a valid attenuation value') elif wav == '': messagebox.showerror('Error', 'Enter a valid wavelength value') elif ip_pwr == '': messagebox.showerror('Error', 'Enter a valid input power value') else: controller.EFF_filename = os.path.dirname(os.path.abspath(__file__))+"\\Data\\"+time.ctime().replace(" ", "_").replace(":","_")+"EFF.txt" self.first_atten = True self.biases = np.arange(float(start_bias), float(stop_bias)+float(bias_step), float(bias_step)) self.bias_r = float(bias_r) self.attens = attens.split(',') self.wav = int(wav) self.ip_pwr = float(ip_pwr) #open pulse counter controller.PCounter = controller.rm.open_resource(controller.instr_address_dict['pulse_c_address']) #setup pulse counter controller.PCounter.write(':INP1:COUP AC;IMP 50 OHM') controller.PCounter.write('SENS:TOT:ARM:STOP:TIM 1') #open sim900 controller.sim900 = SIM900(controller.instr_address_dict['sim900_address']) #open attenuator if controller.manual_atten == False: controller.Op_Attn_1 = controller.rm.open_resource(controller.instr_address_dict["opat1_address"]) if controller.instr_address_dict["opat2_address"] != '': controller.Op_Attn_2 = controller.rm.open_resource(controller.instr_address_dict["opat2_address"]) self.working_label['text']="Measurement running!" self.working_label['foreground']='green' self.setup_measurement(controller)
def initialise(self): self.ph = PowerSupply(addressbook['power_supply_1']['addr'], addressbook['power_supply_1']['channels']) self.ps = PowerSupply(addressbook['power_supply_2']['addr'], addressbook['power_supply_2']['channels']) self.temp = Model224(addressbook['temperature_readout']['addr']) self.sim = SIM900(addressbook['sim900_1']['addr']) self.res_bridge_address = addressbook['sim900_1']['modules'][ 'ac_bridge'] #just for reference, this is horrible and needs to go ^^^ self.ph.set_output_state(False) self.ps.set_output_state(False) self.get_temperatures() self._is_running(False) self.cr = CommandReceiver() self.cr.register_command('sim900_1_ask', self.sim.ask) self.cr.register_command('sim900_1_read', self.sim.read) self.cr.register_command('sim900_1_write', self.sim.write) self._LUKE_reset_stage()
def do_IV(self, controller): #Sets isSaved to False for new IV controller.isSaved = False controller.dataTaken=False #Sets up SIM controller.sim900 = SIM900(self.SIM900_add_entry.get()) #Calculate parameters for IV VLower=controller.VLower.get() VUpper=controller.VUpper.get() VStep=controller.VStep.get() self.SupplyResistor=controller.R.get() self.numberDatapoints=len(np.arange(VLower,VUpper+VStep,VStep))*2 self.progressInterval=100/(self.numberDatapoints+1) #Voltages - probably a better way to do this? self.Voltages=[] self.Voltage_ID=0 #0 to upper for i in np.arange(0,(VUpper+VStep),VStep): self.Voltages.append(i) #Back to 0 for i in np.arange(VUpper,(0-VStep),-VStep): self.Voltages.append(i) #0 to lower for i in np.arange(0,(VLower-VStep),-VStep): self.Voltages.append(i) #back to 0 for i in np.arange(VLower,(0+VStep),VStep): self.Voltages.append(i) #Time started self.timeStart=time.time() #Data holders self.Voltage1=[] self.Voltage2=[] self.TimeStamps=[] #Do the IV self.take_IV_data(controller, self.Voltage_ID)
#Log temp for new 1K fridge initial cooldowns. from hardware import SIM900 import csv import time SIM_add='ASRL7' Therm_slot='8' AC_bridge_slot='5' log_file='temp_log.txt' time_const=5 SIM900 = SIM900(SIM_add) start_time=time.time() with open(log_file, 'a') as logging_file: writer_log = csv.writer(logging_file) writer_log.writerow(['timestamp(s)', 'c_head_temp(K)', 'film_burner_temp(K)', 'mainplate_temp(K)', 'he_pump_temp(K)', 'heat_sw_temp(K)']) while True: timestamp=str(time.time()-start_time) c_head_temp =SIM900.ask(AC_bridge_slot, 'TVAL?') #Cold Head temp film_burner_temp = SIM900.ask(Therm_slot, 'TVAL? 1') #f_burner mainplate_temp =SIM900.ask(Therm_slot,'TVAL? 2') he_pump_temp = SIM900.ask(Therm_slot, 'TVAL? 3') heat_sw_temp = SIM900.ask(Therm_slot, 'TVAL? 4') temp_data_str = [timestamp, c_head_temp, film_burner_temp, mainplate_temp, he_pump_temp, heat_sw_temp] print(temp_data_str) with open(log_file, 'a') as logging_file: writer_log = csv.writer(logging_file)
else: temp_list.append((row[0])) volt_list.append((row[1])) temp_arr=np.asarray(temp_list, dtype='float') volt_arr=np.asarray(volt_list, dtype='float') #SIM900 needs rounding of lakeshore values to take them temp_arr = np.round(temp_arr, 5) volt_arr = np.round(volt_arr, 5) #Optional plotting to see curve #plt.loglog(temp_arr,volt_arr ) #plt.show() #Initialise cal SIM900_mf=SIM900(SIM900_add) if channel_to_update=='all': ch_nums=['1','2','3','4'] else: ch_nums=[channel_to_update] for ch_num in ch_nums: SIM900_mf.write(SIM922_slot, 'CINI '+ch_num+', '+curve_type+', '+curve_string) sleep(1) #Add cal points #Note points must be added in increasing resistance value according to SIM921 docs for i in range(len(temp_list)): string_to_write='CAPT '+ch_num+', '+str(volt_arr[i])+', '+str(temp_arr[i]) SIM900_mf.write(SIM922_slot, string_to_write) sleep(1) #Check the curve