Background estimation functions#
Code author: Wilfried Mercier - LAM <wilfried.mercier@lam.fr>
Functions used to determine the the background threshold in an image.
- bg_threshold_n_sigma(image, model, mask_bg, n_sigma=2)[source]#
Code author: Wilfried Mercier - LAM <wilfried.mercier@lam.fr>
Given an image with background pixels, measure n times the standard deviation of the background in the residuals.
- Parameters:
- Returns:
n times the standard deviation of the background signal in the residuals.
- Return type:
float
- find_bg_threshold(image, model, mask_bg, surface, positive=True, precision=0.1)[source]#
Code author: Wilfried Mercier - LAM <wilfried.mercier@lam.fr>
Find the lowest background threshold that does not detect substructures in the background pixels of a residual image.
- Parameters:
image (NDArray) – image of the galaxy
model (NDArray) – 2D model of the galaxy. If
imagecorresponds to the residuals, usemodel = 0.mask_bg (NDArray) – mask with
Truefor pixels that belong to the backgroundsurface (
int) – minimum surface in pixels that a structure must have in order to be detectedpositive (
bool) –whether to find the best threshold for substructures with
positive fluxes (
positive = True) ornegative fluxes (
positive = False)
precision (
float) – precision on the flux threshold used to stop the dichotomy
- Returns:
Number of standard deviations in the background regions of the residuals.
- Return type:
float