Skip to content

Commit af3dd1c

Browse files
committed
Fix condition
1 parent 21b99ac commit af3dd1c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/ess/powder/correction.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,16 @@ def normalize_by_monitor_integrated(
120120
)
121121
counts.masks[uuid4().hex] = counts.data == sc.scalar(0.0, unit=counts.unit)
122122
det_coord = detector.coords[dim]
123-
edge_dims = {
124-
dim: size == det_coord.sizes[dim] + 1 for dim, size in counts.sizes.items()
125-
}
123+
edge_dims = [
124+
dim
125+
for dim, size in counts.sizes.items()
126+
if size + 1 == det_coord.sizes[dim]
127+
]
126128
if len(edge_dims) != 1:
127129
raise sc.CoordError(
128-
f"Cannot determine edges of coordinate '{dim}' in detector data."
130+
f"Cannot determine edge dimension of coordinate '{dim}'."
129131
)
130-
edge_dim = next(iter(edge_dims))
132+
edge_dim = edge_dims[0]
131133
lo = counts.assign(det_coord[edge_dim, :-1]).nanmin().data
132134
hi = counts.assign(det_coord[edge_dim, 1:]).nanmax().data
133135

0 commit comments

Comments
 (0)