check_edge_with_box¶
- sofia_redux.toolkit.resampling.check_edge_with_box(coordinates, reference, mask, threshold)[source]¶
Defines a hyperrectangle edge around a coordinate distribution.
Given a distribution (\(X\)) of \(N\) samples in \(K\) dimensions, the center of mass for dimension \(k\) is:
\[\bar{X}_{k} = \frac{1}{N} \sum_{i=1}^{N}{X_{ik}}\]The hypercube center is at \(\bar{X}\) and its width in each dimension \(k\) is \(2\beta_k\) where \(\beta = 1 - \text{threshold}\). Note that the resampling algorithm scales all coordinates to a window parameter such that \(|X_k| \leq 1\), and the
threshold
parameter therefore defines a fraction of the window in the range \(0 < \text{threshold} < 1\). If threshold[k] = 0 or 1, then no edge will be defined for dimension \(k\).If this definition the “edge” for dimension \(k\) is at \(\bar{X}_k \pm \beta_k\) and
reference
(\(X_{ref}\)) is considered inside the edge if:\[| \bar{X}_k - X_{ref, k} | \leq \beta_k, \, \forall k\]- Parameters:
- coordinatesnumpy.ndarray (n_dimensions, n_samples)
The coordinates of the sample distribution.
- referencenumpy.ndarray (n_dimensions,)
The reference coordinate.
- masknumpy.ndarray of bool (n_samples,)
A mask where
False
values exclude the corresponding sample from the center-of-mass calculation.- thresholdnumpy.ndarray (n_dimensions,)
Defines the half-width dimensions (1 - threshold) of the hyperrectangle centered on the coordinate center of mass in units of the resampling window parameter. Must be in the range 0 < threshold < 1.
- Returns: