Script execution
This commit is contained in:
@@ -4,23 +4,38 @@ Arguments:
|
||||
"""
|
||||
|
||||
#MOTORS = [Eph]
|
||||
#VECTOR = [295.0, 296.0]
|
||||
EPHOT0 = 296.0
|
||||
#POSITIONS = [295.0, 296.0]
|
||||
|
||||
MOTORS = [Eph]
|
||||
VECTOR = [296.0 for e in range(50)]
|
||||
POSITIONS = [400.0, 401.0]
|
||||
LATENCY = 0.0
|
||||
|
||||
REGION1 = {'elo': 243.0, 'ehi': 293.0, 'estep': 0.05, 'epass': 50, 'tstep': 1.0, 'iter': 1}
|
||||
REGION2 = {'elo': 214.0, 'ehi': 220.0, 'estep': 0.05, 'epass': 50, 'tstep': 0.5, 'iter': 1}
|
||||
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}
|
||||
REGIONS = [REGION1, REGION2]
|
||||
|
||||
CLOSE_SHUTTER_AT_END = True
|
||||
|
||||
Scienta.setAcquisitionMode(ch.psi.pshell.epics.Scienta.AcquisitionMode.Swept)
|
||||
|
||||
class SpectrumReader(ReadonlyRegisterBase, ReadonlyRegisterArray):
|
||||
def __init__(self):
|
||||
super(SpectrumReader, self).__init__()
|
||||
self.ephot_start = Eph.read()
|
||||
|
||||
def setup(self):
|
||||
ephot = Eph.read()
|
||||
edelta = ephot - EPHOT0
|
||||
try:
|
||||
if self.region['cis']:
|
||||
edelta = ephot - self.ephot_start
|
||||
else:
|
||||
edelta = 0.0
|
||||
print "calc edelta:", self.ephot_start, ephot, edelta
|
||||
except AttributeError:
|
||||
self.ephot_start = ephot
|
||||
edelta = 0.0
|
||||
print "reset edelta:", self.ephot_start, ephot, edelta
|
||||
|
||||
Scienta.lowEnergy.write(self.region['elo'] + edelta)
|
||||
Scienta.highEnergy.write(self.region['ehi'] + edelta)
|
||||
Scienta.stepSize.write(self.region['estep'])
|
||||
@@ -54,25 +69,33 @@ class ImageReader(ReadonlyRegisterBase, ReadonlyRegisterMatrix):
|
||||
return ny
|
||||
|
||||
|
||||
SENSORS = [SampleCurrent, RefCurrent]
|
||||
def do_scan(motors, positions, regions, latency):
|
||||
sensors = [SampleCurrent, RefCurrent]
|
||||
|
||||
for (index, region) in enumerate(REGIONS):
|
||||
reader = SpectrumReader()
|
||||
reader.initialize()
|
||||
reader.index = index
|
||||
reader.region = region
|
||||
set_device_alias(reader, "ScientaSpectrum{0}".format(index + 1))
|
||||
SENSORS.append(reader)
|
||||
for (index, region) in enumerate(regions):
|
||||
reader = SpectrumReader()
|
||||
reader.initialize()
|
||||
reader.index = index
|
||||
reader.region = region
|
||||
set_device_alias(reader, "ScientaSpectrum{0}".format(index + 1))
|
||||
sensors.append(reader)
|
||||
|
||||
image = ImageReader()
|
||||
image.initialize()
|
||||
image.index = index
|
||||
image.region = region
|
||||
set_device_alias(image, "ScientaImage{0}".format(index + 1))
|
||||
SENSORS.append(image)
|
||||
image = ImageReader()
|
||||
image.initialize()
|
||||
image.index = index
|
||||
image.region = region
|
||||
set_device_alias(image, "ScientaImage{0}".format(index + 1))
|
||||
sensors.append(image)
|
||||
|
||||
adjust_sensors()
|
||||
set_adc_averaging()
|
||||
set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1})
|
||||
adjust_sensors()
|
||||
set_adc_averaging()
|
||||
|
||||
vscan(MOTORS, SENSORS, VECTOR, True, LATENCY,False, before_read=wait_beam, after_read = after_readout)
|
||||
vscan(motors, sensors, positions, True, latency,False, before_read=wait_beam, after_read = after_readout)
|
||||
|
||||
|
||||
try:
|
||||
set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1})
|
||||
do_scan(MOTORS, POSITIONS, REGIONS, LATENCY)
|
||||
finally:
|
||||
if CLOSE_SHUTTER_AT_END:
|
||||
after_scan()
|
||||
|
||||
Reference in New Issue
Block a user