sigpyproc.core.rfi#
RFI masking functions.
This module contains functions for masking RFI.
Classes
Class to handle RFI masking. |
Functions
Calculate the mask of an array using the double MAD (Modified z-score). |
|
Calculate the mask of an array using the IQRM (Interquartile Range Method). |
- class sigpyproc.core.rfi.RFIMask(threshold, header, chan_mean, chan_var, chan_skew, chan_kurt, chan_maxima, chan_minima, chan_mask=NOTHING, user_mask=NOTHING, stats_mask=NOTHING, custom_mask=NOTHING)[source]#
Bases:
objectClass to handle RFI masking.
- Parameters:
- threshold
float Threshold for the mask.
- header
Header Header object containing the observation metadata.
- chan_mean
ndarray Mean of each channel.
- chan_var
ndarray Variance of each channel.
- chan_skew
ndarray Skewness of each channel.
- chan_kurt
ndarray Kurtosis of each channel.
- chan_maxima
ndarray Maximum of each channel.
- chan_minima
ndarray Minimum of each channel.
- chan_mask
ndarray, optional Final mask of the channels, by default None.
- user_mask
ndarray, optional User-defined mask, by default None.
- stats_mask
ndarray, optional Mask calculated using channel statistics, by default None.
- custom_mask
ndarray, optional Custom mask, by default None.
- threshold
- Attributes:
- threshold
- header
- chan_mean
- chan_var
- chan_skew
- chan_kurt
- chan_maxima
- chan_minima
- chan_mask
- user_mask
- stats_mask
- custom_mask
num_maskedGet the number of masked channels.
masked_fractionGet the fraction of channels masked.
Methods
apply_funcn(custom_funcn)Apply a custom function to the existing mask.
apply_mask(freq_mask)Apply a frequency range mask.
apply_method([method])Apply a mask method using channel statistics.
from_file(filename)Load a mask from a HDF5 file.
plot([figsize, dpi])Plot the mask.
to_file([filename])Write the mask to a HDF5 file.
- threshold#
- header#
- chan_mean#
- chan_var#
- chan_skew#
- chan_kurt#
- chan_maxima#
- chan_minima#
- chan_mask#
- user_mask#
- stats_mask#
- custom_mask#
- property masked_fraction#
Get the fraction of channels masked.
- Returns:
floatFraction of channels masked.
- apply_method(method='mad')[source]#
Apply a mask method using channel statistics.
- Parameters:
- method{‘iqrm’, ‘mad’}, optional
Method to apply, by default ‘mad’.
- Raises:
ValueErrorIf the
methodis not supported.
- apply_funcn(custom_funcn)[source]#
Apply a custom function to the existing mask.
- Parameters:
- Raises:
ValueErrorIf the
custom_funcnis not callable.
- sigpyproc.core.rfi.double_mad_mask(array, threshold=3)[source]#
Calculate the mask of an array using the double MAD (Modified z-score).
- Parameters:
- Returns:
ndarrayThe mask for the array.
- Raises:
ValueErrorIf the
thresholdis not positive.
- sigpyproc.core.rfi.iqrm_mask(array, threshold=3, radius=5)[source]#
Calculate the mask of an array using the IQRM (Interquartile Range Method).
- Parameters:
- Returns:
ndarrayThe mask for the array.
- Raises:
ValueErrorIf the
thresholdis not positive.