Skip to content

Commit

Permalink
Remove references to visit_directory
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicOram committed Sep 15, 2024
1 parent fc4a6dd commit 6011f53
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import annotations

import re

from mx_bluesky.hyperion.external_interaction.ispyb.data_model import (
DataCollectionGroupInfo,
DataCollectionInfo,
Expand All @@ -11,7 +9,6 @@
I03_EIGER_DETECTOR,
)
from mx_bluesky.hyperion.external_interaction.ispyb.ispyb_utils import (
VISIT_PATH_REGEX,
get_current_time_string,
)
from mx_bluesky.hyperion.parameters.components import DiffractionExperimentWithSample
Expand Down Expand Up @@ -63,8 +60,3 @@ def get_proposal_and_session_from_visit_string(visit_string: str) -> tuple[str,
visit_parts = visit_string.split("-")
assert len(visit_parts) == 2, f"Unexpected visit string {visit_string}"
return visit_parts[0], int(visit_parts[1])


def get_visit_string_from_path(path: str | None) -> str | None:
match = re.search(VISIT_PATH_REGEX, path) if path else None
return str(match.group(1)) if match else None
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

from mx_bluesky.hyperion.parameters.constants import CONST

VISIT_PATH_REGEX = r".+/([a-zA-Z]{2}\d{4,5}-\d{1,3})(/?$)"


def get_ispyb_config():
return os.environ.get("ISPYB_CONFIG_PATH", CONST.SIM.ISPYB_CONFIG)
Expand Down
7 changes: 0 additions & 7 deletions src/mx_bluesky/hyperion/parameters/components.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import datetime
import json
from abc import abstractmethod
from collections.abc import Sequence
Expand Down Expand Up @@ -185,12 +184,6 @@ def validate_snapshot_directory(cls, values):
)
return values

@property
def visit_directory(self) -> Path:
return (
Path(CONST.I03.BASE_DATA_DIR) / str(datetime.date.today().year) / self.visit
)

@property
def num_images(self) -> int:
return 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)
from mx_bluesky.hyperion.parameters.constants import CONST

VISIT_PATH = "cm31105-4"
VISIT = "cm31105-4"

SAMPLE_ID = 231412
SAMPLE_PUCK = 50
Expand All @@ -24,7 +24,7 @@
metadata = {
"subplan_name": CONST.PLAN.ROBOT_LOAD,
"metadata": {
"visit": VISIT_PATH,
"visit": VISIT,
"sample_id": SAMPLE_ID,
"sample_puck": SAMPLE_PUCK,
"sample_pin": SAMPLE_PIN,
Expand Down
19 changes: 0 additions & 19 deletions tests/unit_tests/hyperion/external_interaction/test_ispyb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from mx_bluesky.hyperion.external_interaction.callbacks.common.ispyb_mapping import (
get_proposal_and_session_from_visit_string,
get_visit_string_from_path,
)
from mx_bluesky.hyperion.external_interaction.ispyb.ispyb_utils import (
get_current_time_string,
Expand All @@ -20,24 +19,6 @@ def test_get_current_time_string():
assert re.match(TIME_FORMAT_REGEX, current_time) is not None


@pytest.mark.parametrize(
"visit_path, expected_match",
[
("/dls/i03/data/2022/cm6477-45/", "cm6477-45"),
("/dls/i03/data/2022/cm6477-45", "cm6477-45"),
("/dls/i03/data/2022/mx54663-1/", "mx54663-1"),
("/dls/i03/data/2022/mx54663-1", "mx54663-1"),
("/dls/i03/data/2022/mx53-1/", None),
("/dls/i03/data/2022/mx53-1", None),
("/dls/i03/data/2022/mx5563-1565/", None),
("/dls/i03/data/2022/mx5563-1565", None),
],
)
def test_find_visit_in_visit_path(visit_path: str, expected_match: str):
test_visit_path = get_visit_string_from_path(visit_path)
assert test_visit_path == expected_match


@pytest.mark.parametrize(
"visit_string, expected_proposal, expected_session",
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def test_robot_load_then_centre_params():
}
params["detector_distance_mm"] = 200
test_params = RobotLoadThenCentre(**params)
assert test_params.visit_directory
assert test_params.detector_params


Expand Down

0 comments on commit 6011f53

Please sign in to comment.