Files
x07db/script/templates/EnergyScan.py
gac-ISS e9ba08ce4f V2
2025-08-27 14:36:28 +02:00

50 lines
1.3 KiB
Python

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]]
PASSES = 1
NAME = None
FILE = None
if FILE:
FILE = 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]
PASSES = 1 if len(cfg<3) else cfg[2]
print "FILE: ", FILE
print "NAME: ", NAME
print "REGIONS: ", REGIONS
print "PASSES: ", PASSES
IOC_AUTO_SAVE = False
DUMMY_TRIGGER = False
SPLIT_PASSES = False
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()
clear_scan_output()
if DUMMY_TRIGGER:
dummy_trigger_scienta()
if IOC_AUTO_SAVE:
capture.write(1)
try:
rscan(energy, sensors, REGIONS, latency = 0.0, passes=PASSES, split=SPLIT_PASSES, \
before_read=before_read, after_read=after_readout, \
name=NAME, lazy=not DUMMY_TRIGGER)
finally:
if IOC_AUTO_SAVE:
capture.write(0)
scienta.zeroSupplies()