26
26
27
27
__author__ = "Jérôme Kieffer"
28
28
__license__ = "MIT"
29
- __copyright__ = "2020, ESRF"
29
+ __copyright__ = "2020-2024 , ESRF"
30
30
__date__ = "05/12/2024"
31
31
32
32
import io
@@ -91,10 +91,14 @@ def extract_averaged(filename):
91
91
results ["h5path" ] = entry_grp .name
92
92
default = entry_grp .attrs ["default" ]
93
93
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 )
95
96
nxdata_grp = nxsr .h5 [default ]
96
97
signal = nxdata_grp .attrs ["signal" ]
97
98
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 )
98
102
results ["I" ] = nxdata_grp [signal ][()]
99
103
results ["q" ] = nxdata_grp [axis ][()]
100
104
results ["std" ] = nxdata_grp ["errors" ][()]
@@ -105,15 +109,12 @@ def extract_averaged(filename):
105
109
results ["geometry" ] = json .loads (
106
110
integration_grp ["configuration/data" ][()]
107
111
)
108
- results ["polarization" ] = integration_grp [
109
- "configuration/polarization_factor"
110
- ][()]
112
+ results ["polarization" ] = integration_grp ["configuration/polarization_factor" ][()]
111
113
112
114
instrument_grps = nxsr .get_class (entry_grp , class_type = "NXinstrument" )
113
115
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 ]
117
118
results ["mask" ] = detector_grp ["pixel_mask" ].attrs ["filename" ]
118
119
sample_grp = nxsr .get_class (entry_grp , class_type = "NXsample" )[0 ]
119
120
results ["sample" ] = posixpath .split (sample_grp .name )[- 1 ]
0 commit comments