edges_cal.xrfi.detrend_meanfilt

edges_cal.xrfi.detrend_meanfilt(data: ndarray, flags: ndarray | None = None, half_size: tuple[int | None] | None = None)[source]

Detrend array using a mean filter.

Parameters:
  • data (array) – Data to detrend. Can be an array of any number of dimensions.

  • flags (boolean array, optional) – Flags specifying data to ignore in the detrend. If not given, don’t ignore anything.

  • half_size (tuple of int/None) – The half-size of the kernel to convolve (kernel size will be 2*half_size+1). Value of zero (for any dimension) omits that axis from the kernel, effectively applying the detrending for each subarray along that axis. Value of None will effectively (but slowly) perform a median along the entire axis before running the kernel over the other axis.

Returns:

out (array) – An array containing the outlier significance metric. Same type and size as data.

Notes

This detrending is very good for data that has most of the RFI flagged already, but will perform very poorly when un-flagged RFI still exists. It is often useful to precede this with a median filter.