.. _bkg_estimation_task_user_guide: DoSetBkgThresh ============== .. contents:: :local: .. toctree:: .. currentmodule:: asterism.analysis_tasks.source_detection.background_estimation.background_estimation Introduction ------------ The :class:`~asterism.analysis_tasks.source_detection.background_estimation.background_estimation.DoSetBkgThreshTask` class implements the background estimation task. Algorithm --------- The algorithm is implemented in the :func:`~asterism.analysis_tasks.source_detection.background_estimation.background_estimation.set_thresh` function. Depending on the parameters passed as input, different strategies for the background estimation are followed. .. figure:: bkg_estimation_alg.png :width: 60% :align: center :figclass: align-center Parameters ---------- * If ``sub_block_frac_size`` is provided, the image is partitioned in N-blocks with size=sub_block_frac_size*image, and the block with the lowest flux is used to estimate the bkg level. Otherwise, the full image is used. * If ``skewness_range`` is provided, then the method is ste to the skewness is minimization. The skewness is minimized using the function :func:`~asterism.core.stats.utils.array_stats.minimize_skewness`. The data are clipped over the range :math:`|m-s1,m+s1|`, where `m` is the mean of the data, and `s1=std(data)*sigma_range`. The data are clipped in the range providing the minimum skewness . * If ``threshold`` is provided, then the backgorund level and the variance are directly evaluated from the background pixels * If ``resampling_size`` the bkg is estimated from a random resampling of the full image (`sub_block_frac_size` is None) or of the sub image (`sub_block_frac_size` is not None). The resampling is performed only if the nubmber of pixels in the image is greater than `resampling_size` * ``min_size_ratio`` provides the minimum size to stop the clipping, i.e. if **(clipped_size/full_size)