Skip to content

Commit f757325

Browse files
authored
hdf5_loader.py - psize is expected to be scalar but it might be a tuple
From parameter tree docs: scandata.PtyScan.psize(float, tuple) Detector pixel size Dimensions of the detector pixels (in meters) default = 0.000172 (>0.0) psize can be a tuple... perhaps for non-square pixels, I have never used it that way but some older datasets have x,y pixel size, e.g., psize=[0.000172, 0.000172] which are accepted by Ptydscan. The proposed change just (silently) uses the first element of psize.
1 parent cdf33cc commit f757325

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ptypy/experiment/hdf5_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ def _prepare_meta_info(self):
588588

589589
if None not in [self.p.recorded_psize.file, self.p.recorded_psize.key]:
590590
with h5.File(self.p.recorded_psize.file, 'r', swmr=self._is_swmr) as f:
591-
self.p.psize = float(f[self.p.recorded_psize.key][()].item() * self.p.recorded_psize.multiplier)
591+
self.p.psize = float(f[self.p.recorded_psize.key][()].item()[0] * self.p.recorded_psize.multiplier)
592592
self.info.psize = self.p.psize
593593
log(3, "loading psize={} from file".format(self.p.psize))
594594

0 commit comments

Comments
 (0)