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

Commit

Permalink
Move Orientation to data_model
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicOram committed Aug 13, 2024
1 parent a596328 commit a179086
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
DataCollectionGridInfo,
DataCollectionInfo,
DataCollectionPositionInfo,
Orientation,
ScanDataInfo,
)
from hyperion.external_interaction.ispyb.ispyb_dataclass import Orientation
from hyperion.external_interaction.ispyb.ispyb_store import (
IspybIds,
StoreInIspyb,
Expand Down
6 changes: 5 additions & 1 deletion src/hyperion/external_interaction/ispyb/data_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from dataclasses import asdict, dataclass
from enum import Enum
from typing import Optional

from hyperion.external_interaction.ispyb.ispyb_dataclass import Orientation

class Orientation(Enum):
HORIZONTAL = "horizontal"
VERTICAL = "vertical"


@dataclass()
Expand Down
22 changes: 0 additions & 22 deletions src/hyperion/external_interaction/ispyb/ispyb_dataclass.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
)
from hyperion.external_interaction.ispyb.data_model import (
DataCollectionGridInfo,
Orientation,
ScanDataInfo,
)
from hyperion.external_interaction.ispyb.ispyb_dataclass import Orientation
from hyperion.external_interaction.ispyb.ispyb_store import (
IspybIds,
StoreInIspyb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
from hyperion.external_interaction.callbacks.xray_centre.ispyb_mapping import (
construct_comment_for_gridscan,
)
from hyperion.external_interaction.ispyb.data_model import DataCollectionGridInfo
from hyperion.external_interaction.ispyb.ispyb_dataclass import Orientation
from hyperion.external_interaction.ispyb.data_model import (
DataCollectionGridInfo,
Orientation,
)
from hyperion.parameters.gridscan import ThreeDGridScan

from ...conftest import (
Expand All @@ -28,25 +30,22 @@ def test_ispyb_deposition_rounds_position_to_int(
mock_ispyb_conn: MagicMock,
dummy_params,
):
assert (
construct_comment_for_gridscan(
DataCollectionGridInfo(
0.1,
0.1,
40,
20,
1.25,
1.25,
0.01, # type: ignore
100,
Orientation.HORIZONTAL,
True, # type: ignore
),
)
== (
"Hyperion: Xray centring - Diffraction grid scan of 40 by 20 images "
"in 100.0 um by 100.0 um steps. Top left (px): [0,100], bottom right (px): [3200,1700]."
)
assert construct_comment_for_gridscan(
DataCollectionGridInfo(
0.1,
0.1,
40,
20,
1.25,
1.25,
0.01, # type: ignore
100,
Orientation.HORIZONTAL,
True, # type: ignore
),
) == (
"Hyperion: Xray centring - Diffraction grid scan of 40 by 20 images "
"in 100.0 um by 100.0 um steps. Top left (px): [0,100], bottom right (px): [3200,1700]."
)


Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/external_interaction/ispyb/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from hyperion.external_interaction.ispyb.data_model import (
DataCollectionGridInfo,
DataCollectionPositionInfo,
Orientation,
ScanDataInfo,
)
from hyperion.external_interaction.ispyb.ispyb_dataclass import Orientation
from hyperion.external_interaction.ispyb.ispyb_store import StoreInIspyb
from hyperion.parameters.constants import CONST
from hyperion.parameters.gridscan import ThreeDGridScan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
DataCollectionGroupInfo,
DataCollectionInfo,
DataCollectionPositionInfo,
Orientation,
ScanDataInfo,
)
from hyperion.external_interaction.ispyb.ispyb_dataclass import Orientation
from hyperion.external_interaction.ispyb.ispyb_store import (
IspybIds,
StoreInIspyb,
Expand Down

0 comments on commit a179086

Please sign in to comment.