Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update docstring for inner constructor #83

Open
hematthi opened this issue Jun 11, 2022 · 1 comment
Open

update docstring for inner constructor #83

hematthi opened this issue Jun 11, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@hematthi
Copy link
Collaborator

""" 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

@hematthi hematthi added the documentation Improvements or additions to documentation label Jun 11, 2022
@hematthi
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant