From 95f81944307493899e9d33b7ae6269ef23210f23 Mon Sep 17 00:00:00 2001 From: gac-x03da Date: Tue, 24 Apr 2018 16:48:35 +0200 Subject: [PATCH] Closedown --- script/FermiSurfScan.py | 33 ---------- script/ManipulatorYZScanAtAngle.py | 48 -------------- script/PhdScan.py | 96 ---------------------------- script/RefocusManipulatorScan.py | 46 ------------- script/RefocusRZManipulatorZScan.py | 38 ----------- script/RefocusYManipulatorZScan.py | 36 ----------- script/RefocusYRotScan.py | 34 ---------- script/XASAziScan.py | 28 -------- script/XASFly.py | 54 ---------------- script/XYScan.py | 19 ------ script/local.py | 13 ++-- script/optics/ExitSlitScan.py | 16 ++--- script/optics/ExitSlitScanKei.py | 62 ------------------ script/optics/ExitSlitYScan.py | 16 +---- script/optics/ExitSlitYScanKei.py | 68 -------------------- script/optics/FocusXRotScan.py | 18 ++---- script/optics/FocusYRotScan.py | 10 +-- script/optics/MonoThetaBetaScan.py | 33 ---------- script/test/ManipulatorFlyScan.py | 39 ----------- script/test/ManipulatorSampleScan.py | 36 ----------- script/test/ManipulatorScanKei.py | 29 --------- 21 files changed, 22 insertions(+), 750 deletions(-) delete mode 100644 script/FermiSurfScan.py delete mode 100644 script/ManipulatorYZScanAtAngle.py delete mode 100644 script/PhdScan.py delete mode 100644 script/RefocusManipulatorScan.py delete mode 100644 script/RefocusRZManipulatorZScan.py delete mode 100644 script/RefocusYManipulatorZScan.py delete mode 100644 script/RefocusYRotScan.py delete mode 100644 script/XASAziScan.py delete mode 100644 script/XASFly.py delete mode 100644 script/XYScan.py delete mode 100644 script/optics/ExitSlitScanKei.py delete mode 100644 script/optics/ExitSlitYScanKei.py delete mode 100644 script/optics/MonoThetaBetaScan.py delete mode 100644 script/test/ManipulatorFlyScan.py delete mode 100644 script/test/ManipulatorSampleScan.py delete mode 100644 script/test/ManipulatorScanKei.py diff --git a/script/FermiSurfScan.py b/script/FermiSurfScan.py deleted file mode 100644 index c2b53604..00000000 --- a/script/FermiSurfScan.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -Arguments: - -MOTOR (device) -SENSORS (list) -RANGE (tuple (min, max)) -STEPS (int or tuple) -LATENCY (double) -RELATIVE (BOOLEAN) -""" - -STEPS = (1.0) -LATENCY = 0.0 -ENDSCAN = False -ZIGZAG = False - -MOTORS = (ManipulatorTheta) -SENSORS = (Counts,Scienta.dataMatrix, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) -STARTPOS = (-11.0) -ENDPOS = (+20.0) -RELATIVE = False - -#set_preference(Preference.PLOT_TYPES,{'ImageIntegrator':1}) -adjust_sensors() -set_adc_averaging() -#set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) - -try: - lscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) -finally: - if ENDSCAN: - after_scan() - \ No newline at end of file diff --git a/script/ManipulatorYZScanAtAngle.py b/script/ManipulatorYZScanAtAngle.py deleted file mode 100644 index 4e53321a..00000000 --- a/script/ManipulatorYZScanAtAngle.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -manipulator grid scan at non-normal theta angle - -set manipulator scan parameters below. -set analyser parameters separately! -move manipulator to center position before start! - -""" - -import math - -# adjust the following parameters -DISTANCE_XY = 1.0 -DISTANCE_Z = 1.0 -ANGLE = -30.0 # move the sample perpendicularly across the beam -#ANGLE = +60.0 # move the sample along the beam -POINTS_XY = 3 -POINTS_Z = 3 - -SENSORS = (Counts, Scienta.spectrum, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) -#SENSORS = (Counts, Scienta.dataMatrix, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) -LATENCY = 1.0 -ENDSCAN = True - -# do not edit below -DISTANCE_X = DISTANCE_XY * math.cos(math.radians(ANGLE)) -DISTANCE_Y = DISTANCE_XY * math.sin(math.radians(ANGLE)) - -RELATIVE = True -TOTAL_POINTS = POINTS_XY * POINTS_Z -zv = [(int(i / POINTS_Z) - (POINTS_Z - 1) / 2.) * DISTANCE_Z / 2. for i in range(TOTAL_POINTS)] -xyv = [((i % POINTS_Z) - (POINTS_XY - 1) / 2.) * DISTANCE_XY / 2. for i in range(TOTAL_POINTS)] -xv = [xy * math.cos(math.radians(ANGLE)) for xy in xyv] -yv = [xy * math.sin(math.radians(ANGLE)) for xy in xyv] - -VECTOR = [[xv[i], yv[i], zv[i]] for i in range(TOTAL_POINTS)] - -MOTORS = (ManipulatorX, ManipulatorY, ManipulatorZ) - -adjust_sensors() -set_adc_averaging() - -try: - vscan(MOTORS, SENSORS, VECTOR, line=False, latency=LATENCY, relative=RELATIVE, before_read=before_readout, after_read=after_readout) -finally: - if ENDSCAN: - after_scan() - diff --git a/script/PhdScan.py b/script/PhdScan.py deleted file mode 100644 index b1571389..00000000 --- a/script/PhdScan.py +++ /dev/null @@ -1,96 +0,0 @@ -""" -Arguments: - -VECTOR (Double[][], Scan vector: Eph,Elow,Ehigh or Eph,Ecenter) -SENSORS (list) -LATENCY (double) -MODE ('fixed' or 'swept') -TYPE ('CIS' or 'CFS') -STEP (double) -""" - -LATENCY = 2.0 - - -class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray): - def doRead(self): - global VECTOR - self.offset = Eph.getSetpoint().take() - VECTOR[0] - self.setup() - trig_scienta() - time.sleep(0.5) - return Scienta.getSpectrum().read() - - def getSize(self): - return len(Scienta.getSpectrumX()) - - - -class SpectrumReader1(SpectrumReader): - def setup(self): - global initial_energy_range - Scienta.getLowEnergy().write(initial_energy_range[0][0] + self.offset) - Scienta.getHighEnergy().write(initial_energy_range[0][1] + self.offset) - Scienta.getStepSize().write(initial_energy_range[0][2]) - -class SpectrumReader2(SpectrumReader): - def setup(self): - global initial_energy_range - Scienta.getLowEnergy().write(initial_energy_range[1][0] + self.offset) - Scienta.getHighEnergy().write(initial_energy_range[1][1] + self.offset) - Scienta.getStepSize().write(initial_energy_range[1][2]) - -class SpectrumReader3(SpectrumReader): - def setup(self): - global initial_energy_range - Scienta.getLowEnergy().write(initial_energy_range[2][0] + self.offset) - Scienta.getHighEnergy().write(initial_energy_range[2][1] + self.offset) - Scienta.getStepSize().write(initial_energy_range[2][2]) - -class ImageReader(ReadonlyRegisterBase, ReadonlyRegisterMatrix): - def doRead(self): - return Scienta.getDataMatrix().read() - - def getWidth(self): - global initial_energy_range - return int( (initial_energy_range[self.index][1] - initial_energy_range[self.index][0]) / initial_energy_range[self.index][2]) - - def getHeight(self): - return Scienta.getDataMatrix().getHeight() - - -def measure_stuff(): - global VECTOR - reader1 = SpectrumReader1(); reader1.initialize() - reader2 = SpectrumReader2(); reader2.initialize() - #reader3 = SpectrumReader3(); reader3.initialize() - image1 = ImageReader(); image1.initialize(); image1.index=0; set_device_alias(image1, "Image1") - image2 = ImageReader(); image2.initialize(); image2.index=1; set_device_alias(image2, "Image2") - #image3 = ImageReader(); image3.initialize(); image3.index=2; set_device_alias(image3, "Image3") - - Scienta.getDataMatrix() - - SENSORS = [RefCurrent, reader1, image1, reader2, image2]#, reader3, image3] - - Scienta.setAcquisitionMode(ch.psi.pshell.epics.Scienta.AcquisitionMode.Swept) - - adjust_sensors() - set_adc_averaging() - set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) - - vscan(Eph, SENSORS, VECTOR, True, LATENCY,False, before_read=wait_beam, after_read = after_readout) - -global initial_energy_range, VECTOR, SENSORS -SENSORS = [] - -# N 1s, azi = 21.1, -8.9; tilt = 0.5, 0.5 -VECTOR = [425.0 + i * 2.5 for i in range(121)] -initial_energy_range = [[19.0, 26.0, 0.1], - [26.0, 36.0, 0.5]] - -# B 1s; azi = 21.1; tilt = 25.5; 2 sweeps -VECTOR = [213.0 + i * 2.5 for i in range(121)] -initial_energy_range = [[19.0, 26.0, 0.1], - [26.0, 36.0, 0.5]] - -measure_stuff() diff --git a/script/RefocusManipulatorScan.py b/script/RefocusManipulatorScan.py deleted file mode 100644 index 9f55ec3b..00000000 --- a/script/RefocusManipulatorScan.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -Scan refocusing mirror RY and manipulator X in parallel (to find analyser focus). -Beam stays on same spot on the sample. - -set scan parameters below. -set analyser parameters separately! -move manipulator and mirror to center position before start! -""" - -import math - -# adjust the following parameters -DISTANCE_X = 1.0 # mm -#DISTANCE_Ry = 0.5 # mrad (Ry) -SLOPE = 1.0/0.24 # mm/mrad (DX / DRy) -STEPS = 120 -LATENCY = 0.0 -ENDSCAN = False - -# do not edit below -#DISTANCE_X = DISTANCE_Ry * SLOPE -DISTANCE_Ry = DISTANCE_X / SLOPE - -MOTOR = (RefocusYRot, ManipulatorX) -SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) -STARTPOS = (-DISTANCE_Ry / 2.0, -DISTANCE_X / 2.0) -ENDPOS = (DISTANCE_Ry / 2.0, DISTANCE_X / 2.0) -RELATIVE = True - -#STARTPOS = (-1.670, -5.000) -#ENDPOS = (-0.330, 1.000) -#RELATIVE = False - -adjust_sensors() -set_adc_averaging() - -def trig_sensors(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - trig_scienta() - -try: - lscan(MOTOR, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=trig_sensors, after_read = after_readout) -finally: - if ENDSCAN: - after_scan() diff --git a/script/RefocusRZManipulatorZScan.py b/script/RefocusRZManipulatorZScan.py deleted file mode 100644 index 649b5b81..00000000 --- a/script/RefocusRZManipulatorZScan.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -Scan refocusing mirror ROZ and manipulator X in parallel (to find analyser focus). -Beam stays on same spot on the sample. - -set scan parameters below. -set analyser parameters separately! -move manipulator and mirror to center position before start! -""" - -import math - -# adjust the following parameters -STEPS = 25 -LATENCY = 0.0 -ENDSCAN = False - -# do not edit below - -MOTOR = (RefocusZRot, ManipulatorZ) -SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) - -STARTPOS = (-2.000, 114.9) -ENDPOS = (-1.259, 115.1) -RELATIVE = False - -adjust_sensors() -set_adc_averaging() - -def trig_sensors(): - wait_beam() - trig_scienta() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -try: - lscan(MOTOR, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=trig_sensors, after_read = after_readout) -finally: - if ENDSCAN: - after_scan() diff --git a/script/RefocusYManipulatorZScan.py b/script/RefocusYManipulatorZScan.py deleted file mode 100644 index b95a4e7b..00000000 --- a/script/RefocusYManipulatorZScan.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -Scan refocusing mirror Y and manipulator Z in parallel (to find analyser focus). -Beam stays on same spot on the sample. - -set scan parameters below. -set analyser parameters separately! -move manipulator and mirror to center position before start! -""" - -import math - -# adjust the following parameters -STEPS = 20 -LATENCY = 0.0 -ENDSCAN = False - -MOTOR = (RefocusYTrans, ManipulatorZ) -SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) - -STARTPOS = (-10.9, 115.45) -ENDPOS = (-10.7, 115.30) -RELATIVE = False - -adjust_sensors() -set_adc_averaging() - -def trig_sensors(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - trig_scienta() - -try: - lscan(MOTOR, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=trig_sensors, after_read = after_readout) -finally: - if ENDSCAN: - after_scan() diff --git a/script/RefocusYRotScan.py b/script/RefocusYRotScan.py deleted file mode 100644 index c759386e..00000000 --- a/script/RefocusYRotScan.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Refocusing mirror Ry scan - -set scan parameters below, move the mirror to the center position. -set analyser parameters separately! -""" - -import math - -# adjust the following parameters -DISTANCE = 0.2 -STEPS = 0.005 -LATENCY = 0.5 -ENDSCAN = False - -MOTORS = (RefocusYRot) -SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) -STARTPOS = (-DISTANCE / 2.0) -ENDPOS = (DISTANCE / 2.0) -RELATIVE = True - -adjust_sensors() -set_adc_averaging() - -def trig_sensors(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - trig_scienta() - -try: - lscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=trig_sensors, after_read = after_readout) -finally: - if ENDSCAN: - after_scan() diff --git a/script/XASAziScan.py b/script/XASAziScan.py deleted file mode 100644 index e42c9c1b..00000000 --- a/script/XASAziScan.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -XAS scan -""" - -POSITIONERS = (ManipulatorPhi) -SENSORS = (Keithley1, Keithley2, MachineCurrent) - -#SENSORS = (SampleCurrent, RefCurrent, AuxCurrent, AuxVoltage, MachineCurrent) -#SENSORS = (SampleCurrent, RefCurrent, AuxCurrent, MachineCurrent, OpticsCameraCentroidX, OpticsCameraSigmaX) -STARTPOS = (-179.0) -ENDPOS = (180.0) -#NUMPOINTS = 76 -STEPSIZE = 5.0 -LATENCY = 0.1 -DWELL = 0.1 - -ENDSCAN = False # close shutter at end - - -def trig(): - wait_beam() - #caput("X03DA-OP-10ADC:TRG.PROC", 1) - -try: - lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPSIZE, LATENCY, before_read=trig, after_read=after_readout) -finally: - if ENDSCAN: - after_scan() diff --git a/script/XASFly.py b/script/XASFly.py deleted file mode 100644 index c2693def..00000000 --- a/script/XASFly.py +++ /dev/null @@ -1,54 +0,0 @@ -""" -XAS on-the-fly scan - -SCRIPT NOT RUNNING! - -TO DO: probably need to wrap the mono in a ch.psi.pshell.device.Motor - or ch.psi.pshell.device.MotorGroupBase -""" - -# scan parameters - -START_ENERGY = 400.0 -END_ENERGY = 410.0 -# total scan time in seconds -SCAN_TIME = 60.0 -# dwell time (per step) in seconds -DWELL = 0.1 -# True = close shutter and turn off detectors at end, False = leave beam and detectors on -ENDSCAN = False - -# --- do not edit below --- - -mm = ch.psi.pshell.device.Motor("X03DA-PGM:MI") -gm = ch.psi.pshell.device.Motor("X03DA-PGM:GR") - -POSITIONERS = (MonoBetaMotor, MonoThetaMotor) -SENSORS = (MonoEnergy, MonoCff, MonoBeta, MonoTheta, SampleCurrent, RefCurrent, MachineCurrent) -STARTPOS = (beta1, theta1) -ENDPOS = (beta2, theta2) - -caput('X03DA-PGM:energy', END_ENERGY) -time.sleep(0.05) -beta1 = caget('X03DA-PGM:beta') -theta1 = caget('X03DA-PGM:theta') -print "end: energy = {en}, beta = {be}, theta = {th}".format(en=END_ENERGY, be=beta1, th=theta1) - -caput('X03DA-PGM:energy', START_ENERGY) -time.sleep(0.05) -beta2 = caget('X03DA-PGM:beta') -theta2 = caget('X03DA-PGM:theta') -print "start: energy = {en}, beta = {be}, theta = {th}".format(en=END_ENERGY, be=beta1, th=theta1) -Eph.write(START_ENERGY) - -LATENCY = 0. - -adjust_sensors() -set_adc_averaging() - -try: - prepare_keithleys(DWELL) - cscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, NSTEPS-1, time=scan_time, before_read=before_readout, after_read=after_readout) -finally: - if ENDSCAN: - after_scan() diff --git a/script/XYScan.py b/script/XYScan.py deleted file mode 100644 index 5f7edbc4..00000000 --- a/script/XYScan.py +++ /dev/null @@ -1,19 +0,0 @@ -SENSORS = [Counts, MachineCurrent, SampleCurrent, RefCurrent, EnergyDistribution, Scienta.getDataMatrix()] -X_RANGE = [0.0, 1.0] -Y_RANGE = [0.0, 1.0] -STEPS =[10, 10] -LATENCY = 0.0 -ZIGZAG = False -ENDSCAN = False - - - -adjust_sensors() -set_adc_averaging() -set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) - -try: - ascan((ManipulatorX, ManipulatorY), SENSORS, (X_RANGE[0], Y_RANGE[0]), (X_RANGE[1], Y_RANGE[1]), STEPS, LATENCY, relative = False, zigzag = ZIGZAG, before_read=before_readout, after_read = after_readout) -finally: - if ENDSCAN: - after_scan() \ No newline at end of file diff --git a/script/local.py b/script/local.py index 60efdf43..4a3eb89b 100644 --- a/script/local.py +++ b/script/local.py @@ -115,7 +115,7 @@ def wait_keithleys(): wait for one dwell time so that the keithleys can finish their measurement. if we polled them too early, they would produce an error message. """ - #time.sleep(KeiSample.dwell * 2.2) + time.sleep(KeiSample.dwell * 2.2) def fetch_keithleys(): """ @@ -295,10 +295,13 @@ def before_readout(): fetch_keithleys() def after_readout(rec): - if get_exec_pars().persist: - if rec.index == 0: - create_diag_datasets() - append_diag_datasets() + if beam_ok: + if get_exec_pars().persist: + if rec.index == 0: + create_diag_datasets() + append_diag_datasets() + else: + rec.invalidate() def after_scan(): """ diff --git a/script/optics/ExitSlitScan.py b/script/optics/ExitSlitScan.py index 8b4bc87b..ce1052cf 100644 --- a/script/optics/ExitSlitScan.py +++ b/script/optics/ExitSlitScan.py @@ -1,5 +1,7 @@ """ exit slit test scan + +set ADC or Keithly averaging separately. """ POSITIONERS = (ExitSlit) @@ -10,19 +12,11 @@ STEPS = 10.0 LATENCY = 0.1 DWELL = 1.0 -value = DWELL * 10.0 -SampleCurrentAveraging.write(value) -RefCurrentAveraging.write(value) -AuxCurrentAveraging.write(value) - -def trig(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) +lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=before_readout, after_read=after_readout) STARTPOS = (200.0) ENDPOS = (-10.0) STEPS = -10.0 -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) +lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=before_readout, after_read=after_readout) + diff --git a/script/optics/ExitSlitScanKei.py b/script/optics/ExitSlitScanKei.py deleted file mode 100644 index 49fa7179..00000000 --- a/script/optics/ExitSlitScanKei.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -exit slit test scan - -manual settings: photon energy 800 eV (G1200), FE = 1 x 1 - -keithley 1: diode -keithley 2: RMU -""" - -POSITIONERS = (ExitSlit) -SENSORS = (Keithley1, Keithley2, MachineCurrent) -STARTPOS = (-10.0) -ENDPOS = (200.0) -STEPS = 10.0 -LATENCY = 1.0 -DWELL = 1.0 - -KEI_DIODE = "X03DA-KEITHLEY-1:" -KEI_RMU = "X03DA-KEITHLEY-2:" - -ExitSlit.write(STARTPOS) - -caput(KEI_DIODE + "DOSETDEFAULT", 1) -caput(KEI_RMU + "DOSETDEFAULT", 1) -time.sleep(1.0) -caput(KEI_DIODE + "DOSETADVANCED", 1) -caput(KEI_RMU + "DOSETADVANCED", 1) -time.sleep(1.0) - -#caput(KEI_DIODE + "READSCAN.SCAN", 0) -#caput(KEI_DIODE + "NPLC", 1) -caput(KEI_DIODE + "NAVG", 5) -#caput(KEI_DIODE + "TCOUNT", 1) -caput(KEI_DIODE + "RANGE", 6) # 200 nA - -#caput(KEI_RMU + "READSCAN.SCAN", 0) -#caput(KEI_RMU + "NPLC", 1) -caput(KEI_RMU + "NAVG", 5) -#caput(KEI_RMU + "TCOUNT", 1) -caput(KEI_RMU + "RANGE", 8) # 2 nA - -def trig(): - wait_beam() - #WORKS: - #caput(KEI_DIODE + "DOREAD", 1) - # - caput(KEI_DIODE + "DOINIT", 1) - caput(KEI_RMU + "DOINIT", 1) - time.sleep(0.1) - caput(KEI_DIODE + "DOTRIGGER", 1) - caput(KEI_RMU + "DOTRIGGER", 1) - time.sleep(DWELL * 1.1) - caput(KEI_DIODE + "DOFETCH", 1) - caput(KEI_RMU + "DOFETCH", 1) - -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) - -STARTPOS = (200.0) -ENDPOS = (-10.0) -STEPS = -10.0 - -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) diff --git a/script/optics/ExitSlitYScan.py b/script/optics/ExitSlitYScan.py index 976d3874..18db8549 100644 --- a/script/optics/ExitSlitYScan.py +++ b/script/optics/ExitSlitYScan.py @@ -1,7 +1,7 @@ """ exit slit calibration scan -manual settings: photon energy 800 eV (G1200), FE = 1 x 1 +manual settings: photon energy 800 eV (G1200), FE = 1 x 1, ADC/Keithley averaging """ POSITIONERS = (ExitSlitY) @@ -12,17 +12,5 @@ STEPS = 0.01 LATENCY = 0.1 DWELL = 1.0 -value = DWELL * 10.0 -SampleCurrentAveraging.write(value) -RefCurrentAveraging.write(value) -AuxCurrentAveraging.write(value) +lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=before_readout, after_read=after_readout) -SampleCurrentGain.write("L, 10^7") -RefCurrentGain.write("L, 10^9") -AuxCurrentGain.write("L, 10^8") - -def trig(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) diff --git a/script/optics/ExitSlitYScanKei.py b/script/optics/ExitSlitYScanKei.py deleted file mode 100644 index 7e7ce689..00000000 --- a/script/optics/ExitSlitYScanKei.py +++ /dev/null @@ -1,68 +0,0 @@ -""" -exit slit calibration scan - -manual settings: photon energy 800 eV (G1200), FE = 1 x 1 - -keithley 1: diode -keithley 2: RMU -""" - -POSITIONERS = (ExitSlitY) -SENSORS = (Keithley1, Keithley2, MachineCurrent) -STARTPOS = (-0.5) -ENDPOS = (1.0) -STEPS = 0.01 -NSTEPS = round((ENDPOS - STARTPOS) / STEPS) + 1 -LATENCY = 0.1 -DWELL = 1.0 - -KEI_DIODE = "X03DA-KEITHLEY-1:" -KEI_RMU = "X03DA-KEITHLEY-2:" - -caput(KEI_DIODE + "DOSETDEFAULT", 1) -caput(KEI_RMU + "DOSETDEFAULT", 1) -time.sleep(1.0) -caput(KEI_DIODE + "DOSETADVANCED", 1) -caput(KEI_RMU + "DOSETADVANCED", 1) -time.sleep(1.0) -#caput(KEI_DIODE + "DATAFORMAT", 1) - - -#caput(KEI_DIODE + "DOINIT", 1) -#caput(KEI_RMU + "DOINIT", 1) -time.sleep(0.1) -#caput(KEI_DIODE + "DOTRIGGER", 1) -#caput(KEI_RMU + "DOTRIGGER", 1) -#time.sleep(DWELL * 2) -#caput(KEI_DIODE + "DOFETCH", 1) -#caput(KEI_RMU + "DOFETCH", 1) - -#caput(KEI_DIODE + "READSCAN.SCAN", 0) -#caput(KEI_DIODE + "NPLC", 1) -caput(KEI_DIODE + "NAVG", 5) -#caput(KEI_DIODE + "TCOUNT", 1) -caput(KEI_DIODE + "RANGE", 6) # 200 nA - -#caput(KEI_RMU + "READSCAN.SCAN", 0) -#caput(KEI_RMU + "NPLC", 1) -caput(KEI_RMU + "NAVG", 5) -#caput(KEI_RMU + "TCOUNT", 1) -caput(KEI_RMU + "RANGE", 8) # 2 nA - -time.sleep(1.0) - -def trig(): - wait_beam() - #WORKS: - #caput(KEI_DIODE + "DOREAD", 1) - # - caput(KEI_DIODE + "DOINIT", 1) - caput(KEI_RMU + "DOINIT", 1) - time.sleep(0.1) - caput(KEI_DIODE + "DOTRIGGER", 1) - caput(KEI_RMU + "DOTRIGGER", 1) - time.sleep(DWELL * 1.1) - caput(KEI_DIODE + "DOFETCH", 1) - caput(KEI_RMU + "DOFETCH", 1) - -lscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, before_read=trig, after_read=after_readout) diff --git a/script/optics/FocusXRotScan.py b/script/optics/FocusXRotScan.py index 4070b248..c6120154 100644 --- a/script/optics/FocusXRotScan.py +++ b/script/optics/FocusXRotScan.py @@ -2,7 +2,7 @@ Focusing mirror Rx scan to center the beam on the monochromator grating Rx = -20...+20 -set the front end to 0.5 x 0.5, exit slit to 25, photon energy to 1500 +set the front end to 0.5 x 0.5, exit slit to 25, photon energy to 1500, ADC/Keithley averaging """ import math @@ -19,13 +19,6 @@ MOTORS = [FocusXRot] SENSORS = [SampleCurrent, RefCurrent, MachineCurrent, OpticsCameraCentroidX, OpticsCameraSigmaX] RELATIVE = False -value = DWELL * 10.0 -SampleCurrentAveraging.write(value) -RefCurrentAveraging.write(value) - -SampleCurrentGain.write("L, 10^9") -RefCurrentGain.write("L, 10^9") - # front end size includes offset! FrontendHSize.write(1.0) FrontendVSize.write(0.9) @@ -34,12 +27,9 @@ ExitSlit.write(25.0) adjust_sensors() set_adc_averaging() -def trig(): - wait_beam() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - try: - lscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=trig, after_read = after_readout) + lscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) finally: if ENDSCAN: - after_scan() + after_scan() + diff --git a/script/optics/FocusYRotScan.py b/script/optics/FocusYRotScan.py index 6ca07479..c9d43b06 100644 --- a/script/optics/FocusYRotScan.py +++ b/script/optics/FocusYRotScan.py @@ -22,13 +22,9 @@ RELATIVE = True adjust_sensors() set_adc_averaging() -def trig_sensors(): - wait_beam() - #trig_scienta() - caput("X03DA-OP-10ADC:TRG.PROC", 1) - try: - lscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=trig_sensors, after_read = after_readout) + lscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) finally: if ENDSCAN: - after_scan() + after_scan() + diff --git a/script/optics/MonoThetaBetaScan.py b/script/optics/MonoThetaBetaScan.py deleted file mode 100644 index 74164ed9..00000000 --- a/script/optics/MonoThetaBetaScan.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -TEST: OTF scan for mono calibration - -under development - does not run yet - -tasks: -- find out positioner of beta angle and set up device (must be of motor class). -- load table of scan positions. -- add outer theta loop. -""" - -MOTORS = (MonoBeta) -SENSORS = (SampleCurrent, RefCurrent, MachineCurrent) -STARTPOS = (beta1) -ENDPOS = (beta2) -TIME = 120.0 # seconds -STEPS = 1000 -RELATIVE = False -ENDSCAN = False - -adjust_sensors() -set_adc_averaging() - -def trig_sensors(): - caput("X03DA-OP-10ADC:TRG.PROC", 1) - -try: - wait_beam() - cscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, time = TIME, relative = RELATIVE, before_read = trig_sensors) -finally: - if ENDSCAN: - after_scan() - diff --git a/script/test/ManipulatorFlyScan.py b/script/test/ManipulatorFlyScan.py deleted file mode 100644 index 302c2c96..00000000 --- a/script/test/ManipulatorFlyScan.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -2D Manipulator scan - -set manipulator scan parameters below. -set analyser parameters separately! -move manipulator to center position before start! - -""" - -import math - -# actual number of positions will be +1! -RANGE = (111.0, 117.5) -STEP = (0.5) -ENDSCAN = False - -MOTORS = (ManipulatorZ) -SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) - -adjust_sensors() -set_adc_averaging() -#set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) - -# time per scienta acquisition in seconds -time1 = time.time() -trig_scienta() -time2 = time.time() -scienta_time = (time2 - time1) + 1.0 -print "scienta_time: ", scienta_time - -# time for one scan step in seconds -NSTEPS = int((RANGE[1] - RANGE[0]) / STEP) + 1 -scan_time = scienta_time * NSTEPS -print "scan_time: ", scan_time - -#try: -cscan(MOTORS, SENSORS, RANGE[0], RANGE[1], NSTEPS - 1, time=scan_time, before_read=before_readout, after_read = after_readout) -#except ContinuousScanFollowingErrorException: -print time.time(), " cscan: exception" diff --git a/script/test/ManipulatorSampleScan.py b/script/test/ManipulatorSampleScan.py deleted file mode 100644 index 65dc3146..00000000 --- a/script/test/ManipulatorSampleScan.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -sample positioning scan - EXPERIMENTAL - -set manipulator scan parameters below. -set analyser parameters separately! -move manipulator to center position before start! - -""" - -import math - -# list of (start, stop, step) tuples -MOTORS = (ManipulatorY) -REGIONS = [(-3.7, -2.7, 0.025), (2.0, 3.0, 0.025)] - -#MOTORS = (ManipulatorZ) -#REGIONS = [(111.5, 112.1, 0.025), (116.8, 117.4, 0.025)] - -RELATIVE = False -LATENCY = 0.0 -ENDSCAN = False -ZIGZAG = True - -SENSORS = (Counts, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) -#SENSORS = (Counts, Scienta.spectrum, Scienta.dataMatrix, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) - -adjust_sensors() -set_adc_averaging() -#set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) - -try: - rscan(MOTORS, SENSORS, REGIONS, latency = LATENCY, relative = RELATIVE, passes = 1, zigzag = ZIGZAG, before_read = before_readout, after_read = after_readout, title = "my scan") -finally: - if ENDSCAN: - after_scan() - \ No newline at end of file diff --git a/script/test/ManipulatorScanKei.py b/script/test/ManipulatorScanKei.py deleted file mode 100644 index ece1e614..00000000 --- a/script/test/ManipulatorScanKei.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -Arguments: - -MOTOR (device) -SENSORS (list) -RANGE (tuple (min, max)) -STEPS (int or tuple) -LATENCY (double) -RELATIVE (BOOLEAN) -""" - -MOTOR = (ManipulatorY) -SENSORS = (Counts, Scienta.spectrum, SampleCurrent, RefCurrent, MachineCurrent) -RANGE = (-0.5, 0.5) -STEPS = 10 -LATENCY = 0.0 -RELATIVE = True -ENDSCAN = True - -adjust_sensors() -set_adc_averaging() -set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) - -try: - lscan(MOTOR, SENSORS, RANGE[0], RANGE[1], STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout) -finally: - if ENDSCAN: - after_scan() - \ No newline at end of file