Files
x03da/script/ManipulatorYZFlyScan.py
gac-x03da e8ab66fd14 Startup
2019-08-05 14:46:59 +02:00

60 lines
1.6 KiB
Python

"""
Continuous 2D Manipulator scan
set manipulator scan parameters below.
set analyser parameters separately!
"""
import math
RANGE_Z = (114., 116.)
# actual number of positions will be +1!
STEPS_Z = 2
RANGE_Y = (-5., +5)
# minimum speed 0.01, maximum speed 0.125 mm/s
SPEED_Y = 0.1
RELATIVE = False
LATENCY = 0.0
ZIGZAG = False
ENDSCAN = False
MOTORS = (ManipulatorY)
#SENSORS = (Counts, Scienta.spectrum, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution)
SENSORS = (Counts, Scienta.dataMatrix, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution)
adjust_sensors()
set_adc_averaging()
# time per scienta acquisition in seconds
time1 = time.time()
trig_scienta()
time2 = time.time()
scienta_time = (time2 - time1)
print "scienta time: ", scienta_time
# time for one Y scan in seconds
fly_time = (RANGE_Y[1] - RANGE_Y[0]) / SPEED_Y
STEPS_Y = int(fly_time / scienta_time) + 1
print "Y time: ", fly_time
STEP_Z = (RANGE_Z[1] - RANGE_Z[0]) / STEPS_Z
positions_z = [RANGE_Z[0] + STEP_Z * i for i in range(STEPS_Z + 1)]
print "Z positions: ", positions_z
def before_pass(index, scan):
global positions_z
print "Starting pass: ", index
z = positions_z[index-1]
ManipulatorZ.write(z)
print "z = ", z
ManipulatorZ.waitValueInRange(z, 1.0, 100)
try:
cscan(MOTORS, SENSORS, RANGE_Y[0], RANGE_Y[1], STEPS_Y, time=fly_time, passes=len(positions_z), zigzag=ZIGZAG, before_read=before_readout, after_read = after_readout, before_pass = before_pass, check_positions = False)
finally:
if ENDSCAN:
after_scan()