Skip to content

Commit 2d2ead8

Browse files
committed
edit parsing of image paths for initial size check
1 parent 9fadae0 commit 2d2ead8

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • src/diffraction_utils

src/diffraction_utils/io.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,9 +1139,15 @@ def _parse_detector_info(self) -> detector_info:
11391139
signal_string = self.nx_entry[found_phrase].signal
11401140
if signal_string == "data":
11411141
image_shape = self.nx_entry[found_phrase][signal_string].shape[-2:]
1142-
return I07Nexus.detector_size_dict[image_shape](name=found_phrase)
1142+
return I07Nexus.detector_size_dict[image_shape](
1143+
name=found_phrase.split("_")[0]
1144+
)
11431145

1144-
image_string = str(self.nx_entry[found_phrase][signal_string][0]).split("/")[-1]
1146+
image_string = (
1147+
str(self.nx_entry[found_phrase][signal_string].nxdata[0][0])
1148+
.split("/")[-1]
1149+
.strip("'")
1150+
)
11451151
image_ends = [".tif", ".tiff"]
11461152
if any(image_string.endswith(ending) for ending in image_ends):
11471153
image_shape = np.array(
@@ -1159,7 +1165,7 @@ def _parse_detector_info(self) -> detector_info:
11591165
# image_path = self.local_image_paths[image_number]
11601166
# return np.array(PILImageModule.open(image_path))
11611167

1162-
return I07Nexus.detector_size_dict[image_shape](name=found_phrase)
1168+
return I07Nexus.detector_size_dict[image_shape](name=found_phrase.split("_")[0])
11631169

11641170
def _parse_default_axis_type(self) -> str:
11651171
"""

0 commit comments

Comments
 (0)