LinearClip

LinearClip(
    low_scale=1.0,
    low=0.0,
    upp_scale=1.0,
    upp=0.0,
    maxiters=1,
    cenfunc='median',
    nkeep=1,
    maxrej=None,
    revert_on_nkeep=True,
    grow=None,
)

Center-relative linear clipping.

Parameters

low_scale : float = 1.0

Multiplier for the per-pixel center used in the lower retained bound.

low : float = 0.0

Non-negative margin subtracted from low_scale * center.

upp_scale : float = 1.0

Multiplier for the per-pixel center used in the upper retained bound.

upp : float = 0.0

Non-negative margin added to upp_scale * center.

maxiters : int = 1

Maximum number of clipping iterations per pixel. 1 preserves the historical single-pass behavior.

cenfunc : ('median', 'lmedian', 'mean') = "median"

Center estimator used each iteration. lmedian accepts the alias lmed and uses the lower of the two middle samples for even valid counts.

nkeep : int = 1

Minimum number of unmasked values to preserve at each pixel.

maxrej : int or None = None

Maximum number of values that may be rejected at each pixel. None means no limit.

revert_on_nkeep : bool = True

If True, an iteration that would leave fewer than nkeep usable samples at a pixel is reverted in full for that pixel.

grow : float or None = None

Optional radius in pixels used to grow mask_rej spatially after rejection. Axis 0 is the stack axis and is never grown across. None disables growth and skips the extra calculation.

Attributes

Name Description
cenfunc str(object=’’) -> str
low Convert a string or number to a floating-point number, if possible.
low_scale Convert a string or number to a floating-point number, if possible.
maxiters int([x]) -> integer
nkeep int([x]) -> integer
revert_on_nkeep bool(x) -> bool
upp Convert a string or number to a floating-point number, if possible.
upp_scale Convert a string or number to a floating-point number, if possible.

Methods

Name Description
apply Apply LinearClip to an image stack.

apply

LinearClip.apply(arr, mask=None, *, validate=True)

Apply LinearClip to an image stack.

Parameters

arr : (ndarray, shape(N, *spatial))

Image stack. Inputs with more than 3 dimensions are flattened internally; output shapes match the trailing spatial dimensions of the input.

mask : ndarray of bool = None

Input mask; True means already masked. Must have the same shape as arr before any internal flattening.

validate : bool = True

If True, validate inputs before calling the kernel.

Returns

: mask_rej, std, low, upp, nit, output_flags : tuple of ndarray

Rejection mask and diagnostics from this rejection algorithm. std is the per-pixel spread used by sigma/CCD clipping and None for rejection algorithms without a spread diagnostic.