mangadap.util.filter module
A set of functions used to filter arrays.
Copyright © 2019, SDSS-IV/MaNGA Pipeline Group
- class mangadap.util.filter.BoxcarFilter(boxcar, lo=None, hi=None, niter=None, y=None, wgt=None, mask=None, local_sigma=None)[source]
Bases:
object
- _interpolate()[source]
Interpolate the smoothed image across the masked regions. Leading and trailing masked regions of each row are set to the first and last unmasked value, respectively.
interpolate both the smoothed data and the sigma
- property mask
- mangadap.util.filter.boxcar_smooth_vector(x, boxcar, mask=None, lo=None, hi=None, niter=None, return_mask=False)[source]
- Boxcar smooth an input vector.
Ignores masked pixels.
Allows for iterative positive and negative outliers.
Can return the mask separately from the smoothed vector.
- mangadap.util.filter.build_smoothing_mask(x, pix_buffer, default=None, mask_x=None)[source]
Construct a mask for the provided vector that masks the first and last pix_buffer pixels in the coordinate vector.
The mask is instantiated as fully unmasked, unless a default mask is provided.
To mask specified ranges in x, provide mask_x with a shape \(N_{\rm mask}\times 2\) where each mask is defined by the starting and ending value of x to exclude.
- mangadap.util.filter.high_pass_filter(flux, dw=0, k=None, Dw=None)[source]
Pulled from FIREFLY’s hpf() function and edited on 17 Nov 2016.
Apply a high-pass filter to the input vector.
- mangadap.util.filter.interpolate_masked_vector(y, quiet=True, extrap_with_median=False)[source]
Interpolate over the masked pixels in an input vector using linear interpolation.
- Parameters
y (numpy.ma.MaskedArray) – Vector to interpolate.
quiet (
bool
, optional) – Suppress standard output (default is True).extrap_with_median (
bool
, optional) – Instead of linear extrapolation, use the median of the interpolated vector. Defaults to linear extrapolation.
- Returns
Returns the interpolated, unmasked vector.
- Return type
numpy.ndarray
- mangadap.util.filter.off_diagonal_identity(size, win, return_sparse=False)[source]
Construct a matrix with ones within a window along the diagonal.
- Parameters
size (int) – Size for the square matrix; i.e., \(N\) for the \(N\timesN\) matrix.
win (int) – Number of ones in each row along the diagonal.
- Raises
ValueError – Raised if the window is larger than 2*size-1.