def initialiseParameters(self): # Communiate with the analog powermeter # self.apm = AnalogComm(analogpm_add) # self.APM_CHANNEL = 1 # # Communicate with the usb counter self.counter = Countercomm(counter_add) self.counter.set_gate_time(30) # Create a variable to store the average value & number of averages of the analog powermeter self.average_apm = 0 self.NUM_OF_AVG = 20 # Creating the objects voltage_handler self.voltage_handler = [0, 0, 0, 0, 0, 0, 0] for i in range(1, 7): self.voltage_handler[i] = VoltageHandler(MAX_STEP_VOLTAGE[i], i) # Initialise the variable set_voltage: These are the values that we want to set the DAC to. # Note: In voltage 6, it is the set_value (from GUI) + the fine adjustment for locking self.set_voltage = [0, 0, 0, 0, 0, 0, 0] # Initialise the offset adj voltage & correction direction self.offset_adj_voltage = [0, 0] self.offset_adj_direction = 1 #1 for positive, -1 for negative direction self.count_adj_steps = 0 # Lock request variable (1: asking for lock, 0: nothing) self.lock_request = 0 # Create the locking delay variable & locking mode self.LOCKING_DELAY = 5 self.lock_delay_counter = 0 self.locking_mode = 1 # Starts locking from voltage 6 self.locking_mode_max = self.locking_mode + MAX_LOCKING_TRIES
return (pac) def return_initial(): print( 'Setting the Piezo back to the initial values before the measurement') setV(V0x, V0y) print('Setting rf power to 810AOM back to originial values') dds_810.set_power(init_power) ############################################################################################## #initial miniusb counter device miniusb_port = '/dev/serial/by-id/usb-Centre_for_Quantum_Technologies_USB_Counter_Ucnt-QO10-if00' miniusb = Countercomm(miniusb_port) miniusb.set_gate_time(30) #initiate analogI0 analogIO_port = '/dev/serial/by-id/usb-Centre_for_Quantum_Technologies_Analog_Mini_IO_Unit_MIO-QO13-if00' analogIO = AnalogComm(analogIO_port) #filename filename = 'landscape_ext_810_c2.dat' #Parmeters defnition #Retrieve current voltage set to PZT as the initial VX0,VY0 socket.send("CheckVolt 5") V0y = float((socket.recv()).split()[-1]) socket.send("CheckVolt 6") V0x = float((socket.recv()).split()[-1])
message = socket.recv() def getCount(miniusb, channel=0, average=10): counts = [] for i in range(average): counts.append(miniusb.get_counts(channel)) average_count = np.mean(counts) return average_count ############################################################################################## #initial miniusb counter device address_port = '/dev/serial/by-id/usb-Centre_for_Quantum_Technologies_USB_Counter_Ucnt-QO10-if00' miniusb = Countercomm(address_port) #Parmeters defnition #Retrieve current voltage set to PZT as the initial VX0,VY0 socket.send("CheckVolt 5") V0y = float((socket.recv()).split()[-1]) socket.send("CheckVolt 6") V0x = float((socket.recv()).split()[-1]) print('Initial Voltage: ', V0x, V0y) #Scanning rangeVx = 0.1 rangeVy = 0.1 stepV = 0.01 numStepx = int(rangeVx / stepV) numStepy = int(rangeVy / stepV) xgrid = np.arange(-numStepx, numStepx + 1) * stepV