jqfeld/LXCat.jl

Excitation reactions with forward and backward direction fail to parse

Closed this issue · 4 comments

The reaction set:
Excitation_He.txt
contains a reaction which is defined in both directions.
Thus it contains two threshold_energies which leads to a parsing error on line 105
as it can't split up the values correctly.
I "fixed" it by changing line 105 to:
threshold_or_mass_ratio = parse(Float64, split(strip(lines[3]), r"[/\s]+")[1])
which ignores the second threshold energy.
But this doesn't fix the underlying issue that there is no struct for this kind of Excitation reaction.

Stacktrace of the error:

ERROR: ArgumentError: cannot parse "1.982000e+1 3.000000e+0" as Float64
Stacktrace:
[1] _parse_failure(T::Type, s::SubString{String}, startpos::Int64, endpos::Int64) (repeats 2 times)
@ Base ./parse.jl:373
[2] #tryparse_internal#478
@ ./parse.jl:369 [inlined]
[3] tryparse_internal
@ ./parse.jl:366 [inlined]
[4] #parse#479
@ ./parse.jl:379 [inlined]
[5] parse
@ ./parse.jl:379 [inlined]
[6] parse_coll_type(lines::Vector{SubString{String}})
@ LXCat ~/.julia/packages/LXCat/u18Sx/src/LXCat.jl:105
[7] parse_string(s::String)
@ LXCat ~/.julia/packages/LXCat/u18Sx/src/LXCat.jl:97
[8] (::LXCat.var"#8#9"{Vector{CrossSection}})(file::IOStream)
@ LXCat ~/.julia/packages/LXCat/u18Sx/src/LXCat.jl:148
[9] open(f::LXCat.var"#8#9"{Vector{CrossSection}}, args::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./io.jl:384
[10] open
@ ./io.jl:381 [inlined]
[11] #load_database#7
@ ~/.julia/packages/LXCat/u18Sx/src/LXCat.jl:135 [inlined]
[12] load_database(filename::String)
@ LXCat ~/.julia/packages/LXCat/u18Sx/src/LXCat.jl:131
[13] top-level scope
@ ~/programming/julia/globalModel/main.jl:16

Thanks for reporting! The third number is actually the ratio of the statistical weights needed for detailed balance. I will include it in the data structure of the excitation cross sections.

Should work now with current master 69a1d5b :)

Thanks for the fix.
You forgot to remove a println statement on line 114.

Ups, thanks. Removed it now.