Apply suggestions from code review of branch simplify-csm-interface
Co-authored-by: Joe Knapper <joe.knapper@glasgow.ac.uk>
This commit is contained in:
parent
705cf73173
commit
59a5246904
2 changed files with 10 additions and 6 deletions
|
|
@ -225,7 +225,7 @@ class BaseCamera(lt.Thing):
|
||||||
* The array is downsamples by the thing property `downsampled_array_factor`.
|
* The array is downsamples by the thing property `downsampled_array_factor`.
|
||||||
* The default capture array arguments are used.
|
* The default capture array arguments are used.
|
||||||
|
|
||||||
This method is provides the interface expected by the camera_stage_mapping.
|
This method provides the interface expected by the camera_stage_mapping.
|
||||||
"""
|
"""
|
||||||
img = self.capture_array()
|
img = self.capture_array()
|
||||||
return downsample(self.downsampled_array_factor, img)
|
return downsample(self.downsampled_array_factor, img)
|
||||||
|
|
@ -440,13 +440,17 @@ class BaseCamera(lt.Thing):
|
||||||
raise IOError(f"An error occurred while saving {jpeg_path}") from e
|
raise IOError(f"An error occurred while saving {jpeg_path}") from e
|
||||||
|
|
||||||
settling_time = lt.ThingSetting(float, 0.2)
|
settling_time = lt.ThingSetting(float, 0.2)
|
||||||
"""The the settling time when calling the ``settle()`` method."""
|
"""The settling time when calling the ``settle()`` method."""
|
||||||
|
|
||||||
@lt.thing_action
|
@lt.thing_action
|
||||||
def settle(self) -> None:
|
def settle(self) -> None:
|
||||||
"""Sleep for the settling time, ready to provide a fresh frame.
|
"""Sleep for the settling time, ready to provide a fresh frame.
|
||||||
|
|
||||||
This method is provides the interface expected by the camera_stage_mapping.
|
This function will sleep for the given time, and clear the buffer after sleeping.
|
||||||
|
As such, the next frame captured from the camera after running this function will
|
||||||
|
always be captured after settling.
|
||||||
|
|
||||||
|
This method provides the interface expected by the camera_stage_mapping.
|
||||||
"""
|
"""
|
||||||
time.sleep(self.settling_time)
|
time.sleep(self.settling_time)
|
||||||
self.discard_frames()
|
self.discard_frames()
|
||||||
|
|
@ -464,7 +468,7 @@ def downsample(factor: int, image: np.ndarray) -> np.ndarray:
|
||||||
* calculate each pixel as the mean of each ``factor * factor`` square without
|
* calculate each pixel as the mean of each ``factor * factor`` square without
|
||||||
interpolation.
|
interpolation.
|
||||||
* If the image is not an integer multiple of the resampling factor, discard
|
* If the image is not an integer multiple of the resampling factor, discard
|
||||||
the left-over pixels to avoids odd edge effects and keep performance quick.
|
the left-over pixels to avoid odd edge effects and keep performance quick.
|
||||||
"""
|
"""
|
||||||
if factor == 1:
|
if factor == 1:
|
||||||
return image
|
return image
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class BaseStage(lt.Thing):
|
||||||
|
|
||||||
:raises KeyError: if this stage does not have axes named "x", "y", and "z".
|
:raises KeyError: if this stage does not have axes named "x", "y", and "z".
|
||||||
|
|
||||||
This method is provides the interface expected by the camera_stage_mapping.
|
This method provides the interface expected by the camera_stage_mapping.
|
||||||
"""
|
"""
|
||||||
position_dict = self.position
|
position_dict = self.position
|
||||||
return (position_dict["x"], position_dict["y"], position_dict["z"])
|
return (position_dict["x"], position_dict["y"], position_dict["z"])
|
||||||
|
|
@ -111,7 +111,7 @@ class BaseStage(lt.Thing):
|
||||||
|
|
||||||
:raises KeyError: if this stage does not have axes named "x", "y", and "z".
|
:raises KeyError: if this stage does not have axes named "x", "y", and "z".
|
||||||
|
|
||||||
This method is provides the interface expected by the camera_stage_mapping.
|
This method provides the interface expected by the camera_stage_mapping.
|
||||||
"""
|
"""
|
||||||
self.move_absolute(cancel=cancel, x=xyz_pos[0], y=xyz_pos[1], z=xyz_pos[2])
|
self.move_absolute(cancel=cancel, x=xyz_pos[0], y=xyz_pos[1], z=xyz_pos[2])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue