Skip to content
Merged
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
9 changes: 8 additions & 1 deletion src/murfey/client/contexts/spa_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@
windows_path = data["EpuSessionXml"]["Samples"]["_items"]["SampleXml"][0][
"AtlasId"
]["#text"]
logger.info(f"Windows path to atlas metadata found: {windows_path}")

Check warning on line 116 in src/murfey/client/contexts/spa_metadata.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/contexts/spa_metadata.py#L116

Added line #L116 was not covered by tests
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")

Check warning on line 119 in src/murfey/client/contexts/spa_metadata.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/contexts/spa_metadata.py#L119

Added line #L119 was not covered by tests

source = _get_source(transferred_file, environment)
if not source:
Expand All @@ -125,9 +127,13 @@

source_visit_dir = source.parent

logger.info(

Check warning on line 130 in src/murfey/client/contexts/spa_metadata.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/contexts/spa_metadata.py#L130

Added line #L130 was not covered by tests
f"Looking for atlas XML file in metadata directory {str((source_visit_dir / partial_path).parent)}"
)
atlas_xml_path = list(
(source_visit_dir / partial_path).parent.glob("Atlas_*.xml")
)[0]
logger.info(f"Atlas XML path {str(atlas_xml_path)} found")

Check warning on line 136 in src/murfey/client/contexts/spa_metadata.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/contexts/spa_metadata.py#L136

Added line #L136 was not covered by tests
with open(atlas_xml_path, "rb") as atlas_xml:
atlas_xml_data = xmltodict.parse(atlas_xml)
atlas_original_pixel_size = atlas_xml_data["MicroscopeImage"][
Expand All @@ -136,14 +142,15 @@

# need to calculate the pixel size of the downscaled image
atlas_pixel_size = atlas_original_pixel_size * 7.8
logger.info(f"Atlas image pixel size determined to be {atlas_pixel_size}")

Check warning on line 145 in src/murfey/client/contexts/spa_metadata.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/contexts/spa_metadata.py#L145

Added line #L145 was not covered by tests

sample = None
for p in partial_path.split("/"):
if p.startswith("Sample"):
sample = int(p.replace("Sample", ""))
break
else:
logger.warning(f"Sample could not be indetified for {transferred_file}")
logger.warning(f"Sample could not be identified for {transferred_file}")

Check warning on line 153 in src/murfey/client/contexts/spa_metadata.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/contexts/spa_metadata.py#L153

Added line #L153 was not covered by tests
return
if source:
environment.samples[source] = SampleInfo(
Expand Down
Loading