Skip to content

Commit

Permalink
[RESOLUTION] Added keyword argument wavelength to get_limits to be ab…
Browse files Browse the repository at this point in the history
…le to retrieve the

limits for an arbitrary wavelength.
  • Loading branch information
marcus-oscarsson committed Mar 22, 2024
1 parent 11e1910 commit 3a8e5ed
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mxcubecore/HardwareObjects/Resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def set_value(self, value, timeout=None):
timeout(float): optional - timeout [s],
if timeout is None: wait forever (default).
"""
# The precision depoends on the difference between the current
# The precision depends on the difference between the current
# resolution and the target value - the smaller the difference,
# the better the precision.
# We move twice to get the closet possible to the requested resolution.
Expand Down
28 changes: 27 additions & 1 deletion mxcubecore/HardwareObjects/abstract/AbstractResolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,37 @@ def get_value(self):

def get_limits(self):
"""Return resolution low and high limits.
Args:
wavelength: Returns the limits for given wavelength if
passed, current wavelength is otherwised used
Returns:
(tuple): two floats tuple (low limit, high limit).
"""
_low, _high = self._hwr_detector.distance.get_limits()

return (
self.distance_to_resolution(_low),
self.distance_to_resolution(_high),
)

def get_limits_for_wavelength(self, wavelength: float):
"""Return resolution low and high limits.
Args:
wavelength: Returns the limits for given wavelength if
passed, current wavelength is otherwised used
Returns:
(tuple): two floats tuple (low limit, high limit).
"""
_low, _high = self._hwr_detector.distance.get_limits()
return (self.distance_to_resolution(_low), self.distance_to_resolution(_high))

return (
self.distance_to_resolution(_low, wavelength=wavelength),
self.distance_to_resolution(_high, wavelength=wavelength),
)

def set_limits(self, limits):
"""Resolution limits are not settable.
Expand Down

0 comments on commit 3a8e5ed

Please sign in to comment.