Included TimeResolved scan
This commit is contained in:
@@ -81,3 +81,23 @@ def after_readout(rec):
|
||||
|
||||
|
||||
|
||||
def trigger_scienta():
|
||||
"""
|
||||
Trigger new acquisition
|
||||
"""
|
||||
scienta.start()
|
||||
scienta.waitNewImage(-1)
|
||||
|
||||
|
||||
def dummy_trigger_scienta():
|
||||
"""
|
||||
Trigger detector to update the array sizes and calibration
|
||||
"""
|
||||
iterations = scienta.getIterations()
|
||||
scienta.setIterations(1)
|
||||
try:
|
||||
trigger_scienta()
|
||||
finally:
|
||||
scienta.setIterations(iterations)
|
||||
|
||||
|
||||
|
||||
@@ -1,48 +1,41 @@
|
||||
if get_exec_pars().debug:
|
||||
print "Setting debug parameters"
|
||||
REGIONS = [[523.0, 527.0, 2.0], [527.0, 535.0, 4.0], [535.0, 558.0, 2.0]]
|
||||
NAME = None
|
||||
FILE = None
|
||||
|
||||
if FILE:
|
||||
FILE = get_context().setup.expandPath("{home}/parameters/" + FILE)
|
||||
import json
|
||||
with open(FILE) as json_file:
|
||||
cfg = json.load(json_file)
|
||||
NAME , REGIONS= cfg[0][0][0], cfg[1]
|
||||
print "FILE: ", FILE
|
||||
print "NAME: ", NAME
|
||||
print "REGIONS: ", REGIONS
|
||||
|
||||
IOC_AUTO_SAVE = False
|
||||
DUMMY_TRIGGER = True #Trigger detector to update the array sizes and calibration
|
||||
|
||||
set_device_alias(scienta.getSpectrum(), "spectrum")
|
||||
set_device_alias(scienta.getDataMatrix(), "image")
|
||||
set_device_alias(scienta.stats[0], "sum")
|
||||
|
||||
sensors=[i0, scienta.stats[0], scienta.getSpectrum()] #), scienta.getDataMatrix()]
|
||||
|
||||
def trigger(position, scan):
|
||||
scienta.start()
|
||||
scienta.waitNewImage(-1)
|
||||
|
||||
|
||||
if DUMMY_TRIGGER:
|
||||
iterations = scienta.getIterations()
|
||||
scienta.setIterations(1)
|
||||
try:
|
||||
trigger(None, None)
|
||||
finally:
|
||||
scienta.setIterations(iterations)
|
||||
|
||||
|
||||
if IOC_AUTO_SAVE:
|
||||
capture.write(1)
|
||||
|
||||
try:
|
||||
rscan(energy, sensors, REGIONS, latency = 0.0, before_read=trigger, after_read=after_readout, name = NAME)
|
||||
finally:
|
||||
if IOC_AUTO_SAVE:
|
||||
capture.write(0)
|
||||
scienta.zeroSupplies()
|
||||
if get_exec_pars().debug:
|
||||
print "Setting debug parameters"
|
||||
REGIONS = [[523.0, 527.0, 2.0], [527.0, 535.0, 4.0], [535.0, 558.0, 2.0]]
|
||||
NAME = None
|
||||
FILE = None
|
||||
|
||||
if FILE:
|
||||
FILE = get_context().setup.expandPath("{home}/parameters/" + FILE)
|
||||
import json
|
||||
with open(FILE) as json_file:
|
||||
cfg = json.load(json_file)
|
||||
NAME , REGIONS= cfg[0][0][0], cfg[1]
|
||||
print "FILE: ", FILE
|
||||
print "NAME: ", NAME
|
||||
print "REGIONS: ", REGIONS
|
||||
|
||||
IOC_AUTO_SAVE = False
|
||||
DUMMY_TRIGGER = True
|
||||
|
||||
set_device_alias(scienta.getSpectrum(), "spectrum")
|
||||
set_device_alias(scienta.getDataMatrix(), "image")
|
||||
set_device_alias(scienta.stats[0], "sum")
|
||||
|
||||
sensors=[i0, scienta.stats[0], scienta.getSpectrum()] #), scienta.getDataMatrix()]
|
||||
|
||||
def before_read(position, scan):
|
||||
trigger_scienta()
|
||||
|
||||
if DUMMY_TRIGGER:
|
||||
dummy_trigger_scienta()
|
||||
|
||||
|
||||
if IOC_AUTO_SAVE:
|
||||
capture.write(1)
|
||||
|
||||
try:
|
||||
rscan(energy, sensors, REGIONS, latency = 0.0, before_read=before_read, after_read=after_readout, name = NAME)
|
||||
finally:
|
||||
if IOC_AUTO_SAVE:
|
||||
capture.write(0)
|
||||
scienta.zeroSupplies()
|
||||
|
||||
@@ -1,8 +1,48 @@
|
||||
|
||||
if get_exec_pars().debug:
|
||||
print "Setting debug parameters"
|
||||
SCANS = 10
|
||||
NAME = None
|
||||
FILE = None
|
||||
|
||||
if FILE:
|
||||
FILE = get_context().setup.expandPath("{home}/parameters/" + FILE)
|
||||
import json
|
||||
with open(FILE) as json_file:
|
||||
cfg = json.load(json_file)
|
||||
NAME , SCANS= cfg[0], cfg[1]
|
||||
print "FILE: ", FILE
|
||||
print "SCANS: ", SCANS
|
||||
|
||||
|
||||
"""
|
||||
scienta.getState().assertReady()
|
||||
current_spectrum=scienta.getSpectrum().take()
|
||||
scienta.start()
|
||||
|
||||
try:
|
||||
scienta.getSpectrum().waitValueNot(current_spectrum, -1)
|
||||
mscan(scienta.getSpectrum(), scienta.getSpectrum(), scienta.getIterations(), -1, take_initial=True)
|
||||
except:
|
||||
scienta.stop()
|
||||
scienta.zeroSupplies()
|
||||
|
||||
"""
|
||||
|
||||
|
||||
set_device_alias(scienta.getSpectrum(), "spectrum")
|
||||
|
||||
sensors=[i0, scienta.getSpectrum()]
|
||||
|
||||
def before_read(position, scan):
|
||||
trigger_scienta()
|
||||
|
||||
|
||||
mscan(scienta.getSpectrum(), scienta.getSpectrum(), scienta.getIterations() -1)
|
||||
dummy_trigger_scienta()
|
||||
|
||||
|
||||
try:
|
||||
tscan(sensors, SCANS, 0.001, before_read=before_read, after_read=after_readout, name = NAME)
|
||||
finally:
|
||||
scienta.zeroSupplies()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user