diff --git a/config/config.properties b/config/config.properties index 437f631d..52872514 100644 --- a/config/config.properties +++ b/config/config.properties @@ -1,4 +1,4 @@ -#Fri Jan 21 10:49:04 CET 2022 +#Tue Feb 01 16:23:50 CET 2022 autoSaveScanData=true simulation=false commandExecutionEvents=false diff --git a/config/settings.properties b/config/settings.properties index 4b1e5d99..6fe3d86d 100644 --- a/config/settings.properties +++ b/config/settings.properties @@ -1,7 +1,7 @@ -#Fri Jan 21 10:49:04 CET 2022 +#Tue Feb 01 16:23:50 CET 2022 pgroup=p17274 -proposal= +proposal=test proposer=bl-dev prefix= -sample= +sample=software test authors=matthias muntwiler diff --git a/config/variables.properties b/config/variables.properties index d986cd35..aeaf44c6 100644 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,4 +1,4 @@ -#Fri Jan 21 12:19:57 CET 2022 -LastRunDate=220121 -FileSequentialNumber=10677 -DaySequentialNumber=5 +#Wed Feb 02 15:56:32 CET 2022 +LastRunDate=220202 +FileSequentialNumber=10872 +DaySequentialNumber=1 diff --git a/script/MultiRegionScan.py b/script/MultiRegionScan.py index a29df9bf..3f6e8d83 100644 --- a/script/MultiRegionScan.py +++ b/script/MultiRegionScan.py @@ -14,19 +14,19 @@ usage: """ # dummy scan (time series) -#MOTORS = [dummy] +MOTORS = [dummy] # photon energy scan (do not include 'ephot' in regions in this case!) #MOTORS = [Eph] # phi scan #MOTORS = [ManipulatorPhi] # holo scan -MOTORS = (ManipulatorPhi, ManipulatorTheta) +#MOTORS = (ManipulatorPhi, ManipulatorTheta) # 2D YZ scan #MOTORS = [ManipulatorY, ManipulatorZ] # line scan [start, stop, step] -#POSITIONS = [0., 10., 0.5] -#SCAN = 'lscan' +POSITIONS = [0., 5., 0.5] +SCAN = 'lscan' # vector scan [pos1, pos2, pos3, ...] #POSITIONS = [200., 300., 400., 500.] @@ -39,13 +39,12 @@ MOTORS = (ManipulatorPhi, ManipulatorTheta) #SCAN = 'ascan' # holo scan -#PHI_RANGE = (-170.0, 170.0) # (tuple (min, max)) -PHI_RANGE = (-160.0, 160.0) # (tuple (min, max)) -THETA_RANGE = (-9.5, 80.5) # (tuple (min, max)) -STEPS = (40.0, 1.0) # (tuple (phi, theta)) -ZIGZAG = True -POSITIONS = [(PHI_RANGE[0], THETA_RANGE[0]), (PHI_RANGE[1], THETA_RANGE[1]), STEPS] -SCAN = 'ascan' +#PHI_RANGE = (-160.0, 160.0) # (tuple (min, max)) +#THETA_RANGE = (-9.0, 81.0) # (tuple (min, max)) +#STEPS = (40.0, 1.0) # (tuple (phi, theta)) +#ZIGZAG = True +#POSITIONS = [(PHI_RANGE[0], THETA_RANGE[0]), (PHI_RANGE[1], THETA_RANGE[1]), STEPS] +#SCAN = 'ascan' # seconds to wait between positioning command and triggering the detector LATENCY = 0.0 @@ -70,15 +69,14 @@ LATENCY = 0.0 # 'cis': True = constant initial state (photoemission line), False = constant final state (Auger peak), (default False) # 'slit': exit slit (default: unchanged) -REGION1 = {'name': 'Tb 4d', 'elo': 892.5, 'ehi': 899.0, 'estep': 0.1, 'epass': 50., 'tstep': 0.8, 'iter': 1, 'cis': False} -REGION2 = {'name': 'Au 4f', 'efix': 957.2, 'epass': 20., 'tstep': 0.8, 'iter': 1, 'cis': False} +REGION1 = {'name': 'peak 1', 'efix': 200., 'epass': 50., 'tstep': 2., 'iter': 1, 'cis': False} +REGION2 = {'name': 'peak 2', 'efix': 300., 'epass': 50., 'tstep': 3., 'iter': 1, 'cis': False} # list of region dictionaries to execute at each scan position REGIONS = [REGION1, REGION2] -#REGIONS = [REGION1] # close beam shutter and turn off analyser at the end of the scan -CLOSE_SHUTTER_AT_END = True +CLOSE_SHUTTER_AT_END = False # --- DO NOT EDIT BELOW THIS LINE! --- @@ -102,6 +100,11 @@ def check_region(region): print("region {0}: setting default cis = {1}".format(region['name'], region['cis'])) class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray): + """ + pseudo-device class to acquire and read out a Scienta spectrum per region. + + this devices starts the spectrum acquisition and organises the data file. + """ def initialize(self): #super(SpectrumReader, self).initialize() self.scan_index = -1 @@ -109,15 +112,15 @@ class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray): def create_datasets(self): path = get_exec_pars().scanPath + self.region_name + "/" + self.channel_begin_dataset_name = path + "ScientaChannelBegin" + self.channel_end_dataset_name = path + "ScientaChannelEnd" + create_dataset(self.channel_begin_dataset_name, 'd') + create_dataset(self.channel_end_dataset_name, 'd') if self.region['fixed']: self.channel_center_dataset_name = path + "ScientaChannelCenter" create_dataset(self.channel_center_dataset_name, 'd') else: - self.channel_begin_dataset_name = path + "ScientaChannelBegin" - self.channel_end_dataset_name = path + "ScientaChannelEnd" self.step_energy_dataset_name = path + "ScientaStepEnergy" - create_dataset(self.channel_begin_dataset_name, 'd') - create_dataset(self.channel_end_dataset_name, 'd') create_dataset(self.step_energy_dataset_name, 'd') if 'epass' in self.region: @@ -138,10 +141,8 @@ class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray): if self.scan_index != get_exec_pars().index: self.scan_index = get_exec_pars().index self.create_datasets() - if self.region_index == 0: - print "scan {0}".format(self.scan_index) - print "scan {0}, region {1}".format(self.scan_index, self.region_index) + print "scan {0}, region {1} ({2})".format(self.scan_index, self.region_index, self.region['name']) edelta = 0.0 try: @@ -169,8 +170,6 @@ class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray): Scienta.lowEnergy.write(elo) Scienta.highEnergy.write(ehi) Scienta.stepSize.write(self.region['estep']) - append_dataset(self.channel_begin_dataset_name, elo) - append_dataset(self.channel_end_dataset_name, ehi) append_dataset(self.step_energy_dataset_name, self.region['estep']) try: @@ -198,42 +197,64 @@ class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray): pass Scienta.update() - + def read(self): # print("spectrum.read") global current_region_index current_region_index = self.region_index self.setup() - print("Acquiring region {0}.".format(self.region['name'])) + # print("Acquiring region {0}.".format(self.region['name'])) trig_scienta() - time.sleep(0.5) + time.sleep(0.1) sp = Scienta.getSpectrum().read() + append_dataset(self.channel_begin_dataset_name, Scienta.getChannelBegin().getValue()) + append_dataset(self.channel_end_dataset_name, Scienta.getChannelEnd().getValue()) return sp def getSize(self): + # this is called before the scan starts - we have to predict the spectrum size + # wrong values don't seem to affect the data files, however if self.region['fixed']: - nx = 992 + nx = 1066 else: nx = int((self.region['ehi'] - self.region['elo']) / self.region['estep']) + 1 return nx -class ImageReader(ReadonlyRegisterBase, ReadonlyRegisterMatrix): +class ImageReader(ReadonlyRegisterBase, ReadonlyRegisterMatrix): + """ + pseudo-device class to read out the Scienta image per region. + + this device just reads out the Scienta image that has been acquired by SpectrumReader. + """ def read(self): # print("image.read") return Scienta.getDataMatrix().read() def getWidth(self): + # this is called before the scan starts - we have to predict the spectrum size + # wrong values don't seem to affect the data files, however if self.region['fixed']: - nx = 992 + nx = 1066 else: nx = int((self.region['ehi'] - self.region['elo']) / self.region['estep']) + 1 return nx def getHeight(self): + # this is called before the scan starts - the number of slices is an independent parameter ny = Scienta.slices.read() return ny +class SimpleDeviceReader(Readable): + """ + pseudo-device class to read out another device once per region. + + the device must be set assigned to the source attribute. + """ + def read(self): + return self.source.read() + + def setup_live_plots(regions): global live_plots global current_region_index @@ -258,6 +279,13 @@ def update_live_plots(): print "Stopping live spectra" def do_scan(scan, motors, positions, regions, latency): + """ + set up detectors and run the scan + + for each region we have to add a SpectrumReader and an ImageReader pseudo-device to the SENSORS list. + the order SpectrumReader, ImageReader is important because the SpectrumReader triggers the Scienta, + whereafter the ImageReader reads the image. + """ global SENSORS SENSORS = [] @@ -280,8 +308,16 @@ def do_scan(scan, motors, positions, regions, latency): set_device_alias(image, reader.region_name + "/ScientaImage") SENSORS.append(image) - SENSORS.append(SampleCurrent) - SENSORS.append(RefCurrent) + dev = SimpleDeviceReader() + dev.source = SampleCurrent + set_device_alias(dev, reader.region_name + "/SampleCurrent") + SENSORS.append(dev) + + dev = SimpleDeviceReader() + dev.source = RefCurrent + set_device_alias(dev, reader.region_name + "/RefCurrent") + SENSORS.append(dev) + adjust_sensors() set_adc_averaging() diff --git a/script/local_femto.py b/script/local_femto.py index 90912b68..6eaf9288 100644 --- a/script/local_femto.py +++ b/script/local_femto.py @@ -357,10 +357,22 @@ def adjust_sensors(): #Device aliases for data files set_device_alias(Scienta.dataMatrix, "ScientaImage") set_device_alias(Scienta.spectrum, "ScientaSpectrum") -set_device_alias(Scienta.centerEnergy, get_diag_name(Scienta.centerEnergy)) +set_device_alias(Scienta.channelBegin, get_diag_name(Scienta.channelBegin)) +set_device_alias(Scienta.channelEnd, get_diag_name(Scienta.channelEnd)) +set_device_alias(Scienta.sliceBegin, get_diag_name(Scienta.sliceBegin)) +set_device_alias(Scienta.sliceEnd, get_diag_name(Scienta.sliceEnd)) +set_device_alias(Scienta.numChannels, get_diag_name(Scienta.numChannels)) +set_device_alias(Scienta.numSlices, get_diag_name(Scienta.numSlices)) set_device_alias(Scienta.lowEnergy, get_diag_name(Scienta.lowEnergy)) +set_device_alias(Scienta.centerEnergy, get_diag_name(Scienta.centerEnergy)) set_device_alias(Scienta.highEnergy, get_diag_name(Scienta.highEnergy)) +set_device_alias(ManipulatorX.readback, get_diag_name(ManipulatorX.readback)) +set_device_alias(ManipulatorY.readback, get_diag_name(ManipulatorX.readback)) +set_device_alias(ManipulatorZ.readback, get_diag_name(ManipulatorX.readback)) +set_device_alias(ManipulatorTheta.readback, get_diag_name(ManipulatorTheta.readback)) +set_device_alias(ManipulatorTilt.readback, get_diag_name(ManipulatorTilt.readback)) +set_device_alias(ManipulatorPhi.readback, get_diag_name(ManipulatorPhi.readback)) #Additional device configuration ManipulatorPhi.trustedWrite = False diff --git a/script/test/ManipulatorZFlyScan.py b/script/test/ManipulatorZFlyScan.py index b62adf95..bcc32011 100644 --- a/script/test/ManipulatorZFlyScan.py +++ b/script/test/ManipulatorZFlyScan.py @@ -15,7 +15,7 @@ RANGE = (110., 120.) SPEED = 0.2 SENSORS = (Counts, SampleCurrent, RefCurrent) -MONITORS = (SampleCurrent, ManipulatorZ) +MONITORS = (SampleCurrent) # --- do not edit below --- diff --git a/script/test/translator.py b/script/test/translator.py deleted file mode 100644 index e69de29b..00000000