Skip to content

Commit

Permalink
Merge pull request #2388 from silx-kit/kif-patch-6
Browse files Browse the repository at this point in the history
use `unit.space` in  diffmap.py
  • Loading branch information
kif authored Jan 26, 2025
2 parents 52b0745 + e5e3619 commit 26c794d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pyFAI/diffmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def makeHDF5(self, rewrite=False):
maxshape=(None, None, self.nbpt_azim, self.nbpt_rad),
fillvalue=numpy.nan)
self.dataset.attrs["interpretation"] = "image"
self.nxdata_grp.attrs["axes"] = [self.slow_motor_name, self.fast_motor_name, "azimuthal", str(self.unit).split("_")[0]]
self.nxdata_grp.attrs["axes"] = [self.slow_motor_name, self.fast_motor_name, "azimuthal", self.unit.space]
# Build a transposed view to display the mapping experiment
layout = h5py.VirtualLayout(shape=(self.nbpt_azim, self.nbpt_rad, self.nbpt_slow, self.nbpt_fast), dtype=self.dataset.dtype)
source = h5py.VirtualSource(self.dataset)
Expand All @@ -475,7 +475,7 @@ def makeHDF5(self, rewrite=False):
maxshape=(None, None, self.nbpt_rad),
fillvalue=numpy.nan)
self.dataset.attrs["interpretation"] = "spectrum"
self.nxdata_grp.attrs["axes"] = [self.slow_motor_name, self.fast_motor_name, str(self.unit).split("_")[0]]
self.nxdata_grp.attrs["axes"] = [self.slow_motor_name, self.fast_motor_name, self.unit.space]
# Build a transposed view to display the mapping experiment
layout = h5py.VirtualLayout(shape=(self.nbpt_rad, self.nbpt_slow, self.nbpt_fast), dtype=self.dataset.dtype)
source = h5py.VirtualSource(self.dataset)
Expand Down Expand Up @@ -531,7 +531,8 @@ def init_ai(self):
chunks=(1,) + self.dataset.shape[1:],
maxshape=(None,) + self.dataset.shape[1:])
self.dataset_error.attrs["interpretation"] = "image" if self.dataset.ndim == 4 else "spectrum"
space, unit = str(self.unit).split("_")
space = self.unit.space
unit = str(self.unit)[len(space)+1:]
if space not in self.nxdata_grp:
self.nxdata_grp[space] = tth
self.nxdata_grp[space].attrs["axes"] = 3
Expand Down

0 comments on commit 26c794d

Please sign in to comment.