Files
x09lb/script/templates/Scan2D.py
gac-x09lb f1a32a6b92
2022-11-11 13:27:32 +01:00

67 lines
1.8 KiB
Python

"""
Arguments:
DRY_RUN = True
RANGE_X (tuple (min, max))
RANGE_Y (tuple (min, max))
STEPS (tuple (x, y))
EXPOSURES (list or None)
SETTLING_TIME (double)
ZIGZAG (BOOLEAN)
COMPRESSION (BOOLEAN)
"""
#Debugging
if (get_exec_pars().args is None) and (get_exec_pars().script=="Scan2D"):
DRY_RUN = True
RANGE_X = [-10.0,10.0]
RANGE_Y = [-10.0,10.0]
EXPOSURES = None # [0.1, 0.5, 1.0]
STEPS = [5, 5] #Integers = number of steps, Float = stepoSize
SETTLING_TIME = 0.1
ZIGZAG = True
COMPRESSION = False
#Constants
SENSORS = [current, ccd.dataMatrix]
POSITIONERS = [dummy_x, dummy_y] if DRY_RUN else [sample_x, sample_y]
RELATIVE = True
ENABLED_PLOTS = [current, ccd.dataMatrix]
CUSTOM_PLOT_TYPES = {ccd.dataMatrix:"ch.psi.pshell.plot.MatrixPlotRenderer"}
start = [RANGE_X[0], RANGE_Y[0]]
end = [RANGE_X[1], RANGE_Y[1]]
step_size = STEPS
if EXPOSURES:
class exposure_index (Writable, Readable):
def __init__(self):
self.pos=0.0
def read(self):
return self.pos
def write(self, value):
ccd.setExposure(EXPOSURES[int(value)])
self.pos = value
class exposure (Readable):
def read(self):
return ccd.exposure
POSITIONERS = POSITIONERS + [exposure_index()]
SENSORS = SENSORS + [exposure()]
start = start + [0.0]
end = end + [float(len(EXPOSURES)-1)]
step_size = STEPS + [1.0]
try:
r = ascan(POSITIONERS, SENSORS , start, end, step_size, \
SETTLING_TIME, RELATIVE, zigzag = ZIGZAG, \
before_read=before_readout, after_read = after_readout, \
compression = COMPRESSION, enabled_plots=ENABLED_PLOTS, \
keep=False, check_positions=False, plot_types=CUSTOM_PLOT_TYPES)
set_return(r)
finally:
after_scan()