-
Notifications
You must be signed in to change notification settings - Fork 12
Fix misc eiger arming issues #2052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
6f756e4
1b68b6a
96660ea
710c63a
f94bdef
57a35f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -225,18 +225,27 @@ def change_roi_mode(self, enable: bool) -> StatusBase: | |
| if enable | ||
| else self.detector_params.detector_size_constants.det_size_pixels | ||
| ) | ||
| LOGGER.info(f"Setting cam.roi_mode to {1 if enable else 0}") | ||
| status = self.cam.roi_mode.set( | ||
| 1 if enable else 0, timeout=self.timeouts.general_status_timeout | ||
| ) | ||
| status.wait(timeout=self.timeouts.general_status_timeout) | ||
| LOGGER.debug(f"Setting image_height to {detector_dimensions.height}") | ||
| status &= self.odin.file_writer.image_height.set( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should: The last status has already been waited on so no need to do |
||
| detector_dimensions.height, timeout=self.timeouts.general_status_timeout | ||
| ) | ||
| status.wait(timeout=self.timeouts.general_status_timeout) | ||
| LOGGER.debug(f"Setting image_width to {detector_dimensions.width}") | ||
| status &= self.odin.file_writer.image_width.set( | ||
| detector_dimensions.width, timeout=self.timeouts.general_status_timeout | ||
| ) | ||
| status.wait(timeout=self.timeouts.general_status_timeout) | ||
| LOGGER.debug(f"Setting num_row_chunks to {detector_dimensions.height}") | ||
| status &= self.odin.file_writer.num_row_chunks.set( | ||
| detector_dimensions.height, timeout=self.timeouts.general_status_timeout | ||
| ) | ||
| status.wait(timeout=self.timeouts.general_status_timeout) | ||
| LOGGER.debug(f"Setting num_col_chunks to {detector_dimensions.width}") | ||
| status &= self.odin.file_writer.num_col_chunks.set( | ||
| detector_dimensions.width, timeout=self.timeouts.general_status_timeout | ||
| ) | ||
|
|
@@ -249,21 +258,30 @@ def set_cam_pvs(self) -> AndStatus: | |
| self.detector_params.exposure_time_s, | ||
| timeout=self.timeouts.general_status_timeout, | ||
| ) | ||
| status.wait(timeout=self.timeouts.general_status_timeout) | ||
| LOGGER.debug("Setting cam acquire_period...") | ||
| status &= self.cam.acquire_period.set( | ||
| self.detector_params.exposure_time_s, | ||
| timeout=self.timeouts.general_status_timeout, | ||
| ) | ||
| status.wait(timeout=self.timeouts.general_status_timeout) | ||
| LOGGER.debug("Setting cam num_exposures...") | ||
| status &= self.cam.num_exposures.set( | ||
| 1, timeout=self.timeouts.general_status_timeout | ||
| ) | ||
| status.wait(timeout=self.timeouts.general_status_timeout) | ||
| LOGGER.debug("Setting cam image_mode...") | ||
| status &= self.cam.image_mode.set( | ||
| self.cam.ImageMode.MULTIPLE, # pyright: ignore[reportAttributeAccessIssue] | ||
| timeout=self.timeouts.general_status_timeout, | ||
| ) | ||
| status.wait(timeout=self.timeouts.general_status_timeout) | ||
| LOGGER.debug("Setting cam trigger_mode...") | ||
| status &= self.cam.trigger_mode.set( | ||
| InternalEigerTriggerMode.EXTERNAL_SERIES.value, | ||
| timeout=self.timeouts.general_status_timeout, | ||
| ) | ||
| status.wait(timeout=self.timeouts.general_status_timeout) | ||
| return status | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should: The only reason this returns the status is so that we can wait on it, if we've already waited on it then it seems a bit pointless
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this all goes into the list of run_functions_without_blocking() so to follow convention we return the status. |
||
|
|
||
| def set_odin_number_of_frame_chunks(self) -> Status: | ||
|
|
@@ -379,7 +397,7 @@ def set_num_triggers_and_captures(self) -> StatusBase: | |
|
|
||
| def _wait_for_odin_status(self) -> StatusBase: | ||
| self.forward_bit_depth_to_filewriter() | ||
| await_value(self.odin.meta.active, 1).wait(self.timeouts.general_status_timeout) | ||
| await_value(self.odin.meta.active, 1).wait(60) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should: Can we pull this into a const? |
||
|
|
||
| status = self.odin.file_writer.capture.set( | ||
| 1, timeout=self.timeouts.general_status_timeout | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -293,7 +293,6 @@ def test_unsuccessful_true_roi_mode_change_results_in_callback_error( | |
| ] | ||
| with pytest.raises(StatusError): | ||
| run_functions_without_blocking(unwrapped_funcs).wait() | ||
| LOGGER.error.assert_called() | ||
|
|
||
|
|
||
| @patch("ophyd.status.Status.__and__") | ||
|
|
@@ -355,7 +354,7 @@ def test_stage_runs_successfully( | |
| fake_eiger.stage() | ||
| fake_eiger.arming_status.wait(1) # This should complete long before 1s | ||
| # One log message kicking off arming, then one for each of the 13 arming stages | ||
| assert len(caplog.messages) == 14 | ||
| assert len(caplog.messages) == 18 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should: This no longer matches the comment above |
||
|
|
||
|
|
||
| def test_given_stale_parameters_goes_high_before_callbacks_then_stale_parameters_waited_on( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could: If we're going to wait on each individual status then we don't need to keep the status around, e.g.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for my question if it misses the point here. Is it possibl to improve IOC PV so the set call can rely on callback instead of wait on status, or the status already embedded callback inside?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the status is the callback from the IOC