59 lines
1.7 KiB
Python
59 lines
1.7 KiB
Python
"""
|
|
Continuous 2D Manipulator scan (experimental)
|
|
|
|
set manipulator scan parameters below.
|
|
set analyser parameters separately!
|
|
"""
|
|
|
|
import math
|
|
|
|
MOTORS = (ManipulatorY)
|
|
#SENSORS = (Counts, Scienta.spectrum, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution)
|
|
SENSORS = (Counts, Scienta.dataMatrix, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution)
|
|
RANGE_Y = (-5., +5)
|
|
RANGE_Z = (114., 116.)
|
|
STEPS_Y = 20
|
|
# actual number of positions will be +1!
|
|
STEPS_Z = 2
|
|
RELATIVE = False
|
|
LATENCY = 0.0
|
|
ENDSCAN = False
|
|
ZIGZAG = False
|
|
|
|
#set_preference(Preference.ENABLED_PLOTS, [ManipulatorPhi, ManipulatorTheta, Scienta.dataMatrix, ImageIntegrator])
|
|
#set_preference(Preference.PLOT_TYPES,{'ImageIntegrator':1})
|
|
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)
|
|
print "scienta_time: ", scienta_time
|
|
|
|
# time for one Y scan in seconds
|
|
fly_time = scienta_time * STEPS_Y
|
|
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)]
|
|
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()
|
|
|