Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Revert "Use default value instead of validator"
Browse files Browse the repository at this point in the history
This reverts commit 8e2bb73.
  • Loading branch information
olliesilvester committed Aug 22, 2024
1 parent 8e2bb73 commit f7612e0
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/hyperion/parameters/rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from dodal.devices.zebra import (
RotationDirection,
)
from pydantic import Field, root_validator
from dodal.log import LOGGER
from pydantic import Field, root_validator, validator
from scanspec.core import AxesPoints
from scanspec.core import Path as ScanPath
from scanspec.specs import Line
Expand Down Expand Up @@ -50,9 +51,6 @@ class RotationExperiment(DiffractionExperimentWithSample):
ispyb_experiment_type: IspybExperimentType = Field(
default=IspybExperimentType.ROTATION
)
selected_aperture: AperturePositionGDANames | None = Field(
default=DEFAULT_APERTURE_POSITION
)

def _detector_params(self, omega_start_deg: float):
self.det_dist_to_beam_converter_path = (
Expand Down Expand Up @@ -83,6 +81,18 @@ def _detector_params(self, omega_start_deg: float):
**optional_args,
)

@validator("selected_aperture")
def _set_default_aperture_position(
cls, aperture_position: AperturePositionGDANames | None
):
if not aperture_position:
LOGGER.warn(
f"No aperture position selected. Defaulting to {DEFAULT_APERTURE_POSITION}"
)
return DEFAULT_APERTURE_POSITION
else:
return aperture_position


class RotationScan(WithScan, RotationScanPerSweep, RotationExperiment):
@property
Expand Down

0 comments on commit f7612e0

Please sign in to comment.