77import scippneutron as scn
88
99from ..logging import get_logger
10- from ..uncertainty import alpha_ratio
10+ from ..uncertainty import variance_normalized_signal_over_monitor
1111
1212
1313def solid_angle_of_rectangular_pixels (data : sc .DataArray , pixel_width : sc .Variable ,
@@ -80,32 +80,33 @@ def transmission_fraction(data_monitors: Dict[str, sc.DataArray],
8080
8181def _verify_normalization_alpha (numerator : sc .DataArray ,
8282 denominator : sc .DataArray ,
83- alpha_threshold : float = 0.1 ):
83+ signal_over_monitor_threshold : float = 0.1 ):
8484 """
8585 Verify that the ratio of sample detector counts to monitor counts is small, so
8686 we can safely drop the variances of the monitor to avoid broadcasting issues.
8787 See Heybrock et al. (2023).
8888 """
89- alpha = alpha_ratio (numerator , denominator )
90- if alpha > 0.25 * alpha_threshold :
89+ alpha = variance_normalized_signal_over_monitor (numerator , denominator )
90+ if alpha > 0.25 * signal_over_monitor_threshold :
9191 logger = get_logger ('sans' )
9292 logger .warning (
93- f'alpha = { alpha } is close to the specified threshold of '
94- f'{ alpha_threshold } . This means we are close to the regime where it is no '
95- 'longer safe to drop the variances of the normalization term.' )
96- if alpha > alpha_threshold :
93+ f'signal_over_monitor = { alpha } is close to the specified threshold of '
94+ f'{ signal_over_monitor_threshold } . This means we are close to the regime '
95+ 'where it is no longer safe to drop the variances of the normalization '
96+ 'term.' )
97+ if alpha > signal_over_monitor_threshold :
9798 raise ValueError (
98- f'alpha = { alpha } > { alpha_threshold } ! This means that the ratio of '
99- 'detector counts to monitor counts is too high, and the variances of the '
100- 'monitor data cannot be safely dropped.' )
99+ f'signal_over_monitor = { alpha } > { signal_over_monitor_threshold } ! '
100+ 'This means that the ratio of detector counts to monitor counts is too '
101+ 'high, and the variances of the monitor data cannot be safely dropped.' )
101102
102103
103104def iofq_denominator (data : sc .DataArray ,
104105 data_transmission_monitor : sc .DataArray ,
105106 direct_incident_monitor : sc .DataArray ,
106107 direct_transmission_monitor : sc .DataArray ,
107108 direct_beam : Optional [sc .DataArray ] = None ,
108- alpha_threshold : float = 0.1 ) -> sc .DataArray :
109+ signal_over_monitor_threshold : float = 0.1 ) -> sc .DataArray :
109110 """
110111 Compute the denominator term for the I(Q) normalization. This is basically:
111112 ``solid_angle * direct_beam * data_transmission_monitor * direct_incident_monitor / direct_transmission_monitor``
@@ -131,7 +132,7 @@ def iofq_denominator(data: sc.DataArray,
131132 The transmission monitor counts from the direct run (depends on wavelength).
132133 direct_beam:
133134 The DataArray containing the direct beam function (depends on wavelength).
134- alpha_threshold :
135+ signal_over_monitor_threshold :
135136 The threshold for the ratio of detector counts to monitor counts above which
136137 an error is raised because it is not safe to drop the variances of the monitor.
137138
@@ -153,7 +154,7 @@ def iofq_denominator(data: sc.DataArray,
153154 _verify_normalization_alpha (
154155 numerator = data .hist (wavelength = denominator .coords ['wavelength' ]),
155156 denominator = denominator ,
156- alpha_threshold = alpha_threshold )
157+ signal_over_monitor_threshold = signal_over_monitor_threshold )
157158
158159 solid_angle = solid_angle_of_rectangular_pixels (
159160 data ,
0 commit comments