GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit 14220d81 authored by Emmanuel Papillon's avatar Emmanuel Papillon

fscans : camera calibration + ftimescan runner

parent b78d80f3
import gevent
import time
from fscan.fscanrunner import FScanRunner
class ID11CameraCalib:
def __init__(self):
self.readout = dict()
def calibrate(self, devs, acqtime, shuttime=0.):
self.readout = dict()
for dev in devs:
camtype = dev._proxy.lima_type
if camtype == "Andor3":
camtime = self.calibrate_andor(dev, acqtime)
elif camtype == "Frelon":
camtime = self.calibrate_frelon(dev, acqtime, shuttime)
print("WARNING : software estimation of {} readout time !!")
camtime = take_one_image(dev, acq_time)
self.readout[] = camtime
return max(self.readout.values())
def calibrate_andor(self, dev, acqtime):
self.take_image(dev, acqtime, 1)
readout =
return readout
def calibrate_frelon(self, dev, acqtime, shuttime):
dev._proxy.saving_mode = "MANUAL"
transfer_time =
readout_time =
readout =
minexpo =
readout = + shuttime
return readout
def take_image(self, dev, acqtime, nimg=1):
proxy = dev._proxy
# check accumulation
if proxy.acq_mode == "ACCUMULATION":
if proxy.acc_nb_frames > 1:
acqtime = proxy.acc_expo_time
# prepare
proxy.saving_mode = "MANUAL"
proxy.acq_trigger_mode = "INTERNAL_TRIGGER"
proxy.acq_expo_time = acqtime
proxy.acq_nb_frames = nimg
# start image acquisition
runtime= time.time()
while proxy.acq_status == "Running":
runtime = time.time() - runtime
return runtime
class ID11FTimeScan(FScanRunner):
def __init__(self, scanname, scanmaster, fshutter):
self._fsh = fshutter
self._calib = ID11CameraCalib()
super().__init__(scanname, scanmaster)
def validate(self):
pars =
# --- check minimum period
limadevs = self._master.get_controllers_found("lima")
readout_time = self._calib.calibrate(limadevs, pars.acq_time, self._fsh.shutter_time)
min_period = pars.acq_time + readout_time + 1e-4
if pars.period < min_period:
pars.period = min_period
def __call__(self, acq_time, npoints, period=0., start_delay=0.):
pars =
pars.acq_time = acq_time
pars.npoints = npoints
pars.period = period
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment