Skip to content

Commit a3eec1b

Browse files
committed
Fix file extraction for HPLC data
1 parent b4e3024 commit a3eec1b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/freesas/app/extract_ascii.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
__author__ = "Jérôme Kieffer"
2828
__license__ = "MIT"
29-
__copyright__ = "2020, ESRF"
29+
__copyright__ = "2020-2024, ESRF"
3030
__date__ = "05/12/2024"
3131

3232
import io
@@ -91,10 +91,14 @@ def extract_averaged(filename):
9191
results["h5path"] = entry_grp.name
9292
default = entry_grp.attrs["default"]
9393
if posixpath.split(default)[-1] == "hplc":
94-
default = posixpath.join(posixpath.split(default)[0],"result")
94+
default = posixpath.join(posixpath.split(default)[0],"results")
95+
print(default)
9596
nxdata_grp = nxsr.h5[default]
9697
signal = nxdata_grp.attrs["signal"]
9798
axis = nxdata_grp.attrs["axes"]
99+
if not isinstance(axis, (str,bytes)):
100+
logger.error(f"There are several curves if the dataset {default} from file {filename}, please use the option --all to extract them all")
101+
sys.exit(1)
98102
results["I"] = nxdata_grp[signal][()]
99103
results["q"] = nxdata_grp[axis][()]
100104
results["std"] = nxdata_grp["errors"][()]
@@ -105,15 +109,12 @@ def extract_averaged(filename):
105109
results["geometry"] = json.loads(
106110
integration_grp["configuration/data"][()]
107111
)
108-
results["polarization"] = integration_grp[
109-
"configuration/polarization_factor"
110-
][()]
112+
results["polarization"] = integration_grp["configuration/polarization_factor"][()]
111113

112114
instrument_grps = nxsr.get_class(entry_grp, class_type="NXinstrument")
113115
if instrument_grps:
114-
detector_grp = nxsr.get_class(
115-
instrument_grps[0], class_type="NXdetector"
116-
)[0]
116+
detector_grp = nxsr.get_class(instrument_grps[0],
117+
class_type="NXdetector")[0]
117118
results["mask"] = detector_grp["pixel_mask"].attrs["filename"]
118119
sample_grp = nxsr.get_class(entry_grp, class_type="NXsample")[0]
119120
results["sample"] = posixpath.split(sample_grp.name)[-1]

0 commit comments

Comments
 (0)