Script execution

This commit is contained in:
x03daop
2017-04-12 12:26:07 +02:00
parent 80bf529658
commit d20048dd6b

View File

@@ -7,8 +7,8 @@ MOTORS = [Eph]
POSITIONS = [400.0, 401.0]
LATENCY = 0.0
REGION1 = {'name': 'Peak 1', 'elo': 243.0, 'ehi': 245.0, 'estep': 0.1, 'epass': 50, 'tstep': 0.1, 'iter': 1, 'cis': True}
REGION2 = {'name': 'Peak 2', 'elo': 214.0, 'ehi': 217.0, 'estep': 0.1, 'epass': 50, 'tstep': 0.1, 'iter': 1, 'cis': False}
REGION1 = {'name': 'Peak 1', 'elo': 243.0, 'ehi': 253.0, 'estep': 0.1, 'epass': 50, 'tstep': 0.1, 'iter': 1, 'cis': True}
REGION2 = {'name': 'Peak 2', 'elo': 214.0, 'ehi': 219.0, 'estep': 0.1, 'epass': 50, 'tstep': 0.1, 'iter': 2, 'cis': False}
REGIONS = [REGION1, REGION2]
CLOSE_SHUTTER_AT_END = True
@@ -99,25 +99,20 @@ class ImageReader(ReadonlyRegisterBase, ReadonlyRegisterMatrix):
ny = Scienta.slices.read()
return ny
# plotting current spectrum
names = [region['name'] for region in REGIONS]
global live_plots
live_plots = plot(None, names, title="Live Spectrum")
global spectrum_series
global current_region_index
current_region_index = 0
spectrum_series = plots[0].getSeries(0)
task = None
def setup_live_plots(regions)
global live_plots
global current_region_index
names = [region['name'] for region in regions]
live_plots = plot(None, names, title="Live Spectra")
current_region_index = 0
def plot_cur_spectrum():
global spectrum_series
def update_live_plots():
global live_plots
global current_region_index
try:
while get_context().state.running:
y = Scienta.spectrum.take(100)
x = Scienta.spectrumX
#spectrum_series.setData(x, y)
try:
series = live_plots[current_region_index].getSeries(0)
series.setData(x, y)
@@ -125,7 +120,7 @@ def plot_cur_spectrum():
pass
time.sleep(1.0)
finally:
print "Stopping spectrum plotting"
print "Stopping live plots"
def do_scan(motors, positions, regions, latency):
global SENSORS
@@ -156,8 +151,8 @@ def do_scan(motors, positions, regions, latency):
try:
#set_preference(Preference.PLOT_TYPES, {'ScientaSpectrum1':1})
task = fork(plot_cur_spectrum)
setup_live_plots(REGIONS)
task = fork(update_live_plots)
do_scan(MOTORS, POSITIONS, REGIONS, LATENCY)
finally:
if CLOSE_SHUTTER_AT_END: