def Refocus(self): index = int(self.main.Controler_Select_scan.currentText().split()[-1]) linePos = self.scanwindows[index].widget.linePos detector = device(self.main.Controler_Detector_comboBox.currentText()) dir1 = self.main.Controler_1st_comboBox.currentText() dir2 = self.main.Controler_2nd_comboBox.currentText() dir3 = self.main.Controler_3rd_comboBox.currentText() ref = {} ref[dir1] = linePos.get(dir1, self.Controler[dir1]['PosBox'].value()) if not dir2 == 'None': ref[dir2] = linePos.get(dir2, self.Controler[dir2]['PosBox'].value()) if not dir2 == 'None': ref[dir3] = linePos.get(dir3, self.Controler[dir3]['PosBox'].value()) devs = np.array([]) center = np.array([]) for key, value in ref.items(): devs = np.append(devs, device(key)) center = np.append(center, value) new_center = self.adw.focus_full(detector, devs, center, 1 * np.ones(len(devs)), .05 * np.ones(len(devs))) for idx, dev in enumerate(devs): self.Controler[dev.properties['Name']]['PosBox'].setValue( new_center[idx])
def __init__(self, dev_conf, par_conf, directory, description, *args): self.dev_conf = dev_conf self.par_conf = par_conf self.directory = directory self.description = description QMainWindow.__init__(self, *args) self.main = Ui_MainWindow() self.main.setupUi(self) self.file_menu = QtGui.QMenu('&File', self) self.file_menu.addAction('&Quit', self.fileQuit, QtCore.Qt.CTRL + QtCore.Qt.Key_Q) self.file_menu.addAction('&Close all scan windows', self.CloseScans) self.menuBar().addMenu(self.file_menu) self.help_menu = QtGui.QMenu('&Help', self) self.menuBar().addSeparator() self.menuBar().addMenu(self.help_menu) self.device_names = device(type='Adwin', filename=self.dev_conf) self.devices = {} for name in self.device_names.properties: self.devices[name] = device(type='Adwin', name=name, filename=self.dev_conf) self.adw = adq('lib/adbasic/adwin.T99') if self.adw.adw.Test_Version() != 0: self.adw.boot() print('Booting the ADwin...') self.adw.load() self.scanwindows = {} self.scanindex = 0 self.monitor = {} self.init_labels()
#initialize the adwin and the devices name = input('Give the name of the sample: ') cwd = os.getcwd() savedir = 'D:\\Data\\' + str(datetime.now().date()) + '\\' if not os.path.exists(savedir): os.makedirs(savedir) i = 1 filename = name while os.path.exists(savedir + filename + "_633_raw_image.txt"): filename = '%s_%s' % (name, i) i += 1 logger.info('%s\\%s.log' % (savedir, filename)) print('Data will be saved in %s' % (savedir + filename)) #init the Adwin programm and also loading the configuration file for the devices adw = adq('lib/adbasic/adwin.T99') xpiezo = device('x piezo') ypiezo = device('y piezo') zpiezo = device('z piezo') counter = device('APD 1') lockin = device('Lock-in') #Newport Power Meter pmeter = pp(0) pmeter.initialize() pmeter.wavelength = 633 pmeter.attenuator = True pmeter.filter = 'Medium' pmeter.go = True pmeter.units = 'Watts' #Using bright particle to focus
name = 'power_intensity' savedir = 'D:\\Data\\' + str(datetime.now().date()) + '\\' if not os.path.exists(savedir): os.makedirs(savedir) i = 1 filename = '%s_%s.dat' % (name, i) while os.path.exists(savedir + filename): i += 1 filename = '%s_%s.dat' % (name, i) logger.info('%s\\%s.log' % (savedir, filename)) print('Data will be saved in %s' % (savedir + filename)) #init the Adwin programm and also loading the configuration file for the devices adw = adq('lib/adbasic/adwin.T99') xpiezo = device('x piezo') ypiezo = device('y piezo') zpiezo = device('z piezo') counter = device('APD 1') aom = device('AOM') devs = [xpiezo, ypiezo, zpiezo] number_of_spectra = 10 #Newport Power Meter pmeter = pp(0) pmeter.initialize() pmeter.wavelength = 633 pmeter.attenuator = True pmeter.filter = 'Medium' pmeter.go = True
name = input('Give the name of the sample: ') cwd = os.getcwd() savedir = 'D:\\Data\\' + str(datetime.now().date()) + '\\' if not os.path.exists(savedir): os.makedirs(savedir) i = 1 filename = name while os.path.exists(savedir + filename + "PT_pump_dep.txt"): filename = '%s_%s' % (name, i) i += 1 filename = filename + "PT_probe_dep.txt" logger.info('%s\\%s.log' % (savedir, filename)) print('Data will be saved in %s' % (savedir + filename)) #init the Adwin programm and also loading the configuration file for the devices adw = adq('lib/adbasic/adwin.T99') xpiezo = device('x piezo') ypiezo = device('y piezo') zpiezo = device('z piezo') counter = device('Lock-in') aom = device('AOM') adw.go_to_position([aom], [1.5]) #Newport Power Meter pmeter = pp(0) pmeter.initialize() pmeter.wavelength = 1064 pmeter.attenuator = True pmeter.filter = 'Medium' pmeter.go = True pmeter.units = 'Watts'
def __init__(self, MplAnimate, parent=None): #super(MplCanvas, self).__init__(self.imv) QtGui.QGraphicsObject.__init__(self) self.setParent(parent) self.parent = parent self.xdata = [] self.ydata = [] self.MplAnimate = MplAnimate self.fifo = variables('Fifo') self.par = variables('Par') if MplAnimate.option[0] == 'Monitor': self.adw = adq('lib/adbasic/monitor.T90') self.delay = 400 * 0.1e-3 self.detector = [ device(parent.main.Monitor_comboBox.currentText()) ] self.fifo_name = '%s%i' % ( self.detector[0].properties['Type'], self.detector[0].properties['Input']['Hardware']['PortID']) self.xlabel = "Time" self.xunit = ' s' self.ylabel = "%s" % parent.main.Monitor_comboBox.currentText() self.yunit = ' %s' % self.detector[0].properties['Input'][ 'Calibration']['Unit'] self.adw.load() self.adw.start() else: self.adw = adq('lib/adbasic/adwin.T99') self.adw.load() if not self.parent.main.Scan_Dropdown.button.isEnabled(): self.detector = [ device( self.parent.main.Scan_Detector_comboBox.currentText()) ] else: i = 0 self.parent.main.Scan_Dropdown.model self.detector = [] while self.parent.main.Scan_Dropdown.model.item(i): if self.parent.main.Scan_Dropdown.model.item( i).checkState(): self.detector.append( device( self.parent.main.Scan_Dropdown.model.item( i).text())) i += 1 self.direction_1 = self.parent.main.Scan_1st_comboBox.currentText() if self.parent.main.Scan_1st_comboBox.currentText() == 'Time': self.duration = self.parent.main.Scan_1st_Range.value() self.accuracy = self.parent.main.Scan_Delay_Range.value( ) / 1000 self.delay = self.accuracy self.xlabel = "%s" % self.parent.main.Scan_1st_comboBox.currentText( ) self.xunit = ' %s' % self.parent.main.Scan_1st_UnitLabel.text() self.ylabel = [ "%s" % self.detector[i].properties['Name'] for i in range(len(self.detector)) ] self.yunit = [ ' %s' % self.detector[i].properties['Input']['Calibration']['Unit'] for i in range(len(self.detector)) ] else: self.devs = [ device(self.parent.main.Scan_1st_comboBox.currentText()) ] self.center = [ self.parent.Controler[self.parent.main.Scan_1st_comboBox. currentText()]['PosBox'].value() ] self.dims = [self.parent.main.Scan_1st_Range.value()] self.accuracy = [self.parent.main.Scan_1st_Accuracy.value()] self.xlabel = "%s" % parent.main.Scan_1st_comboBox.currentText( ) self.xunit = ' %s' % self.devs[0].properties['Output'][ 'Calibration']['Unit'] self.ylabel = [ "%s" % self.detector[i].properties['Name'] for i in range(len(self.detector)) ] self.yunit = [ ' %s' % self.detector[i].properties['Input']['Calibration']['Unit'] for i in range(len(self.detector)) ] if not self.parent.main.Scan_2nd_comboBox.currentText( ) == 'None': self.devs.append( device( self.parent.main.Scan_2nd_comboBox.currentText())) self.center.append(self.parent.Controler[ self.parent.main.Scan_2nd_comboBox.currentText()] ['PosBox'].value()) self.dims.append(self.parent.main.Scan_2nd_Range.value()) self.accuracy.append( self.parent.main.Scan_2nd_Accuracy.value()) self.ylabel = "%s" % parent.main.Scan_2nd_comboBox.currentText( ) self.yunit = ' %s' % self.devs[1].properties['Output'][ 'Calibration']['Unit'] if not self.parent.main.Scan_3rd_comboBox.currentText( ) == 'None': self.devs.append( device( self.parent.main.Scan_3rd_comboBox.currentText())) self.center.append(self.parent.Controler[ self.parent.main.Scan_3rd_comboBox.currentText()] ['PosBox'].value()) self.dims.append(self.parent.main.Scan_3rd_Range.value()) self.accuracy.append( self.parent.main.Scan_3rd_Accuracy.value()) self.speed = self.parent.main.Scan_Delay_Range.value() self.delay = self.speed self.fifo_name = 'scan_data'
cwd = os.getcwd() savedir = 'D:\\Data\\' + str(datetime.now().date()) + '\\' if not os.path.exists(savedir): os.makedirs(savedir) i = 1 filename = name while os.path.exists(savedir + filename + ".dat"): filename = '%s_%s' % (name, i) i += 1 filename = filename + ".dat" logger.info('%s\\%s.log' % (savedir, filename)) print('Data will be saved in %s' % (savedir + filename)) #init the Adwin programm and also loading the configuration file for the devices adw = adq('lib/adbasic/fast_timetrace.T98') adw.load('lib/adbasic/fast_timetrace.T98') counter = device('APD 1') timetrace_time = 5 # In seconds integration_time = .000005 # In seconds number_elements = int(timetrace_time / integration_time) data = np.zeros([1, number_elements + 1]) print('Acquiring Timetrace') dd = adw.get_fast_timetrace(counter, duration=timetrace_time, acc=integration_time) dd = np.array(dd) data = dd header = "Fast Timetrace of APD" np.savetxt("%s%s" % (savedir, filename),