Startup
This commit is contained in:
39
script/develop/ManipulatorFlyScan.py
Normal file
39
script/develop/ManipulatorFlyScan.py
Normal 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"
|
||||
36
script/develop/ManipulatorSampleScan.py
Normal file
36
script/develop/ManipulatorSampleScan.py
Normal 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()
|
||||
|
||||
29
script/develop/ManipulatorScanKei.py
Normal file
29
script/develop/ManipulatorScanKei.py
Normal 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()
|
||||
|
||||
48
script/develop/ManipulatorYZScanAtAngle.py
Normal file
48
script/develop/ManipulatorYZScanAtAngle.py
Normal 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()
|
||||
|
||||
33
script/develop/MonoThetaBetaScan.py
Normal file
33
script/develop/MonoThetaBetaScan.py
Normal 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
54
script/develop/XASFly.py
Normal 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()
|
||||
Reference in New Issue
Block a user