Skip to content

Commit 0eea4e7

Browse files
committed
fix: create new parameter
1 parent f96d020 commit 0eea4e7

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/ess/amor/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
NeXusDetectorName,
1515
RunType,
1616
SamplePosition,
17+
BeamDivergenceLimits,
1718
)
1819
from . import conversions, data, load, orso, resolution, utils
1920
from .instrument_view import instrument_view
@@ -64,6 +65,7 @@ def default_parameters() -> dict:
6465
NeXusDetectorName[RunType]: "detector",
6566
ChopperPhase[RunType]: sc.scalar(-5.0, unit="deg"),
6667
ChopperFrequency[RunType]: sc.scalar(8.333, unit="Hz"),
68+
BeamDivergenceLimits: (sc.scalar(-0.7, unit='deg'), sc.scalar(0.7, unit='deg')),
6769
}
6870

6971

src/ess/reflectometry/conversions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from scippneutron.conversion.graph import beamline, tof
88

99
from .types import (
10+
BeamDivergenceLimits,
1011
DataWithScatteringCoordinates,
1112
Gravity,
1213
IncidentBeam,
@@ -148,10 +149,11 @@ def add_masks(
148149
ylim: YIndexLimits,
149150
wb: WavelengthBins,
150151
zlim: ZIndexLimits,
152+
bdlim: BeamDivergenceLimits,
151153
) -> MaskedData[RunType]:
152-
da.masks["beam_divergence_too_large"] = sc.abs(
153-
da.coords["angle_from_center_of_beam"]
154-
) > sc.scalar(0.7, unit='deg')
154+
da.masks["beam_divergence_too_large"] = (
155+
da.coords["angle_from_center_of_beam"] < bdlim[0]
156+
) | (da.coords["angle_from_center_of_beam"] > bdlim[1])
155157
da.masks["y_index_range"] = (da.coords["y_index"] < ylim[0]) | (
156158
da.coords["y_index"] > ylim[1]
157159
)

src/ess/reflectometry/types.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,9 @@ class SampleSize(sciline.Scope[RunType, sc.Variable], sc.Variable):
124124
"""Limit of the (logical) 'z' detector pixel index"""
125125

126126

127+
BeamDivergenceLimits = NewType("BeamDivergenceLimits", tuple[sc.Variable, sc.Variable])
128+
"""Limit of the beam divergence"""
129+
130+
127131
ReferenceFilePath = NewType("ReferenceFilePath", str)
128132
"""Path to the cached normalization matrix"""

0 commit comments

Comments
 (0)