@@ -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 ]
0 commit comments