Skip to content

Commit ec4172e

Browse files
authored
Merge pull request #136 from scipp/fix-figures
fix: correct reflectivity in figures
2 parents 2706ec5 + c2feaf2 commit ec4172e

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/ess/reflectometry/figures.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
import plopp as pp
66
import scipp as sc
77

8-
from ess.reflectometry.types import (
8+
from .types import (
99
QBins,
10+
QThetaFigure,
11+
ReducibleData,
12+
Reference,
13+
ReflectivityDiagnosticsView,
1014
ReflectivityOverQ,
1115
ReflectivityOverZW,
1216
SampleRun,
13-
)
14-
15-
from .types import (
16-
QThetaFigure,
17-
ReflectivityDiagnosticsView,
1817
ThetaBins,
18+
WavelengthBins,
1919
WavelengthThetaFigure,
2020
WavelengthZIndexFigure,
2121
)
@@ -268,18 +268,25 @@ def wavelength_z_figure(
268268

269269

270270
def wavelength_theta_diagnostic_figure(
271-
da: ReflectivityOverZW,
271+
da: ReducibleData[SampleRun],
272+
ref: Reference,
273+
wbins: WavelengthBins,
272274
thbins: ThetaBins[SampleRun],
273275
) -> WavelengthThetaFigure:
274-
return wavelength_theta_figure(da, theta_bins=thbins)
276+
s = da.hist(wavelength=wbins, theta=thbins)
277+
r = ref.hist(theta=s.coords['theta'], wavelength=s.coords['wavelength']).data
278+
return wavelength_theta_figure(s / r)
275279

276280

277281
def q_theta_diagnostic_figure(
278-
da: ReflectivityOverZW,
282+
da: ReducibleData[SampleRun],
283+
ref: Reference,
279284
thbins: ThetaBins[SampleRun],
280285
qbins: QBins,
281286
) -> QThetaFigure:
282-
return q_theta_figure(da, q_bins=qbins, theta_bins=thbins)
287+
s = da.hist(theta=thbins, Q=qbins)
288+
r = ref.hist(theta=s.coords['theta'], Q=s.coords['Q']).data
289+
return q_theta_figure(s / r)
283290

284291

285292
def wavelength_z_diagnostic_figure(

0 commit comments

Comments
 (0)