Data preprocessing functions
StellarSpectraObservationFitting.bad_pixel_flagger
— Methodbad_pixel_flagger(y, σ²; prop=.005, thres=8)
Find anomalous pixels where δ⁴y
/δ⁴x is high, passing prop
and thres
to outlier_mask()
StellarSpectraObservationFitting.continuum_normalize!
— Methodcontinuum_normalize!(d; order=6, kwargs...)
Divide d.flux
(and d.var
) by its sigma-clipped polynomial continuum (or its square)
StellarSpectraObservationFitting.fit_continuum
— Methodfit_continuum(x, y, σ²; ignore_weights=false, order=6, nsigma=[0.5,3.0], maxniter=50, edge_mask::Int=0)
Fit the continuum of y
with a polynomial of order order
using assymetric sigma-clipping, similar to wobble
StellarSpectraObservationFitting.flat_normalize!
— Methodflat_normalize!(d; kwargs...)
Divide d.flux
(and d.var
) by its 0.9
quantile value (or its square)
StellarSpectraObservationFitting.mask_bad_edges!
— Methodmask_bad_edges!(y, σ², log_λ_star, log_λ_star_bounds; window_width=128, min_snr=8., verbose=true, always_mask_something=false, edges=nothing, kwargs...)
Mask out edges of y
(either given by edges
or where y
/σ
is on average below min_snr
)
StellarSpectraObservationFitting.mask_bad_pixel!
— Methodmask_bad_pixel!(y, σ², log_λ_star, log_λ_star_bounds; padding=2, include_bary_shifts=false, verbose=true, bad_pixels=nothing, kwargs...)
Mask anomalous pixels where δ⁴y
/δ⁴x is high
StellarSpectraObservationFitting.mask_high_pixels!
— Methodmask_high_pixels!(bad, y, σ²; padding=0, max_flux=2., padding=2, using_weights=false)
Mask out pixels whose y
values are above max_flux
StellarSpectraObservationFitting.mask_infinite_pixels!
— Methodmask_infinite_pixels!(y, σ², log_λ_star, log_λ_star_bounds; padding=0, include_bary_shifts=false, verbose=true, kwargs...)
Mask out pixels whose y
or σ²
values are infinite
StellarSpectraObservationFitting.mask_isolated_pixels!
— Methodmask_isolated_pixels!(σ²; neighbors_required::Int=29, verbose::Bool=true)
Mask between two flagged pixels if there are fewer than neighbors_required
pixels between them
StellarSpectraObservationFitting.mask_low_pixels!
— Methodmask_low_pixels!(bad, y, σ²; padding=0, min_flux=0., padding=2, using_weights=false)
Mask out pixels whose y
values are below min_flux
StellarSpectraObservationFitting.outlier_mask
— Methodoutlier_mask(v; thres=10, prop=0.2, return_stats=false, only_low::Bool=false)
Mask outliers in v
that are outside thres
-σ after winsorizing out the top and bottom prop
quantiles
StellarSpectraObservationFitting.process!
— Methodprocess!(d; λ_thres=4000., min_snr=8, kwargs...)
Doing all of the data preprocessing, including continuum-fitting and masking of infinite points, anomalously snappy or high pixels, and low SNR edges.
StellarSpectraObservationFitting.snap
— Methodsnap(y)
Estimate δ⁴y
/δ⁴x (a.k.a. the snap) with finite differences. See https://en.wikipedia.org/wiki/Finitedifference#Higher-orderdifferences