Skip to content

Commit

Permalink
Rename oav async file
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Oct 21, 2024
1 parent 126f687 commit 25166a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
File renamed without changes.
18 changes: 9 additions & 9 deletions src/dodal/devices/oav/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from bluesky.utils import Msg

from dodal.devices.oav.oav_calculations import camera_coordinates_to_xyz
from dodal.devices.oav.oav_detector import OAVConfigParams
from dodal.devices.oav.oav_detector import OAV
from dodal.devices.oav.pin_image_recognition import PinTipDetection
from dodal.devices.smargon import Smargon

Expand Down Expand Up @@ -64,7 +64,7 @@ class EdgeOutputArrayImageType(IntEnum):


def get_move_required_so_that_beam_is_at_pixel(
smargon: Smargon, pixel: Pixel, oav_params: OAVConfigParams
smargon: Smargon, pixel: Pixel, oav: OAV
) -> Generator[Msg, None, np.ndarray]:
"""Calculate the required move so that the given pixel is in the centre of the beam."""

Expand All @@ -78,22 +78,22 @@ def get_move_required_so_that_beam_is_at_pixel(
)
current_angle = yield from bps.rd(smargon.omega)

return calculate_x_y_z_of_pixel(current_motor_xyz, current_angle, pixel, oav_params)
return calculate_x_y_z_of_pixel(current_motor_xyz, current_angle, pixel, oav)


def calculate_x_y_z_of_pixel(
current_x_y_z, current_omega, pixel: Pixel, oav_params: OAVConfigParams
current_x_y_z, current_omega, pixel: Pixel, oav: OAV
) -> np.ndarray:
beam_distance_px: Pixel = oav_params.calculate_beam_distance(*pixel)
beam_distance_px: Pixel = oav.calculate_beam_distance(*pixel)

assert oav_params.micronsPerXPixel
assert oav_params.micronsPerYPixel
assert oav.microns_per_pixel_x
assert oav.microns_per_pixel_y
return current_x_y_z + camera_coordinates_to_xyz(
beam_distance_px[0],
beam_distance_px[1],
current_omega,
oav_params.micronsPerXPixel,
oav_params.micronsPerYPixel,
oav.microns_per_pixel_x,
oav.microns_per_pixel_y,
)


Expand Down
2 changes: 1 addition & 1 deletion tests/devices/unit_tests/oav/test_oav_async.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from ophyd_async.core import DeviceCollector, set_mock_value

from dodal.devices.oav.oav_async import OAV, ZoomController
from dodal.devices.oav.oav_detector import OAV, ZoomController
from dodal.devices.oav.oav_parameters import OAVConfig

DISPLAY_CONFIGURATION = "tests/devices/unit_tests/test_display.configuration"
Expand Down

0 comments on commit 25166a4

Please sign in to comment.