Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/murfey/client/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,18 @@ def ensure_dcg_exists(
if not windows_path:
logger.warning("No atlas metadata path found")
return None
visit_index = windows_path.split("\\").index(environment.visit)
partial_path = "/".join(windows_path.split("\\")[visit_index + 1 :])
logger.info("Partial Linux path successfully constructed from Windows path")
if environment.visit in windows_path.split("\\"):
# Case of atlas in the correct location
visit_index = windows_path.split("\\").index(environment.visit)
partial_path = "/".join(windows_path.split("\\")[visit_index + 1 :])
logger.info(
f"Partial Linux path successfully constructed from Windows path: {partial_path}"
)
else:
# Atlas not in visit, so come up with where it should have been
# Assumes /structure/to/Supervisor/Sample/Atlas/Atlas.dm
partial_path = "/".join(windows_path.split("\\")[-4:])
logger.info(f"Partial Linux path estimated: {partial_path}")

logger.info(
f"Looking for atlas XML file in metadata directory {str((source_visit_dir / partial_path).parent)}"
Expand Down
15 changes: 9 additions & 6 deletions src/murfey/client/multigrid_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,15 @@ def _start_dc(self, metadata_json):
+ "/".join(source.parts[-2:])
)
metadata_source = Path(metadata_source_as_str.replace("//", "/"))
ensure_dcg_exists(
collection_type="spa",
metadata_source=metadata_source,
environment=self._environment,
token=self.token,
)
try:
ensure_dcg_exists(
collection_type="spa",
metadata_source=metadata_source,
environment=self._environment,
token=self.token,
)
except Exception as e:
log.error(f"Failed to register data collection group: {e}")
data = {
"voltage": metadata_json["voltage"],
"pixel_size_on_image": metadata_json["pixel_size_on_image"],
Expand Down