Script execution

This commit is contained in:
x03daop
2017-04-12 12:17:39 +02:00
parent 8476041dcf
commit aa5cf65f85

View File

@@ -7,8 +7,8 @@ MOTORS = [Eph]
POSITIONS = [400.0, 401.0]
LATENCY = 0.0
REGION1 = {'elo': 243.0, 'ehi': 245.0, 'estep': 0.1, 'epass': 50, 'tstep': 0.1, 'iter': 1, 'cis': True}
REGION2 = {'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': 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}
REGIONS = [REGION1, REGION2]
CLOSE_SHUTTER_AT_END = True
@@ -73,6 +73,8 @@ class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray):
append_dataset(self.iterations_dataset_name, self.region['iter'])
def read(self):
global current_region_index
current_region_index = self.region_index
self.setup()
print "Photon energy {ephot} eV. Acquiring spectrum {elo}-{ehi} eV.".format(ephot=Eph.read(), elo=Scienta.lowEnergy.value, ehi=Scienta.highEnergy.value)
trig_scienta()
@@ -98,26 +100,28 @@ class ImageReader(ReadonlyRegisterBase, ReadonlyRegisterMatrix):
return ny
# plotting current spectrum
names = "Scienta spectrum"
plots = plot(None, names, title="Live 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 plot_cur_spectrum():
global spectrum_series
global live_plots
global current_region_index
try:
#time.sleep(5.0)
while get_context().state.running:
# if spectrum_series is None:
# print "create new plot"
# names = "Scienta spectrum"
# plots = plot(None, names, title="Online")
# spectrum_series = plots[0].getSeries(0)
y = Scienta.spectrum.take(100)
x = Scienta.spectrumX
spectrum_series.setData(x, y)
#spectrum_series.setData(x, y)
try:
live_plots[current_region_index].setData(x, y)
except IndexError:
pass
time.sleep(1.0)
finally:
print "Stopping spectrum plotting"