dodal.devices.oav.oav_calculations#

Functions

calculate_beam_distance(beam_centre, ...)

Calculates the distance between the beam centre and the given (horizontal, vertical).

camera_coordinates_to_xyz(horizontal, ...)

Converts from (horizontal,vertical) pixel measurements from the OAV camera into to (x, y, z) motor coordinates in millmeters.

dodal.devices.oav.oav_calculations.camera_coordinates_to_xyz(horizontal: float, vertical: float, omega: float, microns_per_i_pixel: float, microns_per_j_pixel: float) ndarray[source]#

Converts from (horizontal,vertical) pixel measurements from the OAV camera into to (x, y, z) motor coordinates in millmeters. For an overview of the coordinate system for I03 see DiamondLightSource/hyperion.

Parameters:
  • horizontal (float) – A i value from the camera in pixels.

  • vertical (float) – A j value from the camera in pixels.

  • omega (float) – The omega angle of the smargon that the horizontal, vertical measurements were obtained at.

  • microns_per_i_pixel (float) – The number of microns per i pixel, adjusted for the zoom level horizontal was measured at.

  • microns_per_j_pixel (float) – The number of microns per j pixel, adjusted for the zoom level vertical was measured at.

Return type:

ndarray

dodal.devices.oav.oav_calculations.calculate_beam_distance(beam_centre: tuple[int, int], horizontal_pixels: int, vertical_pixels: int) tuple[int, int][source]#

Calculates the distance between the beam centre and the given (horizontal, vertical).

Parameters:
  • horizontal_pixels (int) – The x (camera coordinates) value in pixels.

  • vertical_pixels (int) – The y (camera coordinates) value in pixels.

  • beam_centre (tuple[int, int])

Return type:

tuple[int, int]

Returns:

The distance between the beam centre and the (horizontal, vertical) point in pixels as a tuple (horizontal_distance, vertical_distance).