Background Estimators
All of these estimators are subtypes of Background.LocationEstimator
or Background.RMSEstimator
and are derived using various statistical and image processing methods.
Location Estimators
These estimators are used for estimating the background using some form of a central statistic.
Photometry.Background.LocationEstimator
— TypeBackground.LocationEstimator
This abstract type embodies the possible background estimation algorithms for dispatch with estimate_background
.
To implement a new estimator, you must define the struct and define a method like (::MyEstimator)(data::AbstractArray; dims=:)
.
See Also
Photometry.Background.MMMBackground
— TypeMMMBackground(median_factor=3, mean_factor=2)
Estimate the background using a mode estimator of the form median_factor * median - mean_factor * mean
. This algorithm is based on the MMMBackground
routine originally implemented in DAOPHOT. MMMBackground
uses factors of median_factor=3
and mean_factor=2
by default. This estimator assumes that contaminated sky pixel values overwhelmingly display positive departures from the true value.
Examples
julia> x = ones(3, 5);
julia> MMMBackground()(x)
1.0
julia> MMMBackground(median_factor=4, mean_factor=3)(x, dims = 1)
1×5 Matrix{Float64}:
1.0 1.0 1.0 1.0 1.0
See Also
Photometry.Background.SourceExtractorBackground
— TypeSourceExtractorBackground()
This estimator returns the background of the input using the SourceExtractorBackground algorithm.
The background is calculated using a mode estimator of the form (2.5 * median) - (1.5 * mean)
.
If (mean - median) / std > 0.3
then the median is used and if std = 0
then the mean is used.
Examples
julia> data = ones(3, 5);
julia> SourceExtractorBackground()(data)
1.0
julia> SourceExtractorBackground()(data, dims=1)
1×5 Matrix{Float64}:
1.0 1.0 1.0 1.0 1.0
Photometry.Background.BiweightLocationBackground
— TypeBiweightLocationBackground(c = 6.0, M = nothing)
Estimate the background using the robust biweight location statistic.
\[ξ_{biloc} = M + \frac{∑_{|uᵢ|<1}{(xᵢ - M)(1 - uᵢ²)²}}{∑_{|uᵢ|<1}{(1-uᵢ²)²}}\]
\[u_i = \frac{(x_i - M)}{c⋅\mathrm{MAD}(x)}\]
Where $\mathrm{MAD}(x)$ is median absolute deviation of x
.
Examples
julia> x = ones(3,5);
julia> BiweightLocationBackground()(x)
1.0
julia> BiweightLocationBackground(c=5.5)(x; dims = 1)
1×5 Matrix{Float64}:
1.0 1.0 1.0 1.0 1.0
RMS Estimators
These estimators are used for estimating the root-mean-square (RMS) of the background using some form of a deviation statistic.
Photometry.Background.RMSEstimator
— TypeBackground.RMSEstimator
This abstract type embodies the possible background RMS estimation algorithms for dispatch with estimate_background
.
To implement a new estimator, you must define the struct and define a method like (::MyRMSEstimator)(data::AbstractArray; dims=:)
.
See Also
Photometry.Background.StdRMS
— TypeStdRMS()
Uses the standard deviation statistic for background RMS estimation.
Examples
julia> data = ones(3, 5);
julia> StdRMS()(data)
0.0
julia> StdRMS()(data, dims=1)
1×5 Matrix{Float64}:
0.0 0.0 0.0 0.0 0.0
Photometry.Background.MADStdRMS
— TypeMADStdRMS()
Uses the standard median absolute deviation (MAD) statistic for background RMS estimation.
This is typically given as
$σ ≈ 1.4826 ⋅ \mathrm{MAD}$
Examples
julia> data = ones(3, 5);
julia> MADStdRMS()(data)
0.0
julia> MADStdRMS()(data, dims=1)
1×5 Matrix{Float64}:
0.0 0.0 0.0 0.0 0.0
Photometry.Background.BiweightScaleRMS
— TypeBiweightScaleRMS(c=9.0, M=nothing)
Uses the robust biweight scale statistic for background RMS estimation.
The biweight scale is the square root of the biweight midvariance. The biweight midvariance uses a tuning constant, c
, and an optional initial guess of the central value M
.
\[ζ²_{biscl} = \frac{n ∑_{|uᵢ|<1}{(xᵢ - M)²(1 - uᵢ²)⁴}}{\left[∑_{|uᵢ|<1}{(1-uᵢ²)(1-5uᵢ²)}\right]²}\]
\[uᵢ = \frac{(xᵢ - M)}{c⋅\mathrm{MAD}(x)}\]
Where $\mathrm{MAD}(x)$ is median absolute deviation of x
.
Examples
julia> data = ones(3, 5);
julia> BiweightScaleRMS()(data)
0.0
julia> BiweightScaleRMS(c=3.0)(data, dims=1)
1×5 Matrix{Float64}:
0.0 0.0 0.0 0.0 0.0