Skip to content

Commit 2fa9143

Browse files
committed
Use new dim arg of scipp.bin
1 parent f18c3c6 commit 2fa9143

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/ess/reflectometry/corrections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def compute_reference_intensity(
5757
with the experiment parameters (such as sample rotation).
5858
Therefore it can be used to normalize sample measurements.
5959
"""
60-
b = da.bins.concat(set(da.dims) - set(da.coords["z_index"].dims)).bin(wavelength=wb)
60+
b = da.bin(wavelength=wb, dim=set(da.dims) - set(da.coords["z_index"].dims))
6161
h = b.hist()
6262
h.masks["too_few_events"] = h.data < sc.scalar(1, unit="counts")
6363
# Add a Q coordinate to each bin, the Q is not completely unique in every bin,

src/ess/reflectometry/normalize.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ def normalization_factor(
4343
4444
"""
4545
sample_q = (
46-
da.bins.concat(set(da.dims) - set(da.coords["z_index"].dims))
47-
.bin(wavelength=wbins)
46+
da.bin(wavelength=wbins, dim=set(da.dims) - set(da.coords["z_index"].dims))
4847
.bins.coords["Q"]
4948
.bins.mean()
5049
)
@@ -112,7 +111,7 @@ def reflectivity_over_q(
112111
Reflectivity as a function of Q
113112
"""
114113
return NormalizedIofQ(
115-
da.bins.concat().bin(Q=qbins) / sc.values(n.flatten(to="Q").hist(Q=qbins))
114+
da.bin(Q=qbins, dim=da.dims) / sc.values(n.hist(Q=qbins, dim=n.dims))
116115
)
117116

118117

0 commit comments

Comments
 (0)