rm_lite.utils.clean =================== .. py:module:: rm_lite.utils.clean .. autoapi-nested-parse:: RM-clean utils Attributes ---------- .. autoapisummary:: rm_lite.utils.clean.DType rm_lite.utils.clean.TQDM_OUT Classes ------- .. autoapisummary:: rm_lite.utils.clean.CleanLoopResults rm_lite.utils.clean.MinorLoopArrays rm_lite.utils.clean.MinorLoopOptions rm_lite.utils.clean.MinorLoopResults rm_lite.utils.clean.RMCleanOptions rm_lite.utils.clean.RMCleanResults rm_lite.utils.clean.RMSynthArrays Functions --------- .. autoapisummary:: rm_lite.utils.clean._rmclean_nd rm_lite.utils.clean.minor_cycle rm_lite.utils.clean.minor_loop rm_lite.utils.clean.restore_fdf rm_lite.utils.clean.rmclean Module Contents --------------- .. py:class:: CleanLoopResults Bases: :py:obj:`NamedTuple` Results of the RM-CLEAN loop .. py:attribute:: clean_fdf_spectrum :type: numpy.typing.NDArray[numpy.complex128] The cleaned Faraday dispersion function cube .. py:attribute:: iter_count :type: int The number of iterations .. py:attribute:: model_fdf_spectrum :type: numpy.typing.NDArray[numpy.complex128] The clean components cube .. py:attribute:: resid_fdf_spectrum :type: numpy.typing.NDArray[numpy.complex128] The residual Faraday dispersion function cube .. py:class:: MinorLoopArrays Bases: :py:obj:`NamedTuple` Arrays for the RM-CLEAN minor loop .. py:method:: with_options(**kwargs) .. py:attribute:: peak_find_arr :type: numpy.typing.NDArray[numpy.float64] | None :value: None Peak finding array .. py:attribute:: phi_arr_radm2 :type: numpy.typing.NDArray[numpy.float64] Faraday depth array in rad/m^2 .. py:attribute:: phi_double_arr_radm2 :type: numpy.typing.NDArray[numpy.float64] Double-length Faraday depth array in rad/m^2 .. py:attribute:: resid_fdf_spectrum_mask :type: numpy.ma.MaskedArray Residual Faraday dispersion function spectrum .. py:attribute:: rmsf_fwhm :type: float FWHM of the RMSF .. py:attribute:: rmsf_spectrum :type: numpy.typing.NDArray[numpy.complex128] RMSF spectrum .. py:class:: MinorLoopOptions Bases: :py:obj:`NamedTuple` Options for the RM-CLEAN minor loop .. py:method:: with_options(**kwargs) .. py:attribute:: gain :type: float Loop gain .. py:attribute:: mask :type: float Masking threshold .. py:attribute:: max_iter :type: int Maximum number of iterations .. py:attribute:: start_iter :type: int :value: 0 Starting iteration .. py:attribute:: threshold :type: float Threshold for stopping the loop .. py:attribute:: update_mask :type: bool :value: True Update the mask after each iteration .. py:class:: MinorLoopResults Bases: :py:obj:`NamedTuple` Results of the RM-CLEAN minor loop .. py:attribute:: clean_fdf_spectrum :type: numpy.typing.NDArray[numpy.complex128] The cleaned Faraday dispersion function cube .. py:attribute:: iter_count :type: int The number of iterations .. py:attribute:: model_fdf_spectrum :type: numpy.typing.NDArray[numpy.complex128] The clean components cube .. py:attribute:: model_rmsf_spectrum :type: numpy.typing.NDArray[numpy.complex128] Model * RMSF .. py:attribute:: resid_fdf_spectrum :type: numpy.typing.NDArray[numpy.complex128] The residual Faraday dispersion function cube .. py:attribute:: resid_fdf_spectrum_mask :type: numpy.ma.MaskedArray The masked residual Faraday dispersion function cube .. py:class:: RMCleanOptions Bases: :py:obj:`NamedTuple` Options for RM-CLEAN .. py:attribute:: gain :type: float :value: 0.1 Clean loop gain .. py:attribute:: mask :type: float Masking threshold - pixels below this value are not cleaned .. py:attribute:: mask_arr :type: numpy.typing.NDArray[numpy.bool_] | None :value: None Additional mask of pixels to avoid .. py:attribute:: max_iter :type: int :value: 1000 Maximum clean iterations .. py:attribute:: threshold :type: float Cleaning threshold - stop when all pixels are below this value .. py:class:: RMCleanResults Bases: :py:obj:`NamedTuple` Results of the RM-CLEAN calculation .. py:method:: with_options(**kwargs) .. py:attribute:: clean_fdf_arr :type: numpy.typing.NDArray[numpy.complex128] The cleaned Faraday dispersion function cube .. py:attribute:: clean_iter_arr :type: numpy.typing.NDArray[numpy.int16] The number of iterations for each pixel .. py:attribute:: model_fdf_arr :type: numpy.typing.NDArray[numpy.complex128] The clean components cube .. py:attribute:: resid_fdf_arr :type: numpy.typing.NDArray[numpy.complex128] The residual Faraday dispersion function cube .. py:class:: RMSynthArrays Bases: :py:obj:`NamedTuple` Arrays for RM-synthesis .. py:attribute:: dirty_fdf_arr :type: numpy.typing.NDArray[numpy.complex128] Dirty Faraday dispersion function array .. py:attribute:: fdf_mask_arr :type: numpy.typing.NDArray[numpy.bool_] | None :value: None Mask of pixels to clean .. py:attribute:: fwhm_rmsf_arr :type: numpy.typing.NDArray[numpy.float64] FWHM of the RMSF array .. py:attribute:: phi_arr_radm2 :type: numpy.typing.NDArray[numpy.float64] Faraday depth array in rad/m^2 .. py:attribute:: phi_double_arr_radm2 :type: numpy.typing.NDArray[numpy.float64] Double-length Faraday depth array in rad/m^2 .. py:attribute:: rmsf_arr :type: numpy.typing.NDArray[numpy.complex128] RMSF array .. py:function:: _rmclean_nd(rm_synth_arrays: RMSynthArrays, clean_options: RMCleanOptions) -> RMCleanResults .. py:function:: minor_cycle(rm_synth_1d_arrays: RMSynthArrays, clean_options: RMCleanOptions) -> CleanLoopResults .. py:function:: minor_loop(minor_loop_arrays: MinorLoopArrays, minor_loop_options: MinorLoopOptions) -> MinorLoopResults .. py:function:: restore_fdf(model_fdf_spectrum: numpy.typing.NDArray[numpy.complex128], phi_double_arr_radm2: numpy.typing.NDArray[numpy.float64], fwhm_rmsf: float) -> numpy.typing.NDArray[numpy.complex128] .. py:function:: rmclean(dirty_fdf_arr: numpy.typing.NDArray[numpy.complex128], phi_arr_radm2: numpy.typing.NDArray[numpy.float64], rmsf_arr: numpy.typing.NDArray[numpy.complex128], phi_double_arr_radm2: numpy.typing.NDArray[numpy.float64], fwhm_rmsf_arr: numpy.typing.NDArray[numpy.float64], mask: float, threshold: float, max_iter: int = 1000, gain: float = 0.1, mask_arr: numpy.typing.NDArray[numpy.bool_] | None = None) -> RMCleanResults Perform RM-CLEAN on a Faraday dispersion function array. :param dirty_fdf_arr: Dirty Faraday dispersion function array :type dirty_fdf_arr: NDArray[np.complex128] :param phi_arr_radm2: Faraday depth array in rad/m^2 :type phi_arr_radm2: NDArray[np.float64] :param rmsf_arr: RMSF array :type rmsf_arr: NDArray[np.complex128] :param phi_double_arr_radm2: Double-length Faraday depth array in rad/m^2 :type phi_double_arr_radm2: NDArray[np.float64] :param fwhm_rmsf_arr: FWHM of the RMSF array :type fwhm_rmsf_arr: NDArray[np.float64] :param mask: Masking threshold - pixels below this value are not cleaned :type mask: float :param threshold: Cleaning threshold - stop when all pixels are below this value :type threshold: float :param max_iter: Maximum clean iterations. Defaults to 1000. :type max_iter: int, optional :param gain: Glean loop gain. Defaults to 0.1. :type gain: float, optional :param mask_arr: Additional mask of pixels to avoid. Defaults to None. :type mask_arr: NDArray[np.bool_] | None, optional :returns: clean_fdf_arr, model_fdf_arr, clean_iter_arr, resid_fdf_arr :rtype: RMCleanResults .. py:data:: DType .. py:data:: TQDM_OUT