From 2161fcedcfa7c29a058793f48a4e93419146daf2 Mon Sep 17 00:00:00 2001 From: Jeff Krzywon Date: Thu, 5 Nov 2026 06:05:58 -0500 Subject: [PATCH 1/5] Skip any unexpected children within the NXdata to ignore extra information --- sasdata/data_io/importers/import_hdf5.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sasdata/data_io/importers/import_hdf5.py b/sasdata/data_io/importers/import_hdf5.py index 6fb1ccf46..3fc5f3543 100644 --- a/sasdata/data_io/importers/import_hdf5.py +++ b/sasdata/data_io/importers/import_hdf5.py @@ -86,6 +86,10 @@ def connected_data(node: SASDataGroup, name_prefix="", metadata=None) -> dict[st for name in node.children: child = node.children[name] + if hasattr(child, "children"): + # Some files include other metadata that gives various reduction steps within the data - Ignore + continue + if "units" in child.attributes and child.attributes["units"]: units = parse(child.attributes["units"]) else: From e50badc3349b8855c8473b46cd8dc92935a3818a Mon Sep 17 00:00:00 2001 From: Jeff Krzywon Date: Thu, 5 Nov 2026 06:06:45 -0500 Subject: [PATCH 2/5] Apply resolutions as an uncertainty to the Q data --- sasdata/data_io/importers/import_hdf5.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sasdata/data_io/importers/import_hdf5.py b/sasdata/data_io/importers/import_hdf5.py index 3fc5f3543..1499f6c25 100644 --- a/sasdata/data_io/importers/import_hdf5.py +++ b/sasdata/data_io/importers/import_hdf5.py @@ -105,6 +105,10 @@ def connected_data(node: SASDataGroup, name_prefix="", metadata=None) -> dict[st uncertainty_name = child.attributes["uncertainties"] uncertainty_map[name] = uncertainty_name uncertainties.add(uncertainty_name) + if "resolutions" in child.attributes: + uncertainty_name = child.attributes["resolutions"] + uncertainty_map[name] = uncertainty_name + uncertainties.add(uncertainty_name) entries[name] = quantity From f1c1ddfc860b77ee0876167c7fcb9a1431e26edd Mon Sep 17 00:00:00 2001 From: Jeff Krzywon Date: Thu, 5 Nov 2026 08:50:22 -0500 Subject: [PATCH 3/5] Check for empty key lists for the source --- sasdata/data_io/importers/import_hdf5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sasdata/data_io/importers/import_hdf5.py b/sasdata/data_io/importers/import_hdf5.py index 1499f6c25..a59c09aa2 100644 --- a/sasdata/data_io/importers/import_hdf5.py +++ b/sasdata/data_io/importers/import_hdf5.py @@ -313,7 +313,7 @@ def parse_instrument(node : HDF5Group) -> Instrument: detector = [parse_detector(node[p]) for p in keys] # Empty list of keys will give an empty collimations list keys = find_canSAS_key(node, "SASsource") - source = parse_source(node[keys[0]]) if keys is not None else None + source = parse_source(node[keys[0]]) if keys is not None and any(keys) else None return Instrument( collimations=collimations, From d800bc9704b1cea7043106b56d880cf33097147a Mon Sep 17 00:00:00 2001 From: Jeff Krzywon Date: Thu, 5 Nov 2026 09:00:14 -0500 Subject: [PATCH 4/5] Ensure resolutions are loaded in the form of dQ and not Qdev (or other) --- sasdata/data_io/importers/import_hdf5.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sasdata/data_io/importers/import_hdf5.py b/sasdata/data_io/importers/import_hdf5.py index a59c09aa2..cc885f574 100644 --- a/sasdata/data_io/importers/import_hdf5.py +++ b/sasdata/data_io/importers/import_hdf5.py @@ -106,9 +106,8 @@ def connected_data(node: SASDataGroup, name_prefix="", metadata=None) -> dict[st uncertainty_map[name] = uncertainty_name uncertainties.add(uncertainty_name) if "resolutions" in child.attributes: - uncertainty_name = child.attributes["resolutions"] - uncertainty_map[name] = uncertainty_name - uncertainties.add(uncertainty_name) + resolutions_name = child.attributes["resolutions"] + resolutions.add(resolutions_name) entries[name] = quantity @@ -120,6 +119,9 @@ def connected_data(node: SASDataGroup, name_prefix="", metadata=None) -> dict[st uncertainty = entries[uncertainty_map[name]] new_entry = entry.with_standard_error(uncertainty) output[name] = new_entry + elif name in resolutions and not str(name).startswith('dQ'): + # Resolutions are sometimes labeled as Qdev - set to dQ in this case + output['dQ'] = entry else: output[name] = entry From 8eb70c2145607d84e30b52aab3c4769f8a95d757 Mon Sep 17 00:00:00 2001 From: Jeff Krzywon Date: Thu, 5 Nov 2026 09:24:31 -0500 Subject: [PATCH 5/5] Include resolutions definition which was missed in a previous commit --- sasdata/data_io/importers/import_hdf5.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sasdata/data_io/importers/import_hdf5.py b/sasdata/data_io/importers/import_hdf5.py index cc885f574..4968b4721 100644 --- a/sasdata/data_io/importers/import_hdf5.py +++ b/sasdata/data_io/importers/import_hdf5.py @@ -81,6 +81,7 @@ def connected_data(node: SASDataGroup, name_prefix="", metadata=None) -> dict[st uncertainty_map = {} uncertainties = set() + resolutions = set() entries = {} for name in node.children: