phot.background.sky_fit
phot.background.sky_fit(
ccd,
annulus=None,
mask=None,
method='sex',
sky_clipper=sigma_clipper,
std_ddof=1,
to_table=True,
return_skyarr=False,
**kwargs,
)Estimate sky values from an image or one or more annuli.
Parameters
ccd :~astropy.nddata.CCDData, HDU, or ndarray-
Image data from which to extract sky values.
annulus : annulus object = None-
Annulus used for the estimate. If
None(default), use the whole image. method : (sex, IRAF, MMM, mean, median) = "sex"-
Sky estimator. Names are case-insensitive:
"mean"/"median": simple nanmean/nanmedian."sex":(med_factor, mean_factor) = (2.5, 1.5)."IRAF":(med_factor, mean_factor) = (3, 2), or the mean when the mean is below the median."MMM":(med_factor, mean_factor) = (3, 2).
The three compound estimators use
msky = med_factor * med - mean_factor * mean."MMM"uses the same formula as visualization’sstatistic="mode"; it is not the iterativemmm_daoalgorithm. For"sex", use the median instead when(mean - median) / std > 0.3, matching SExtractor.A callable must have signature
func(skyarr, ssky) -> msky. It receives the 1-D clipped values and their sample standard deviation. Example:method = lambda x, s: np.median(x). Default is"sex". sky_clipper : callable,None= sigma_clipper-
Function used before estimating the sky. It must have signature
func(skyarr, **kwargs) -> clipped_skyarrand return a plain ndarray without NaNs: remove clipped values rather than replacing them with NaN. This is required by thereducerskernels used by_sky_fit. The default~astroimred._core.numeric.sigma_clipperremoves values and usesimcombinersrejection kernels for compatible 1-D calls. IfNone, apply no clipping beyond removing NaNs (lambda x: x[~np.isnan(x)]). std_ddof : int = 1-
Delta degrees of freedom for the sky standard deviation.
to_table : bool = True-
Return a
~astropy.table.TablewhenTrue; otherwise return a list of dictionaries. Default isTrue. return_skyarr : bool = False-
Also return the 1-D sky array, or a list of arrays for multiple annuli. Default is
False. ****kwargs** : = {}-
Keyword arguments forwarded to
sky_clipper.
Returns
skytable :~astropy.table.Tableor list of dict-
One row or dictionary per annulus with the following fields:
msky : float Estimated sky value after clipping.
ssky : float Sample standard deviation after clipping.
dsky : float Standard error of
msky,ssky * sqrt(c / nsky).cis the variance factor of the estimator branch used per annulus, so it can differ between rows; see_sky_var_factorfor its values and derivation.NaNfor a callablemethod, because itscis unknown.nsky : int Number of pixels used after clipping.
nrej : int Number of pixels rejected by clipping.
skys : ndarray or list of ndarray-
Returned only when
return_skyarr=True: the 1-D sky values, or one array per annulus.