Skip to content

Commit

Permalink
_aperture
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondJoseph committed Sep 2, 2024
1 parent c3ad7e4 commit 9b61f5d
Show file tree
Hide file tree
Showing 8 changed files with 295 additions and 372 deletions.
6 changes: 3 additions & 3 deletions src/dodal/beamline_specific_utils/i03.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import dataclass

from dodal.devices.aperturescatterguard import SingleAperturePosition
from dodal.devices.aperturescatterguard import ApertureValue

I03_BEAM_HEIGHT_UM = 20

Expand All @@ -11,6 +11,6 @@ class BeamSize:
y_um: float | None


def beam_size_from_aperture(position: SingleAperturePosition):
aperture_size = position.radius_microns
def beam_size_from_aperture(position: ApertureValue):
aperture_size = position.radius
return BeamSize(aperture_size, I03_BEAM_HEIGHT_UM if aperture_size else None)
4 changes: 2 additions & 2 deletions src/dodal/beamlines/i03.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from dodal.common.udc_directory_provider import PandASubdirectoryProvider
from dodal.devices.aperturescatterguard import (
ApertureScatterguard,
ApertureValue,
load_positions_from_beamline_parameters,
load_tolerances_from_beamline_params,
)
from dodal.devices.attenuator import Attenuator
from dodal.devices.backlight import Backlight
Expand Down Expand Up @@ -71,7 +71,7 @@ def aperture_scatterguard(
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
loaded_positions=load_positions_from_beamline_parameters(params),
tolerances=load_tolerances_from_beamline_params(params),
tolerances=ApertureValue.tolerances_from_gda_params(params),
)


Expand Down
4 changes: 2 additions & 2 deletions src/dodal/beamlines/i04.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
from dodal.devices.aperturescatterguard import (
ApertureScatterguard,
ApertureValue,
load_positions_from_beamline_parameters,
load_tolerances_from_beamline_params,
)
from dodal.devices.attenuator import Attenuator
from dodal.devices.backlight import Backlight
Expand Down Expand Up @@ -236,7 +236,7 @@ def aperture_scatterguard(
wait=wait_for_connection,
fake=fake_with_ophyd_sim,
loaded_positions=load_positions_from_beamline_parameters(params),
tolerances=load_tolerances_from_beamline_params(params),
tolerances=ApertureValue.tolerances_from_gda_params(params),
)


Expand Down
7 changes: 4 additions & 3 deletions src/dodal/common/beamlines/beamline_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
class GDABeamlineParameters:
params: dict[str, Any]

def __init__(self, params: dict[str, Any]):
self.params = params

def __repr__(self) -> str:
return repr(self.params)

Expand All @@ -23,7 +26,6 @@ def __getitem__(self, item: str):

@classmethod
def from_lines(cls, file_name: str, config_lines: list[str]):
ob = cls()
config_lines_nocomments = [line.split("#", 1)[0] for line in config_lines]
config_lines_sep_key_and_value = [
# XXX removes all whitespace instead of just trim
Expand All @@ -46,8 +48,7 @@ def from_lines(cls, file_name: str, config_lines: list[str]):
except Exception as e:
LOGGER.warning(f"Unable to parse {file_name} line {i}: {e}")

ob.params = dict(config_pairs)
return ob
return cls(params=dict(config_pairs))

@classmethod
def from_file(cls, path: str):
Expand Down
Loading

0 comments on commit 9b61f5d

Please sign in to comment.