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

Commit 6ba33b43 authored by Emmanuel Papillon's avatar Emmanuel Papillon

update fscan calibration / preset for eiger

parent 037dc4f9
......@@ -41,6 +41,7 @@ class CountMuxPreset(ChainPreset):
# --- triggers
self.opmux.switch("TRIGGER_MODE", "COUNTER_CARD")
self.opmux.switch("CAM1", "ON")
self.opmux.switch("CAM2", "ON")
self.opmux.switch("MCA1", "ON")
def start(self, chain):
......@@ -53,6 +54,7 @@ class CountMuxPreset(ChainPreset):
CAM2MUX = {
"frelon4": "CAM1",
"eiger": "CAM2",
}
class FScanMuxPreset(ScanPreset):
......
......@@ -11,20 +11,34 @@ class ID11CameraCalib:
def calibrate(self, devs, acqtime, shuttime=0.):
readout_time = 0.0
latency_time = 1e-6
self.readout = dict()
for dev in devs:
camtype = dev._proxy.lima_type
if camtype == "Andor3":
camtime = self.calibrate_andor(dev, acqtime)
cam_time = self.calibrate_andor(dev, acqtime)
lat_time = 1e-4
elif camtype == "Frelon":
camtime = self.calibrate_frelon(dev, acqtime, shuttime)
cam_time = self.calibrate_frelon(dev, acqtime, shuttime)
lat_time = 1e-4
elif camtype == "Eiger":
cam_time = 1e-7
lat_time = 1e-6
else:
print("WARNING : software estimation of {dev.name} readout time !!")
camtime = take_one_image(dev, acq_time)
self.readout[dev.name] = camtime
cam_time = take_one_image(dev, acq_time)
lat_time = 1e-4
self.readout[dev.name] = (cam_time, lat_time)
if len(self.readout):
readout_time = max(self.readout.values())
return readout_time
max_rd = 0.0
max_name = None
for name, (rd, lat) in self.readout.items():
if rd >= max_rd:
max_rd = rd
max_name = name
(readout_time, latency_time) = self.readout[max_name]
return (readout_time, latency_time)
def calibrate_andor(self, dev, acqtime):
self.take_image(dev, acqtime, 1)
......@@ -72,7 +86,6 @@ class ID11FTimeScan(FScanRunner):
def __init__(self, scanname, scanmaster, fshutter):
self._fsh = fshutter
self._calib = ID11CameraCalib()
self._min_latency_time = 1e-4
super().__init__(scanname, scanmaster)
def validate(self):
......@@ -80,8 +93,8 @@ class ID11FTimeScan(FScanRunner):
# --- 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 + self._min_latency_time
(readout_time, min_lat_time) = self._calib.calibrate(limadevs, pars.acq_time, self._fsh.shutter_time)
min_period = pars.acq_time + readout_time + min_lat_time
if pars.period < min_period:
pars.period = min_period
......@@ -98,7 +111,6 @@ class ID11FScan(FScanDiagRunner):
def __init__(self, scanname, scanmaster, fshutter):
self._fsh = fshutter
self._calib = ID11CameraCalib()
self._min_latency_time = 1e-4
super().__init__(scanname, scanmaster)
def validate(self):
......@@ -106,9 +118,9 @@ class ID11FScan(FScanDiagRunner):
# --- check minimum step_size
limadevs = self._master.get_controllers_found("lima")
readout_time = self._calib.calibrate(limadevs, pars.acq_time, self._fsh.shutter_time)
if pars.latency_time < self._min_latency_time:
pars.latency_time = self._min_latency_time
(readout_time, min_lat_time) = self._calib.calibrate(limadevs, pars.acq_time, self._fsh.shutter_time)
if pars.latency_time < min_lat_time:
pars.latency_time = min_lat_time
min_step_time = pars.acq_time + readout_time + pars.latency_time
if pars.step_time < min_step_time:
......@@ -133,7 +145,6 @@ class ID11FScan2D(FScanDiagRunner):
def __init__(self, scanname, scanmaster, fshutter):
self._fsh = fshutter
self._calib = ID11CameraCalib()
self._min_latency_time = 1e-4
super().__init__(scanname, scanmaster)
def validate(self):
......@@ -141,9 +152,9 @@ class ID11FScan2D(FScanDiagRunner):
# --- check minimum step_size
limadevs = self._master.get_controllers_found("lima")
readout_time = self._calib.calibrate(limadevs, pars.acq_time, self._fsh.shutter_time)
if pars.latency_time < self._min_latency_time:
pars.latency_time = self._min_latency_time
(readout_time, min_lat_time) = self._calib.calibrate(limadevs, pars.acq_time, self._fsh.shutter_time)
if pars.latency_time < min_lat_time:
pars.latency_time = min_lat_time
min_step_time = pars.acq_time + readout_time + pars.latency_time
if pars.fast_step_time < min_step_time:
......@@ -174,7 +185,6 @@ class ID11FInterlaced(FScanDiagRunner):
def __init__(self, scanname, scanmaster, fshutter):
self._fsh = fshutter
self._calib = ID11CameraCalib()
self._min_latency_time = 1e-4
super().__init__(scanname, scanmaster)
def validate(self):
......@@ -185,7 +195,7 @@ class ID11FInterlaced(FScanDiagRunner):
frelons = [ dev for dev in limadevs if dev._proxy.lima_type == "Frelon" ]
if len(frelons):
readout_time = self._calib.calibrate(frelons, pars.acq_time, self._fsh.shutter_time)
(readout_time, min_lat_time) = self._calib.calibrate(frelons, pars.acq_time, self._fsh.shutter_time)
if pars.acq_time < readout_time:
raise RuntimeError(f"Acquisition time too short for frelon (min={readout_time})")
......
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