pynrc.reduce.ref_pixels.channel_smooth_savgol

pynrc.reduce.ref_pixels.channel_smooth_savgol(im_arr, winsize=31, order=3, per_line=False, mask=None, **kwargs)[source]

Channel smoothing using savgol filter

Parameters

im_arr (ndarray) – Input array of images (intended to be a cube of output channels). Shape should either be (ny, chsize) to smooth a single channel or (nchan, ny, chsize) for multiple channels. Each image is operated on separately. If only two dimensions, then only a single input image is assumed. NaN’s will be interpolated over.

Keyword Arguments
  • winsize (int) – Size of the window filter. Should be an odd number.

  • order (int) – Order of the polynomial used to fit the samples.

  • per_line (bool) – Smooth each channel line separately with the hopes of avoiding edge discontinuities.

  • mask (bool image or None) – An image mask of pixels to ignore. Should be same size as im_arr. This can be used to mask pixels that the filter should ignore, such as stellar sources or pixel outliers. A value of True indicates that pixel should be ignored.

  • mode (str) – Must be ‘mirror’, ‘constant’, ‘nearest’, ‘wrap’ or ‘interp’. This determines the type of extension to use for the padded signal to which the filter is applied. When mode is ‘constant’, the padding value is given by cval. When the ‘interp’ mode is selected (the default), no extension is used. Instead, a degree polyorder polynomial is fit to the last window_length values of the edges, and this polynomial is used to evaluate the last window_length // 2 output values.

  • cval (float) – Value to fill past the edges of the input if mode is ‘constant’. Default is 0.0.