def runInnerScan(): idenergy = int(energy_id.read()) halfwidth = 13.0 step = 1.0 try: set_exec_pars(range="auto") #TODO: Set the diplay names of positioners and detectors scan = ManualScan(['PGMenergy'], ['I0', 'polarization', 'polangle', 'ringCurrent', 'SetEnergy', 'offset'] , [idenergy-halfwidth], [idenergy+halfwidth], [20]) scan.start() #Creating channels: dimension 1 #RegionPositioner PGMenergy PGMenergy = Channel('X07MA-PHS-E:GO.A', type = 'd') PGMenergyReadback = Channel('X07MA-PGM:CERBK', type = 'd') #ScalarDetector I0 I0 = Channel('X07MA-ES1-AI:SIGNAL1', type = 'd') #ScalarDetector polarization polarization = Channel('X07MA-ID:MODE', type = 'd') #ScalarDetector polangle polangle = Channel('X07MA-ID:ALPHA', type = 'd') ringCurrent = Channel('ARIDI-PCT:CURRENT', type = 'd') #ScalarDetector SetEnergy SetEnergy = Channel('X07MA-PHS-E:GO.A', type = 'd') #ScalarDetector offset offset = Channel('X07MA-ID:ENERGY-OFFS', type = 'd') #Dimension 1 #RegionPositioner PGMenergy for setpoint1 in frange(idenergy-halfwidth, idenergy+halfwidth, step, True): #TODO: Uncomment me #PGMenergy.put(setpoint1, timeout=30.) # TODO: Set appropriate timeout #wait_device(energy_done, 1 ) #sleep( 0.5 ) # Settling time readback1 = PGMenergyReadback.get() #if abs(readback1 - setpoint1) > 0.5 : # TODO: Check accuracy #raise Exception('Actor PGMenergy could not be set to the value ' + str(setpoint1)) #Detector I0 detector2 = I0.get() #Detector polarization detector3 = polarization.get() #Detector polangle detector4 = polangle.get() #Detector ringCurrent detector6 = ringCurrent.get() #Detector SetEnergy detector7 = SetEnergy.get() #Detector offset detector10 = offset.get() scan.append ([setpoint1], [readback1], [detector2, detector3, detector4, detector6, detector7, detector10]) #Closing channels PGMenergy.close() PGMenergyReadback.close() I0.close() polarization.close() polangle.close() ringCurrent.close() SetEnergy.close() offset.close() scan.end() return scan.getResult() except: print("Aborting...") raise