Skip to content

Commit 759fdac

Browse files
committed
check for bin edge coord when masking to avoid having masks on edges
1 parent 9cbe154 commit 759fdac

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/ess/powder/masking.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,15 @@ def apply_masks(
5858
"two_theta": two_theta_mask_func,
5959
}.items():
6060
if mask is not None:
61-
if dim in out.bins.coords:
61+
if (out.bins is not None) and (dim in out.bins.coords):
6262
out.bins.masks[dim] = mask(out.bins.coords[dim])
6363
else:
64-
out.masks[dim] = mask(out.coords[dim])
64+
coord = (
65+
sc.midpoints(out.coords[dim])
66+
if out.coords.is_edges(dim)
67+
else out.coords[dim]
68+
)
69+
out.masks[dim] = mask(coord)
6570

6671
return MaskedData[RunType](out)
6772

0 commit comments

Comments
 (0)