Skip to content

Commit c925658

Browse files
committed
Pass around a different dcg tag for tomo multigrid
1 parent 29c393f commit c925658

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/murfey/client/contexts/tomo.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def __init__(
9393
self._data_collection_stash: list = []
9494
self._processing_job_stash: dict = {}
9595
self._lock: RLock = RLock()
96+
self._group_tag: str = str(self._basepath)
9697

9798
def register_tomography_data_collections(
9899
self,
@@ -116,7 +117,13 @@ def register_tomography_data_collections(
116117
/ self._basepath.name.split("_")[-1]
117118
)
118119
if not metadata_source.exists() and multigrid_metadata_source.exists():
120+
# If the multigrid path exists, tags need to replace the last _ with /
119121
metadata_source = multigrid_metadata_source
122+
self._group_tag = str(
123+
self._basepath.parent
124+
/ "_".join(self._basepath.name.split("_")[:-1])
125+
/ self._basepath.name.split("_")[-1]
126+
)
120127
ensure_dcg_exists(
121128
collection_type="tomo",
122129
metadata_source=metadata_source,
@@ -133,7 +140,7 @@ def register_tomography_data_collections(
133140
"acquisition_software": self._acquisition_software,
134141
"image_directory": image_directory,
135142
"data_collection_tag": tilt_series,
136-
"source": str(self._basepath),
143+
"source": self._group_tag,
137144
"tag": tilt_series,
138145
}
139146
if (
@@ -186,7 +193,7 @@ def register_tomography_data_collections(
186193
session_id=environment.murfey_session,
187194
data={
188195
"tag": tilt_series,
189-
"source": str(self._basepath),
196+
"source": self._group_tag,
190197
"recipe": recipe,
191198
"experiment_type": "tomography",
192199
},
@@ -398,7 +405,7 @@ def _add_tilt(
398405
"voltage": self.data_collection_parameters.get("voltage", 300),
399406
"eer_fractionation_file": eer_fractionation_file,
400407
"tag": tilt_series,
401-
"group_tag": str(self._basepath),
408+
"group_tag": self._group_tag,
402409
}
403410
capture_post(
404411
base_url=str(environment.url.geturl()),
@@ -615,7 +622,7 @@ def gather_metadata(
615622
environment.dose_per_frame if environment else None
616623
)
617624
mdoc_metadata["source"] = str(self._basepath)
618-
mdoc_metadata["tag"] = str(self._basepath)
625+
mdoc_metadata["tag"] = self._group_tag
619626
mdoc_metadata["tilt_series_tag"] = metadata_file.stem
620627
mdoc_metadata["exposure_time"] = float(mdoc_data_block["ExposureTime"])
621628
slit_width = mdoc_data_block["FilterSlitAndLoss"][0]

src/murfey/client/multigrid_control.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ def _start_dc(self, metadata_json):
520520
k: None if v == "None" else v for k, v in metadata_json.items()
521521
}
522522
if isinstance(context, TomographyContext):
523-
source = Path(metadata_json["source"])
524523
context.register_tomography_data_collections(
525524
file_extension=metadata_json["file_extension"],
526525
image_directory=str(self._environment.default_destinations[source]),
@@ -565,7 +564,7 @@ def _start_dc(self, metadata_json):
565564
instrument_name=self._environment.instrument_name,
566565
visit_name=self._environment.visit,
567566
session_id=self._environment.murfey_session,
568-
data={"rsync_source": str(source)},
567+
data={"rsync_source": metadata_json.get("tag", "")},
569568
)
570569
log.info("Tomography processing flushed")
571570

0 commit comments

Comments
 (0)