Skip to content

Commit

Permalink
Bug fix in time data
Browse files Browse the repository at this point in the history
  • Loading branch information
garrekstemo committed Jun 29, 2022
1 parent dc8408e commit a9afbcb
Show file tree
Hide file tree
Showing 2 changed files with 735 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/LVM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,21 @@ function read(file::String; getall::Bool=false)
data = Dict()

for (i, line) in enumerate(eachline(file))

first_item = "1.0"
t_index = findfirst('\t', line)
r_index = findfirst('\r', line)

first_item = line[1:findfirst('\t', line)]
if t_index === nothing
if !(r_index === nothing)
first_item = line[1:r_index]
end
elseif !(t_index === nothing)
first_item = line[1:t_index]
end

if tryparse(Float64, first_item) === nothing

if occursin('\r', line)
header = split(line[1:findfirst('\r', line)])
else
Expand All @@ -20,7 +31,7 @@ function read(file::String; getall::Bool=false)
push!(headers, header)
end
end

for (i, h) in enumerate(headerindex)

if headerindex[i] == headerindex[end]
Expand All @@ -45,6 +56,8 @@ function read(file::String; getall::Bool=false)

elseif occursin("wavenum", header)
data["wavenumber"] = chunk[:, k]
elseif occursin("Time", header)
data["time"] = chunk[:, k]

elseif getall == false
if occursin("CH0_diff", header)
Expand Down
Loading

0 comments on commit a9afbcb

Please sign in to comment.