Closedown

This commit is contained in:
gac-x03da
2020-03-10 11:08:38 +01:00
parent 91c668d9a1
commit 914b98544f
5 changed files with 68 additions and 30 deletions
+21 -1
View File
@@ -7,6 +7,7 @@ RANGE (tuple (min, max))
STEPS (int or tuple)
LATENCY (double)
RELATIVE (BOOLEAN)
FLY_SCAN (BOOLEAN)
"""
#set_preference(Preference.PLOT_TYPES,{'ImageIntegrator':1})
@@ -15,7 +16,26 @@ 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)
if FLY_SCAN:
# time per scienta acquisition in seconds
time1 = time.time()
trig_scienta()
time2 = time.time()
scienta_time = (time2 - time1)
print "scienta time: ", scienta_time
if isinstance(STEPS,int):
raise Exception ("Fly Scan must define step size, and not number of steps")
STEP = STEPS
SPEED = STEP / scienta_time
fly_time = (RANGE[1] - RANGE[0]) / SPEED
STEPS = int(fly_time / scienta_time) + 1
print "speed: ", SPEED
print "scan time: ", fly_time
cscan(MOTOR, SENSORS, RANGE[0], RANGE[1], STEPS, LATENCY, fly_time, RELATIVE, before_read=before_readout, after_read = after_readout, check_positions = False)
else:
lscan(MOTOR, SENSORS, RANGE[0], RANGE[1], STEPS, LATENCY, RELATIVE, before_read=before_readout, after_read = after_readout)
finally:
if ENDSCAN:
after_scan()
+8 -5
View File
@@ -54,11 +54,14 @@ def get_binding_energy(e):
ephot = Scienta.highEnergy.take(100)
return ephot - e - workfunc
def get_binding_range():
return get_binding_energy(Scienta.highEnergy.take(100)), get_binding_energy(Scienta.lowEnergy.take(100))
def get_binding_range(p=None):
if p is None:
return get_binding_energy(Scienta.highEnergy.take(100)), get_binding_energy(Scienta.lowEnergy.take(100))
else:
ke_range=p.getAxis(p.AxisId.X).getDisplayRange()
return get_binding_energy(ke_range.max), get_binding_energy(ke_range.min)
eb2, eb1 = get_binding_range()
eb2, eb1 = get_binding_range(p)
be_axis.setRange(eb2, eb1)
@@ -69,7 +72,7 @@ def plot_cur_spectrum():
x = Scienta.spectrumX
spectrum_series.setData(x, y)
eb2, eb1 = get_binding_range()
eb2, eb1 = get_binding_range(plots[0])
if (be_axis.min != eb2) or (be_axis.max != eb1):
plots[0].resetZoom()
be_axis.setRange(eb2, eb1)