diff --git a/script/local.py b/script/local.py index 260aa0bb..2f28555b 100644 --- a/script/local.py +++ b/script/local.py @@ -80,6 +80,19 @@ class ImageAngleDistribution(ReadableCalibratedArray): AngleDistribution = ImageAngleDistribution() +def init_scienta(): + """ + turn on the analyser and start a mock measurement so that we get the correct array size. + start a scienta acquisition and abort after 4 seconds. + """ + if Scienta.isSimulated(): + time.sleep(0.1) + else: + image_id = Scienta.currentImageCount + Scienta.start() + Scienta.waitReady(4000) + Scienta.stop() + Scienta.waitNewImage(500, image_id) def trig_scienta(): if Scienta.isSimulated(): @@ -297,7 +310,6 @@ def before_readout(): def after_readout(rec): if beam_ok: if get_exec_pars().save: - print rec.index if rec.index == 0: create_diag_datasets() append_diag_datasets() @@ -329,16 +341,21 @@ def adjust_sensors(): global SENSORS if SENSORS is not None: # Move integration to end + sample_scienta = False for dev in ["Scienta.spectrum","EnergyDistribution", "AngleDistribution", "Scienta.dataMatrix"]: if dev in SENSORS: + sample_scienta = True SENSORS=SENSORS+[SENSORS.pop(SENSORS.index(dev))] for dev in ["Counts"]: if dev in SENSORS: + sample_scienta = True SENSORS=[SENSORS.pop(SENSORS.index(dev))] + SENSORS if "Scienta.dataMatrix" in SENSORS or Scienta.dataMatrix in SENSORS: print "Not ACC" set_exec_pars(accumulate = False) - + if sample_scienta: + init_scienta() + #Device aliases for data files set_device_alias(Scienta.dataMatrix, "ScientaImage") set_device_alias(Scienta.spectrum, "ScientaSpectrum")