This commit is contained in:
gac-x03da
2018-04-24 16:49:00 +02:00
parent 95f8194430
commit 62a5dc9ee5
25 changed files with 1389 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
"""
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()

View File

@@ -0,0 +1,38 @@
"""
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()

View File

@@ -0,0 +1,36 @@
"""
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()

View File

@@ -0,0 +1,34 @@
"""
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()

View File

@@ -0,0 +1,62 @@
"""
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)

View File

@@ -0,0 +1,68 @@
"""
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)

View File

@@ -0,0 +1,33 @@
"""
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()

96
script/attic/PhdScan.py Normal file
View File

@@ -0,0 +1,96 @@
"""
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()

View File

@@ -0,0 +1,28 @@
"""
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()

19
script/attic/XYScan.py Normal file
View File

@@ -0,0 +1,19 @@
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()

View File

@@ -0,0 +1,39 @@
"""
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"

View File

@@ -0,0 +1,36 @@
"""
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()

View File

@@ -0,0 +1,29 @@
"""
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()

View File

@@ -0,0 +1,48 @@
"""
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()

View File

@@ -0,0 +1,33 @@
"""
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()

54
script/develop/XASFly.py Normal file
View File

@@ -0,0 +1,54 @@
"""
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()

426
script/local.py~ Normal file
View File

@@ -0,0 +1,426 @@
import random
import ch.psi.pshell.device.Readable.ReadableArray as ReadableArray
import ch.psi.pshell.device.Readable.ReadableCalibratedArray as ReadableCalibratedArray
import ch.psi.pshell.device.ArrayCalibration as ArrayCalibration
import ch.psi.utils.Str
from mathutils import estimate_peak_indexes, fit_gaussians, create_fit_point_list, Gaussian
import java.awt.Color as Color
#Synchrronized Scienta counts
for stat in Scienta.stats:
add_device(stat, True)
beam_ok = True
class SimulatedOutput(Writable):
def write(self, value):
pass
class SimulatedInput(Readable):
def __init__(self):
self.x = 0.0
def read(self):
self.x = self.x + 0.2
noise = (random.random() - 0.5) / 20.0
return math.sin(self.x) + noise
sout = SimulatedOutput()
sinp = SimulatedInput()
def integrate_image(vertical = True):
data = Scienta.dataArray.read()
#Integrate and plot
(width,height) = Scienta.getImageSize().tolist()
integration = []
if vertical:
for i in range(width):
p=0.0
for j in range(height):
p=p+data[j*width+i]
integration.append(p)
else:
for j in range(height):
p=0.0
for i in range(width):
p=p+data[j*width+i]
integration.append(p)
return integration
class ImageEnergyDistribution(ReadableCalibratedArray):
def getSize(self):
(width,height) = Scienta.getImageSize().tolist()
return width
def read(self):
return to_array(integrate_image(),'d')
def getCalibration(self):
c=Scienta.readImageDescriptor().calibration
return ArrayCalibration(c.scaleX, c.offsetX)
EnergyDistribution = ImageEnergyDistribution()
class ImageAngleDistribution(ReadableCalibratedArray):
def getSize(self):
(width,height) = Scienta.getImageSize().tolist()
return height
def read(self):
return to_array(integrate_image(False),'d')
def getCalibration(self):
c=Scienta.readImageDescriptor().calibration
return ArrayCalibration(c.scaleY, c.offsetY)
AngleDistribution = ImageAngleDistribution()
def trig_scienta():
if Scienta.isSimulated():
time.sleep(0.1)
else:
image_id = Scienta.currentImageCount
Scienta.start()
Scienta.waitReady(-1)
Scienta.waitNewImage(3000, image_id)
from keithley import KeiSample, KeiReference
def prepare_keithleys(dwell, triggered):
"""
prepare keithleys for gpib polling:
passive, bus triggered, dwell time
dwell = dwell time in seconds (0.1 - 20.0)
"""
#KeiSample.prepare(dwell, triggered)
#KeiReference.prepare(dwell, triggered)
def trig_keithleys():
"""
trigger keithleys, do not wait.
after this, you have to wait for at least the dwell time before reading the value!
"""
#KeiSample.trig()
#KeiReference.trig()
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)
def fetch_keithleys():
"""
read the keithley readings into EPICS.
this requires that at least the dwell time has passed since the last trigger.
the value can then be read from the SampleCurrent and ReferenceCurrent devices.
"""
#KeiSample.fetch()
#KeiReference.fetch()
def release_keithleys():
"""
switch keithleys to free run.
0.1 s polling and dwell time
"""
#KeiSample.release()
#KeiReference.release()
diag_channels = []
diag_channels.append(Scienta.channelBegin) #diag_channels.append(ChannelDouble("ChannelBegin", "X03DA-SCIENTA:cam1:CHANNEL_BEGIN_RBV"))
diag_channels.append(Scienta.channelEnd) #diag_channels.append(ChannelDouble("ChannelEnd", "X03DA-SCIENTA:cam1:CHANNEL_END_RBV"))
diag_channels.append(Scienta.sliceBegin) # diag_channels.append(ChannelDouble("SliceBegin", "X03DA-SCIENTA:cam1:SLICE_BEGIN_RBV"))
diag_channels.append(Scienta.sliceEnd) #diag_channels.append(ChannelDouble("StepTime", "X03DA-SCIENTA:cam1:SLICE_END_RBV"))
diag_channels.append(Scienta.numSlices) # diag_channels.append(ChannelDouble("NumSlices", "X03DA-SCIENTA:cam1:SLICES_RBV"))
#diag_channels.append(Scienta.frames) # diag_channels.append(ChannelDouble("NumFrames", "X03DA-SCIENTA:cam1:FRAMES"))
diag_channels.append(Scienta.numChannels) #diag_channels.append(ChannelDouble("NumChannels", "X03DA-SCIENTA:cam1:NUM_CHANNELS_RBV"))
diag_channels.append(Scienta.lowEnergy) #diag_channels.append(ChannelDouble("LowEnergy", "X03DA-SCIENTA:cam1:LOW_ENERGY_RBV"))
diag_channels.append(Scienta.centerEnergy) #diag_channels.append(ChannelDouble("CenterEnergy", "X03DA-SCIENTA:cam1:CENTRE_ENERGY_RBV"))
diag_channels.append(Scienta.highEnergy) #diag_channels.append(ChannelDouble("HighEnergy", "X03DA-SCIENTA:cam1:HIGH_ENERGY_RBV"))
#TODO: These are not of Scienta device interface. Should be included?
#diag_channels.append(ChannelDouble("AcquisitionModeNum", "X03DA-SCIENTA:cam1:ACQ_MODE_RBV"))
#diag_channels.append(ChannelDouble("EnergyModeNum", "X03DA-SCIENTA:cam1:ENERGY_MODE_RBV"))
#diag_channels.append(ChannelDouble("LensModeNum", "X03DA-SCIENTA:cam1:LENS_MODE_RBV"))
#diag_channels.append(ChannelDouble("DetectorModeNum", "X03DA-SCIENTA:cam1:DETECTOR_MODE_RBV"))
#diag_channels.append(ChannelDouble("PassEnergyNum", "X03DA-SCIENTA:cam1:PASS_ENERGY_RBV"))
#diag_channels.append(ChannelDouble("ElementSetNum", "X03DA-SCIENTA:cam1:ELEMENT_SET_RBV"))
diag_channels.append(ScientaDwellTime)
diag_channels.append(AcquisitionMode) #diag_attrs.append(ChannelString("AcquisitionMode", "X03DA-SCIENTA:cam1:ACQ_MODE_RBV"))
diag_channels.append(EnergyMode) #diag_attrs.append(ChannelString("EnergyMode", "X03DA-SCIENTA:cam1:ENERGY_MODE_RBV"))
diag_channels.append(LensMode) #diag_attrs.append(ChannelString("LensMode", "X03DA-SCIENTA:cam1:LENS_MODE_RBV"))
diag_channels.append(DetectorMode) #diag_attrs.append(ChannelString("DetectorMode", "X03DA-SCIENTA:cam1:DETECTOR_MODE_RBV"))
diag_channels.append(PassEnergy) #diag_attrs.append(ChannelString("PassEnergy", "X03DA-SCIENTA:cam1:PASS_ENERGY_RBV"))
diag_channels.append(ElementSet) #diag_attrs.append(ChannelString("ElementSet", "X03DA-SCIENTA:cam1:ELEMENT_SET_RBV"))
diag_channels.append(ExcitationEnergy) #diag_channels.append(ChannelDouble("ExcitationEnergy", "X03DA-SCIENTA:cam1:EXCITATION_ENERGY_RBV"))
diag_channels.append(StepSize) #diag_channels.append(ChannelDouble("StepSize", "X03DA-SCIENTA:cam1:STEP_SIZE_RBV"))
diag_channels.append(NumIterations) #diag_channels.append(ChannelDouble("NumIterations", "X03DA-SCIENTA:cam1:NumExposures_RBV"))
diag_channels.append(AnalyserSlit) #diag_attrs.append(ChannelString("ElemeAnalyserSlitntSet", "X03DA-SCIENTA:cam1:ANALYSER_SLIT_RBV"))
#Manipulator Settings
diag_channels.append(ManipulatorX.readback)
diag_channels.append(ManipulatorY.readback)
diag_channels.append(ManipulatorZ.readback)
diag_channels.append(ManipulatorTheta.readback)
diag_channels.append(ManipulatorTilt.readback)
diag_channels.append(ManipulatorPhi.readback)
# Beamline Settings
diag_channels.append(MachineBumpXOffset)
diag_channels.append(MachineBumpXAngle)
diag_channels.append(MachineBumpYOffset)
diag_channels.append(MachineBumpYAngle)
diag_channels.append(DynamicBumpYOffset)
diag_channels.append(DynamicBumpYAngle)
diag_channels.append(FrontendVCenter)
diag_channels.append(FrontendVSize)
diag_channels.append(FrontendHCenter)
diag_channels.append(FrontendHSize)
diag_channels.append(MonoVCenter)
diag_channels.append(MonoVSize)
diag_channels.append(MonoBladeDown)
diag_channels.append(MonoBladeUp)
diag_channels.append(MonoHCenter)
diag_channels.append(MonoHSize)
diag_channels.append(MonoApertureMode)
diag_channels.append(RefocusVCenter)
diag_channels.append(RefocusVSize)
diag_channels.append(RefocusHCenter)
diag_channels.append(RefocusHSize)
diag_channels.append(FocusYTrans)
diag_channels.append(FocusZTrans)
diag_channels.append(FocusXRot)
diag_channels.append(FocusYRot)
diag_channels.append(FocusZRot)
diag_channels.append(RefocusYTrans)
diag_channels.append(RefocusZTrans)
diag_channels.append(RefocusXRot)
diag_channels.append(RefocusYRot)
diag_channels.append(RefocusZRot)
diag_channels.append(MonoEnergy)
diag_channels.append(MonoCff)
diag_channels.append(MonoBeta)
diag_channels.append(MonoTheta)
diag_channels.append(ExitSlit)
# Auxiliary Measurements
diag_channels.append(MachineCurrent)
diag_channels.append(FocusWaterTemp)
diag_channels.append(SampleCurrent)
diag_channels.append(RefCurrent)
#diag_channels.append(AuxCurrent)
#diag_channels.append(AuxVoltage)
diag_channels.append(SampleCurrentGain)
diag_channels.append(RefCurrentGain)
#diag_channels.append(AuxCurrentGain)
#diag_channels.append(SampleCurrentAveraging)
#diag_channels.append(RefCurrentAveraging)
#diag_channels.append(AuxCurrentAveraging)
#diag_channels.append(AuxVoltageAveraging)
#diag_channels.append(SampleCurrentSampling)
#diag_channels.append(RefCurrentSampling)
#diag_channels.append(AuxCurrentSampling)
#diag_channels.append(AuxVoltageSampling)
diag_channels.append(ChamberPressure)
diag_channels.append(BeamlinePressure)
diag_channels.append(ManipulatorTempA)
diag_channels.append(ManipulatorTempB)
diag_channels.append(ManipulatorCoolFlow)
diag_channels.append(ManipulatorCoolFlowSet)
diag_channels.append(MonoGrating)
diag_channels = sorted(diag_channels, key=lambda channel: channel.name)
def get_diag_name(diag):
return ch.psi.utils.Str.toTitleCase(diag.getName()).replace(" ", "").replace("Readback", "")
def print_diag():
for f in diag_channels:
print "%-25s %s" % (get_diag_name(f) , str(f.read()))
def create_diag_datasets(parent = None):
if parent is None:
parent = get_exec_pars().group
group = parent + "attrs/"
for f in diag_channels:
create_dataset(group+get_diag_name(f) , 's' if (type(f) is ch.psi.pshell.epics.ChannelString) else 'd')
def append_diag_datasets(parent = None):
if parent is None:
parent = get_exec_pars().group
group = parent + "attrs/"
for f in diag_channels:
try:
x = f.read()
if x is None:
x = '' if (type(f) is ch.psi.pshell.epics.ChannelString) else float('nan')
append_dataset(group+get_diag_name(f), x)
except:
log("Error sampling " + str(get_diag_name(f)) + ": " + str(sys.exc_info()[1]))
def wait_beam():
if not beam_ok:
print "Waiting for beam..."
while not beam_ok:
time.sleep(0.1)
print "Beam ok"
def before_readout():
sample_scienta = False
for dev in ["Scienta.spectrum","EnergyDistribution", "AngleDistribution", "Scienta.dataMatrix"]:
if dev in SENSORS:
sample_scienta = True
break
for dev in [Scienta.spectrum,EnergyDistribution, AngleDistribution, Scienta.dataMatrix]:
if dev in SENSORS:
sample_scienta = True
break
wait_beam()
trig_keithleys()
if sample_scienta:
trig_scienta()
else:
wait_keithleys()
fetch_keithleys()
def after_readout(rec):
if get_exec_pars().persist:
if rec.index == 0:
create_diag_datasets()
append_diag_datasets()
def after_scan():
"""
Close shutter and turn off analyser
"""
caput("X03DA-PC:AFTER-SCAN.PROC", 1)
release_keithleys()
def set_adc_averaging():
dwell = Scienta.getStepTime().read()
dwell = min(dwell, 20.0)
dwell = max(dwell, 0.1)
fixed = AcquisitionMode.read() == "Fixed"
prepare_keithleys(dwell, fixed)
#value = Scienta.getStepTime().read() * 10.0 #averaging count in 100ms
#SampleCurrentAveraging.write(value)
#RefCurrentAveraging.write(value)
#AuxCurrentAveraging.write(value)
#AuxVoltageAveraging.write(value)
def adjust_sensors():
#Updating ranges from Scienta
Scienta.update()
global SENSORS
if SENSORS is not None:
# Move integration to end
for dev in ["Scienta.spectrum","EnergyDistribution", "AngleDistribution", "Scienta.dataMatrix"]:
if dev in SENSORS:
SENSORS=SENSORS+[SENSORS.pop(SENSORS.index(dev))]
for dev in ["Counts"]:
if dev in SENSORS:
SENSORS=[SENSORS.pop(SENSORS.index(dev))] + SENSORS
if "Scienta.dataMatrix" in SENSORS or Scienta.dataMatrix in SENSORS:
print "Not ACC"
set_exec_pars(accumulate = False)
#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.lowEnergy, get_diag_name(Scienta.lowEnergy))
set_device_alias(Scienta.highEnergy, get_diag_name(Scienta.highEnergy))
#Additional device configuration
ManipulatorPhi.trustedWrite = False
def fit(ydata, xdata = None):
"""
"""
if xdata is None:
xdata = frange(0, len(ydata), 1)
max_y= max(ydata)
index_max = ydata.index(max_y)
max_x= xdata[index_max]
print "Max index:" + str(index_max),
print " x:" + str(max_x),
print " y:" + str(max_y)
gaussians = fit_gaussians(ydata, xdata, [index_max,])
(norm, mean, sigma) = gaussians[0]
p = plot([ydata],["data"],[xdata], title="Fit" )[0]
fitted_gaussian_function = Gaussian(norm, mean, sigma)
scale_x = [float(min(xdata)), float(max(xdata)) ]
points = max((len(xdata)+1), 100)
resolution = (scale_x[1]-scale_x[0]) / points
fit_y = []
fit_x = frange(scale_x[0],scale_x[1],resolution, True)
for x in fit_x:
fit_y.append(fitted_gaussian_function.value(x))
p.addSeries(LinePlotSeries("fit"))
p.getSeries(1).setData(fit_x, fit_y)
if abs(mean - xdata[index_max]) < ((scale_x[0] + scale_x[1])/2):
print "Mean -> " + str(mean)
p.addMarker(mean, None, "Mean="+str(round(norm,2)), Color.MAGENTA.darker())
return (norm, mean, sigma)
else:
p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.GRAY)
print "Invalid gaussian fit: " + str(mean)
return (None, None, None)
def elog(title, message, attachments = [], author = None, category = "Info", domain = "", logbook = "Experiments", encoding=1):
"""
Add entry to ELOG.
"""
if author is None:
author = "pshell" #get_context().getUser().name
typ = "pshell"
entry = ""
cmd = 'G_CS_ELOG_add -l "' + logbook+ '" '
cmd = cmd + '-a "Author=' + author + '" '
cmd = cmd + '-a "Type=' + typ + '" '
cmd = cmd + '-a "Entry=' + entry + '" '
cmd = cmd + '-a "Title=' + title + '" '
cmd = cmd + '-a "Category=' + category + '" '
cmd = cmd + '-a "Domain=' + domain + '" '
for attachment in attachments:
cmd = cmd + '-f "' + attachment + '" '
cmd = cmd + '-n ' + str(encoding)
cmd = cmd + ' "' + message + '"'
#print cmd
#os.system (cmd)
#print os.popen(cmd).read()
import subprocess
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
if (err is not None) and err!="":
raise Exception(err)
print out
def get_plot_snapshots(title = None, file_type = "jpg", temp_path = get_context().setup.getContextPath()):
"""
Returns list with file names of plots snapshots from a plotting context.
"""
sleep(0.02) #Give some time to plot to be finished - it is not sync with acquisition
ret = []
for p in get_plots(title):
file_name = os.path.abspath(temp_path + "/" + p.getTitle() + "." + file_type)
p.saveSnapshot(file_name , file_type)
ret.append(file_name)
return ret

View File

@@ -0,0 +1,23 @@
"""
exit slit test scan
set ADC or Keithly averaging separately.
recommended dwell time: 1 s.
"""
POSITIONERS = (ExitSlit)
SENSORS = (SampleCurrent, RefCurrent, AuxCurrent, MachineCurrent)
STARTPOS = (-10.0)
ENDPOS = (200.0)
STEPS = 10.0
LATENCY = 0.1
DWELL = 1.0
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=before_readout, after_read=after_readout)

View File

@@ -0,0 +1,28 @@
"""
exit slit calibration scan
manual settings: photon energy 800 eV (G1200), FE = 1 x 1
"""
POSITIONERS = (ExitSlitY)
SENSORS = (SampleCurrent, RefCurrent, AuxCurrent, MachineCurrent)
STARTPOS = (-0.5)
ENDPOS = (1.0)
STEPS = 0.01
LATENCY = 0.1
DWELL = 1.0
value = DWELL * 10.0
SampleCurrentAveraging.write(value)
RefCurrentAveraging.write(value)
AuxCurrentAveraging.write(value)
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)

View File

@@ -0,0 +1,45 @@
"""
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
"""
import math
# adjust the following parameters
STARTPOS = (-5.0)
ENDPOS = (+5.0)
STEPS = 0.01
LATENCY = 1.0
DWELL = 1.0
ENDSCAN = False
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)
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)
finally:
if ENDSCAN:
after_scan()

View File

@@ -0,0 +1,34 @@
"""
Focusing 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.08
STEPS = 40
LATENCY = 0.5
ENDSCAN = False
MOTORS = [FocusYRot]
SENSORS = [Counts, SampleCurrent, RefCurrent, MachineCurrent, OpticsCameraCentroidX, OpticsCameraSigmaX]
STARTPOS = (-DISTANCE / 2.0)
ENDPOS = (DISTANCE / 2.0)
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)
finally:
if ENDSCAN:
after_scan()

View File

@@ -0,0 +1,41 @@
"""
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()
try:
lscan(MOTOR, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout)
finally:
if ENDSCAN:
after_scan()

View File

@@ -0,0 +1,33 @@
"""
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()
try:
lscan(MOTOR, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout)
finally:
if ENDSCAN:
after_scan()

View File

@@ -0,0 +1,31 @@
"""
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()
try:
lscan(MOTOR, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout)
finally:
if ENDSCAN:
after_scan()

View File

@@ -0,0 +1,29 @@
"""
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()
try:
lscan(MOTORS, SENSORS, STARTPOS, ENDPOS, STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout)
finally:
if ENDSCAN:
after_scan()