Skip to content

Commit

Permalink
Hotfix for undef data vector... -> 0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Kliebisch committed Apr 17, 2021
1 parent cb40223 commit a811710
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "HITRAN"
uuid = "4efdbe67-70aa-4c87-84c0-bc59a9addc1a"
authors = ["Oliver Kliebisch <[email protected]>"]
version = "0.2.5"
version = "0.2.6"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
13 changes: 9 additions & 4 deletions src/profiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,13 @@ function parse_kwargs(tables;kwargs...)
sql = "SELECT MIN(nu) AS min_nu, MAX(nu) AS max_nu FROM (" * subquery * ")"
result = first(query_local_db(sql))
ν_range = (result.min_nu, result.max_nu)
end
end
ν_range = (convert(Float64, ν_range[1]), convert(Float64, ν_range[2]))
ν = ν_range[1]:ν_step:ν_range[2]
else
ν_range = (minimum(ν), maximum(ν))
end

ν_min, ν_max = ν_range
ν_wing = convert(Float64, get(kwargs, :ν_wing, 0.))
ν_wing_hw = convert(Float64, get(kwargs, :ν_wing_hw, 50.))
Expand Down Expand Up @@ -245,7 +247,8 @@ function α(
molar_masses :: Dict{Tuple{Int, Int}, Float64}
) where T <: AbstractFloat
# allocate output
data = data_cache = similar(ν)
data = zeros(length(ν))
data_cache = zeros(length(ν))

# lineshape function
lineshape::Function = lineshape_map[profile]
Expand Down Expand Up @@ -294,7 +297,7 @@ function α(

# environment adjusted line intensity
S_ij = Sij_T(getvalue(result, ind_sw, Float64), temperature, c_T_ref, q_t, q_t_ref, getvalue(result, ind_elower, Float64), getvalue(result, ind_nu, Float64))

# skip weak lines
if S_ij < intensity_threshold
continue
Expand Down Expand Up @@ -427,7 +430,7 @@ function hartmann_tran_lineshape(
γ_D = γ_Doppler(temperature, ν_0, mass)
γ_0 = γ_2 = Δ_0 = Δ_2 = zero(Float64)
ν_VC = η = zero(ComplexF64)

# loop over all diluents and build combined line parameters
γ_0_dil = n_dil = T_ref = γ_0t = Δ_0_dil = Δ_0p_dil = Δ_0t = γ_2_dil = γ_2t = zero(Float64)
Δ_2_dil = Δ_2t = η_dil = ν_VC_dil = κ_dil = zero(Float64)
Expand Down Expand Up @@ -485,6 +488,8 @@ function hartmann_tran_lineshape(
ind_lo = searchsortedfirst(ν, ν_0 - ν_wing_val)
ind_hi = searchsortedlast(ν, ν_0 + ν_wing_val)

#println(join((factor, ν_0, ν_VC, γ_D, γ_0, γ_2, Δ_0, Δ_2, η), ", "))

hartmann_tran_profile!(out_cache, @view(ν[ind_lo:ind_hi]), ν_0, ν_VC, γ_D, γ_0, γ_2, Δ_0, Δ_2, η)
for i = 1:(ind_hi - ind_lo + 1)
data[ind_lo + i - 1] += factor * out_cache[i]
Expand Down

0 comments on commit a811710

Please sign in to comment.