RvSpectML/EchelleCCFs.jl

update docstring for inner constructor

hematthi opened this issue · 1 comments

""" GaussianCCFMask( σ ; half_truncation_width_in_σ=2 ) """
function GaussianCCFMask::Real, w::Real=2 )
@assert 0 < σ <= 300000 # 300km/s is arbitrary choice for an upper limit
@assert 0 < w <= 4
norm = 1.0/(sqrt(2π)*σ*erf(w/(sqrt(2.0))))
cdf_norm = 0.5/(erf(w/(sqrt(2.0))))
new*sqrt(2.0),σ*w,norm,cdf_norm)
end

Same for:

""" GaussianMixtureCCFMask( σ ; half_truncation_width_in_σ=2 ) """
function GaussianMixtureCCFMask(weight::AbstractVector{Float64}, σ::AbstractVector{Float64}, truncation_Δv::Real; v_offset::AbstractVector{Float64}=zeros(length(weight)) )
n = legnth(weight)
@assert 1 <= n <= 10 # Arbitrary upper limit
@assert length(σ) == n
@assert length(v_offset) == n
@assert all(0 .<= weight .<= one(eltype(weight))) #
@assert all(0 .< σ .<= 300000) # 300km/s is arbitrary choice for an upper limit
@assert all(-1000 .<= v_offset .<= 1000) # 1km/s is arbitrary choice for an upper limit
@assert 0 < truncation_Δv <= 300000
pdf_norm = zeros(n)
cdf_norm = zeros(n)
for i in 1:n
integral = ( erf((truncation_Δv-v_offset[i])/(sqrt(2.0)*σ[i])) - erf((-truncation_Δv-v_offset[i])/(sqrt(2.0*σ[i]))) )
pdf_norm[i] = weight[i]/(sqrt(2π)*σ[i]*integral)
cdf_norm[i] = weight[i]/integral
end
new(weight, σ.*sqrt(2.0),v_offset, truncation_Δv,pdf_norm,cdf_norm)
end