fix: online changes e21536
This commit is contained in:
parent
0fc5bf22e1
commit
0372f6f726
@ -318,6 +318,12 @@ class DelayGeneratorDG645(Device):
|
|||||||
kind="config",
|
kind="config",
|
||||||
config_storage_name="ddg_config",
|
config_storage_name="ddg_config",
|
||||||
)
|
)
|
||||||
|
premove_trigger = Component(
|
||||||
|
bec_utils.ConfigSignal,
|
||||||
|
name="premove_trigger",
|
||||||
|
kind="config",
|
||||||
|
config_storage_name="ddg_config",
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -370,6 +376,7 @@ class DelayGeneratorDG645(Device):
|
|||||||
f"{name}_set_high_on_stage": False,
|
f"{name}_set_high_on_stage": False,
|
||||||
f"{name}_set_trigger_source": "SINGLE_SHOT",
|
f"{name}_set_trigger_source": "SINGLE_SHOT",
|
||||||
f"{name}_trigger_width": None, # This somehow duplicates the logic of fixed_ttl_width
|
f"{name}_trigger_width": None, # This somehow duplicates the logic of fixed_ttl_width
|
||||||
|
f"{name}_premove_trigger": False,
|
||||||
}
|
}
|
||||||
if ddg_config is not None:
|
if ddg_config is not None:
|
||||||
[self.ddg_config.update({f"{name}_{key}": value}) for key, value in ddg_config.items()]
|
[self.ddg_config.update({f"{name}_{key}": value}) for key, value in ddg_config.items()]
|
||||||
@ -588,14 +595,20 @@ class DelayGeneratorDG645(Device):
|
|||||||
self._ddg_is_okay()
|
self._ddg_is_okay()
|
||||||
self._stopped = False
|
self._stopped = False
|
||||||
self._acquisition_done = False
|
self._acquisition_done = False
|
||||||
|
logger.info("DDG unstaged")
|
||||||
super().unstage()
|
super().unstage()
|
||||||
|
|
||||||
|
def pre_scan(self) -> None:
|
||||||
|
if self.premove_trigger.get()==True:
|
||||||
|
self.trigger_shot.put(1)
|
||||||
|
|
||||||
def trigger(self) -> DeviceStatus:
|
def trigger(self) -> DeviceStatus:
|
||||||
# if self.scaninfo.scan_type == "step":
|
status = DeviceStatus(self)
|
||||||
|
if self.premove_trigger.get() == True:
|
||||||
|
status.set_finished()
|
||||||
|
return status
|
||||||
if self.source.read()[self.source.name]["value"] == int(TriggerSource.SINGLE_SHOT):
|
if self.source.read()[self.source.name]["value"] == int(TriggerSource.SINGLE_SHOT):
|
||||||
self.trigger_shot.put(1)
|
self.trigger_shot.put(1)
|
||||||
# status = super().trigger(status=)
|
|
||||||
status = DeviceStatus(self)
|
|
||||||
burst_state = threading.Thread(target=self._check_burst_cycle, args=(status,), daemon=True)
|
burst_state = threading.Thread(target=self._check_burst_cycle, args=(status,), daemon=True)
|
||||||
burst_state.start()
|
burst_state.start()
|
||||||
return status
|
return status
|
||||||
|
@ -65,6 +65,8 @@ class FalconHDF5Plugins(Device): # HDF5Plugin_V21, FilePlugin_V22):
|
|||||||
file_template = Cpt(EpicsSignalWithRBV, "FileTemplate", string=True, kind="config")
|
file_template = Cpt(EpicsSignalWithRBV, "FileTemplate", string=True, kind="config")
|
||||||
num_capture = Cpt(EpicsSignalWithRBV, "NumCapture", kind="config")
|
num_capture = Cpt(EpicsSignalWithRBV, "NumCapture", kind="config")
|
||||||
file_write_mode = Cpt(EpicsSignalWithRBV, "FileWriteMode", kind="config")
|
file_write_mode = Cpt(EpicsSignalWithRBV, "FileWriteMode", kind="config")
|
||||||
|
queue_size = Cpt(EpicsSignalWithRBV, "QueueSize", kind="config")
|
||||||
|
array_counter = Cpt(EpicsSignalWithRBV, "ArrayCounter", kind="config")
|
||||||
|
|
||||||
|
|
||||||
class FalconCsaxs(Device):
|
class FalconCsaxs(Device):
|
||||||
@ -145,7 +147,7 @@ class FalconCsaxs(Device):
|
|||||||
self.filewriter = FileWriterMixin(self.service_cfg)
|
self.filewriter = FileWriterMixin(self.service_cfg)
|
||||||
|
|
||||||
self.readout = 0.003 # 3 ms
|
self.readout = 0.003 # 3 ms
|
||||||
self._value_pixel_per_buffer = 1 # 16
|
self._value_pixel_per_buffer = 20 # 16
|
||||||
self._clean_up()
|
self._clean_up()
|
||||||
self._init_hdf5_saving()
|
self._init_hdf5_saving()
|
||||||
self._init_mapping_mode()
|
self._init_mapping_mode()
|
||||||
@ -161,7 +163,8 @@ class FalconCsaxs(Device):
|
|||||||
self.hdf5.enable.put(1) # EnableCallbacks
|
self.hdf5.enable.put(1) # EnableCallbacks
|
||||||
self.hdf5.xml_file_name.put("layout.xml") # Points to hardcopy of HDF5 Layout xml file
|
self.hdf5.xml_file_name.put("layout.xml") # Points to hardcopy of HDF5 Layout xml file
|
||||||
self.hdf5.lazy_open.put(1) # Yes -> To be checked how to add FilePlugin_V21+
|
self.hdf5.lazy_open.put(1) # Yes -> To be checked how to add FilePlugin_V21+
|
||||||
self.hdf5.temp_suffix.put("temps") # -> To be checked how to add FilePlugin_V22+
|
self.hdf5.temp_suffix.put("") # -> To be checked how to add FilePlugin_V22+
|
||||||
|
self.hdf5.queue_size.put(2000)
|
||||||
|
|
||||||
def _init_mapping_mode(self) -> None:
|
def _init_mapping_mode(self) -> None:
|
||||||
"""Set up mapping mode params"""
|
"""Set up mapping mode params"""
|
||||||
@ -169,17 +172,17 @@ class FalconCsaxs(Device):
|
|||||||
self.preset_mode.put(1) # 1 Realtime
|
self.preset_mode.put(1) # 1 Realtime
|
||||||
self.input_logic_polarity.put(0) # 0 Normal, 1 Inverted
|
self.input_logic_polarity.put(0) # 0 Normal, 1 Inverted
|
||||||
self.pixel_advance_mode.put(1) # 0 User, 1 Gate, 2 Sync
|
self.pixel_advance_mode.put(1) # 0 User, 1 Gate, 2 Sync
|
||||||
self.ignore_gate.put(1) # 1 Yes
|
self.ignore_gate.put(0) # 1 Yes, 0 No
|
||||||
self.auto_pixels_per_buffer.put(0) # 0 Manual 1 Auto
|
self.auto_pixels_per_buffer.put(0) # 0 Manual 1 Auto
|
||||||
self.pixels_per_buffer.put(16) #
|
self.pixels_per_buffer.put(self._value_pixel_per_buffer) #
|
||||||
|
|
||||||
def _prep_det(self) -> None:
|
def _prep_det(self) -> None:
|
||||||
"""Prepare detector for acquisition"""
|
"""Prepare detector for acquisition"""
|
||||||
self.collect_mode.put(1)
|
self.collect_mode.put(1)
|
||||||
self.preset_real.put(self.scaninfo.exp_time)
|
self.preset_real.put(self.scaninfo.exp_time)
|
||||||
self.pixels_per_run.put(int(self.scaninfo.num_points * self.scaninfo.frames_per_trigger))
|
self.pixels_per_run.put(int(self.scaninfo.num_points * self.scaninfo.frames_per_trigger))
|
||||||
self.auto_pixels_per_buffer.put(0)
|
#self.auto_pixels_per_buffer.put(0)
|
||||||
self.pixels_per_buffer.put(self._value_pixel_per_buffer)
|
#self.pixels_per_buffer.put(self._value_pixel_per_buffer)
|
||||||
|
|
||||||
def _prep_file_writer(self) -> None:
|
def _prep_file_writer(self) -> None:
|
||||||
"""Prep HDF5 weriting"""
|
"""Prep HDF5 weriting"""
|
||||||
@ -192,8 +195,9 @@ class FalconCsaxs(Device):
|
|||||||
self.hdf5.file_path.put(file_path)
|
self.hdf5.file_path.put(file_path)
|
||||||
self.hdf5.file_name.put(file_name)
|
self.hdf5.file_name.put(file_name)
|
||||||
self.hdf5.file_template.put(f"%s%s")
|
self.hdf5.file_template.put(f"%s%s")
|
||||||
self.hdf5.num_capture.put(self.scaninfo.num_points // self._value_pixel_per_buffer + 1)
|
self.hdf5.num_capture.put(int(self.scaninfo.num_points * self.scaninfo.frames_per_trigger))
|
||||||
self.hdf5.file_write_mode.put(2)
|
self.hdf5.file_write_mode.put(2)
|
||||||
|
self.hdf5.array_counter.put(0)
|
||||||
self.hdf5.capture.put(1)
|
self.hdf5.capture.put(1)
|
||||||
|
|
||||||
def stage(self) -> List[object]:
|
def stage(self) -> List[object]:
|
||||||
@ -260,18 +264,21 @@ class FalconCsaxs(Device):
|
|||||||
det_ctrl = self.state.read()[self.state.name]["value"]
|
det_ctrl = self.state.read()[self.state.name]["value"]
|
||||||
writer_ctrl = self.hdf5.capture.get()
|
writer_ctrl = self.hdf5.capture.get()
|
||||||
received_frames = self.dxp.current_pixel.get()
|
received_frames = self.dxp.current_pixel.get()
|
||||||
|
written_frames = self.hdf5.array_counter.get()
|
||||||
total_frames = int(self.scaninfo.num_points * self.scaninfo.frames_per_trigger)
|
total_frames = int(self.scaninfo.num_points * self.scaninfo.frames_per_trigger)
|
||||||
# TODO if no writing was performed before
|
# TODO if no writing was performed before
|
||||||
if total_frames == received_frames:
|
if total_frames == received_frames and total_frames == written_frames:
|
||||||
break
|
break
|
||||||
if self._stopped == True:
|
if self._stopped == True:
|
||||||
break
|
break
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
timer += 0.1
|
timer += 0.1
|
||||||
if timer > 8:
|
if timer > 5:
|
||||||
raise FalconTimeoutError(
|
logger.info(f'Falcon missed a trigger: received trigger {received_frames}, send data {written_frames} from total_frames {total_frames}')
|
||||||
f"Reached timeout with detector state {det_ctrl}, falcon state {writer_ctrl} and received frames of {received_frames} for the file writer"
|
break
|
||||||
)
|
# raise FalconTimeoutError
|
||||||
|
# f"Reached timeout with detector state {det_ctrl}, falcon state {writer_ctrl}, received trigger {received_frames} and files written {written_frames}"
|
||||||
|
# )
|
||||||
|
|
||||||
def stop(self, *, success=False) -> None:
|
def stop(self, *, success=False) -> None:
|
||||||
"""Stop the scan, with camera and file writer"""
|
"""Stop the scan, with camera and file writer"""
|
||||||
|
@ -295,7 +295,7 @@ class McsCsaxs(SIS38XX):
|
|||||||
|
|
||||||
def _set_acquisition_params(self) -> None:
|
def _set_acquisition_params(self) -> None:
|
||||||
if self.scaninfo.scan_type == "step":
|
if self.scaninfo.scan_type == "step":
|
||||||
self.n_points = int(self.scaninfo.frames_per_trigger)
|
self.n_points = int(self.scaninfo.frames_per_trigger)*int(self.scaninfo.num_points)
|
||||||
elif self.scaninfo.scan_type == "fly":
|
elif self.scaninfo.scan_type == "fly":
|
||||||
self.n_points = int(self.scaninfo.num_points) # / int(self.num_lines.get()))
|
self.n_points = int(self.scaninfo.num_points) # / int(self.num_lines.get()))
|
||||||
else:
|
else:
|
||||||
|
@ -413,7 +413,7 @@ class PilatusCsaxs(DetectorBase):
|
|||||||
# # )
|
# # )
|
||||||
|
|
||||||
self._stop_file_writer()
|
self._stop_file_writer()
|
||||||
time.sleep(2)
|
time.sleep(.5)
|
||||||
self._close_file_writer()
|
self._close_file_writer()
|
||||||
|
|
||||||
def acquire(self) -> None:
|
def acquire(self) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user