Script execution
This commit is contained in:
@@ -41,7 +41,8 @@ class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray):
|
||||
if self.scan_index != get_exec_pars().index:
|
||||
self.scan_index = get_exec_pars().index
|
||||
self.create_datasets()
|
||||
print "scan {0}".format(self.scan_index)
|
||||
if self.region_index == 0:
|
||||
print "scan {0}".format(self.scan_index)
|
||||
|
||||
ephot = Eph.read()
|
||||
try:
|
||||
@@ -99,18 +100,24 @@ class ImageReader(ReadonlyRegisterBase, ReadonlyRegisterMatrix):
|
||||
# plotting current spectrum
|
||||
names = "Scienta spectrum"
|
||||
plots = plot(None, names)
|
||||
global online_spectrum_plot
|
||||
global spectrum_series
|
||||
spectrum_series = plots[0].getSeries(0)
|
||||
task = None
|
||||
|
||||
def plot_cur_spectrum():
|
||||
global spectrum_series
|
||||
try:
|
||||
while get_context().state.running:
|
||||
y = Scienta.spectrum.take(100)
|
||||
x = Scienta.spectrumX
|
||||
spectrum_series.setData(x, y)
|
||||
time.sleep(1.0)
|
||||
while get_context().state.running:
|
||||
if spectrum_series is None:
|
||||
print "create new plot"
|
||||
names = "Scienta spectrum"
|
||||
plots = plot(None, names)
|
||||
spectrum_series = plots[0].getSeries(0)
|
||||
|
||||
y = Scienta.spectrum.take(100)
|
||||
x = Scienta.spectrumX
|
||||
spectrum_series.setData(x, y)
|
||||
time.sleep(1.0)
|
||||
finally:
|
||||
print "Stopping spectrum plotting"
|
||||
|
||||
@@ -144,7 +151,7 @@ def do_scan(motors, positions, regions, latency):
|
||||
|
||||
try:
|
||||
#set_preference(Preference.PLOT_TYPES, {'ScientaSpectrum1':1})
|
||||
#task = fork(plot_cur_spectrum)
|
||||
task = fork(plot_cur_spectrum)
|
||||
do_scan(MOTORS, POSITIONS, REGIONS, LATENCY)
|
||||
finally:
|
||||
if CLOSE_SHUTTER_AT_END:
|
||||
|
||||
Reference in New Issue
Block a user