check_edge_with_range

sofia_redux.toolkit.resampling.check_edge_with_range(coordinates, reference, mask, threshold)[source]

Defines an edge based on the range of coordinates in each dimension.

Given a distribution of sample coordinates (\(X\)), and a reference position (\(X_{ref}\)) in \(K\) dimensions, check for each dimension \(k\):

\[\{-\beta_k, \beta_k\} \in [min(X_k - X_{ref, k}), max(X_k - X_{ref, k})] , \, \forall k\]

where \(\beta = 1 - \text{threshold}\). In order words, in each dimension \(k\), there must be at least one member of \(X_k\) at a distance of \(\beta_k\) from \(X_{ref, k}\) for both the positive and negative directions along \(k\).

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 theshold > 1, then no check will be performed for dimension \(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 range check.

thresholdnumpy.ndarray (n_dimensions,)

Defines the threshold. Must be in the range 0 < threshold < 1.

Returns:
insidebool

True if reference is inside the distribution “edge” and False otherwise.