Skip to content

Commit 26c794d

Browse files
authored
Merge pull request #2388 from silx-kit/kif-patch-6
use `unit.space` in diffmap.py
2 parents 52b0745 + e5e3619 commit 26c794d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/pyFAI/diffmap.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def makeHDF5(self, rewrite=False):
456456
maxshape=(None, None, self.nbpt_azim, self.nbpt_rad),
457457
fillvalue=numpy.nan)
458458
self.dataset.attrs["interpretation"] = "image"
459-
self.nxdata_grp.attrs["axes"] = [self.slow_motor_name, self.fast_motor_name, "azimuthal", str(self.unit).split("_")[0]]
459+
self.nxdata_grp.attrs["axes"] = [self.slow_motor_name, self.fast_motor_name, "azimuthal", self.unit.space]
460460
# Build a transposed view to display the mapping experiment
461461
layout = h5py.VirtualLayout(shape=(self.nbpt_azim, self.nbpt_rad, self.nbpt_slow, self.nbpt_fast), dtype=self.dataset.dtype)
462462
source = h5py.VirtualSource(self.dataset)
@@ -475,7 +475,7 @@ def makeHDF5(self, rewrite=False):
475475
maxshape=(None, None, self.nbpt_rad),
476476
fillvalue=numpy.nan)
477477
self.dataset.attrs["interpretation"] = "spectrum"
478-
self.nxdata_grp.attrs["axes"] = [self.slow_motor_name, self.fast_motor_name, str(self.unit).split("_")[0]]
478+
self.nxdata_grp.attrs["axes"] = [self.slow_motor_name, self.fast_motor_name, self.unit.space]
479479
# Build a transposed view to display the mapping experiment
480480
layout = h5py.VirtualLayout(shape=(self.nbpt_rad, self.nbpt_slow, self.nbpt_fast), dtype=self.dataset.dtype)
481481
source = h5py.VirtualSource(self.dataset)
@@ -531,7 +531,8 @@ def init_ai(self):
531531
chunks=(1,) + self.dataset.shape[1:],
532532
maxshape=(None,) + self.dataset.shape[1:])
533533
self.dataset_error.attrs["interpretation"] = "image" if self.dataset.ndim == 4 else "spectrum"
534-
space, unit = str(self.unit).split("_")
534+
space = self.unit.space
535+
unit = str(self.unit)[len(space)+1:]
535536
if space not in self.nxdata_grp:
536537
self.nxdata_grp[space] = tth
537538
self.nxdata_grp[space].attrs["axes"] = 3

0 commit comments

Comments
 (0)