Script execution
This commit is contained in:
@@ -18,12 +18,10 @@ Scienta.setAcquisitionMode(ch.psi.pshell.epics.Scienta.AcquisitionMode.Swept)
|
||||
class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray):
|
||||
def initialize(self):
|
||||
#super(SpectrumReader, self).initialize()
|
||||
self.first_run_init = False
|
||||
self.scan_index = -1
|
||||
|
||||
def create_datasets(self):
|
||||
print self.scan_index
|
||||
path = get_exec_pars().scanPath
|
||||
index = get_exec_pars().index
|
||||
|
||||
self.channel_begin_dataset_name = path + "ScientaChannelBegin{0}".format(self.region_index + 1)
|
||||
self.channel_end_dataset_name = path + "ScientaChannelEnd{0}".format(self.region_index + 1)
|
||||
@@ -40,10 +38,10 @@ class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray):
|
||||
create_dataset(self.iterations_dataset_name, 'd')
|
||||
|
||||
def setup(self):
|
||||
if not self.first_run_init:
|
||||
print "first run"
|
||||
if self.scan_index != get_exec_pars().index:
|
||||
self.scan_index = get_exec_pars().index
|
||||
self.create_datasets()
|
||||
self.first_run_init = True
|
||||
print "scan {0}".format(self.scan_index)
|
||||
|
||||
ephot = Eph.read()
|
||||
try:
|
||||
@@ -52,7 +50,6 @@ class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray):
|
||||
else:
|
||||
edelta = 0.0
|
||||
except AttributeError:
|
||||
print "reset start energy"
|
||||
self.ephot_start = ephot
|
||||
edelta = 0.0
|
||||
|
||||
@@ -117,19 +114,13 @@ def plot_cur_spectrum():
|
||||
finally:
|
||||
print "Stopping spectrum plotting"
|
||||
|
||||
global scan_index
|
||||
scan_index = -1
|
||||
|
||||
def do_scan(motors, positions, regions, latency):
|
||||
global scan_index
|
||||
global SENSORS
|
||||
|
||||
scan_index += 1
|
||||
SENSORS = []
|
||||
|
||||
for (index, region) in enumerate(regions):
|
||||
reader = SpectrumReader()
|
||||
reader.scan_index = scan_index
|
||||
reader.region_index = index
|
||||
reader.region = region
|
||||
reader.initialize()
|
||||
|
||||
Reference in New Issue
Block a user