fix(cont-grid): fix progress updates for cont grid scan
This commit is contained in:
@@ -318,6 +318,11 @@ class MCSCardCSAXS(PSIDeviceBase, MCSCard):
|
||||
value: New value of the signal.
|
||||
"""
|
||||
try:
|
||||
if (
|
||||
self._num_lines > 1 and old_value > value
|
||||
): # This indicates that we have moved to the next line in a cont scan
|
||||
self._current_line += 1
|
||||
value = value + (self._current_line - 1) * self.scan_parameters.frames_per_trigger
|
||||
scan_done = bool(value == self._num_total_triggers)
|
||||
self.progress.put(value=value, max_value=self._num_total_triggers, done=scan_done)
|
||||
except Exception:
|
||||
@@ -371,6 +376,8 @@ class MCSCardCSAXS(PSIDeviceBase, MCSCard):
|
||||
triggers = self.scan_parameters.frames_per_trigger
|
||||
num_points = self.scan_parameters.num_points
|
||||
self._num_total_triggers = triggers * num_points
|
||||
self._num_lines = self.scan_parameters.additional_scan_parameters.get("num_lines", 1)
|
||||
self._current_line = 1
|
||||
self._acquisition_group = "monitored" if triggers == 1 else "burst_group"
|
||||
self.preset_real.set(0).wait(timeout=self._pv_timeout)
|
||||
if self.scan_parameters.scan_type == "software_triggered":
|
||||
|
||||
@@ -167,19 +167,7 @@ class ContGrid(ScanBase):
|
||||
|
||||
self.motors = [fast_axis, stepper_axis]
|
||||
self._cont_motor_params: ContinuousMotorParameter = ContinuousMotorParameter()
|
||||
|
||||
# TODO: If the scan motors (self.motors) are step-scanned, and we want e.g. GUIs
|
||||
# to pick them up automatically, add them as scan_report_devices to the
|
||||
# update_scan_info call below (scan_report_devices=self.motors).
|
||||
# Delete the comment if not needed.
|
||||
|
||||
self.update_scan_info(relative=relative, exp_time=exp_time)
|
||||
# TODO: If the scan motors (self.motors) are step-scanned, we have to elevate
|
||||
# their readout priority to "monitored" to ensure that their positions are
|
||||
# included in every readout of the step scan.
|
||||
# Uncomment the line below as necessary or delete it if not needed.
|
||||
|
||||
# self.actions.set_device_readout_priority(self.motors, priority="monitored")
|
||||
|
||||
@scan_hook
|
||||
def prepare_scan(self):
|
||||
@@ -227,6 +215,7 @@ class ContGrid(ScanBase):
|
||||
num_points=len(self.positions),
|
||||
frames_per_trigger=frames_per_trigger,
|
||||
computed_positions=positions,
|
||||
num_lines=self._cont_motor_params["num_lines"],
|
||||
)
|
||||
|
||||
self.actions.add_scan_report_instruction_device_progress(self.mcs)
|
||||
|
||||
Reference in New Issue
Block a user