Skip to content
Snippets Groups Projects
Commit cbcb93c6 authored by François  LAURENT's avatar François LAURENT
Browse files

version increment

parent 2a7f6a09
No related branches found
No related tags found
No related merge requests found
Pipeline #81626 passed
name = "PlanarLarvae"
uuid = "c2615984-ef14-4d40-b148-916c85b43307"
authors = ["François Laurent", "Institut Pasteur"]
version = "0.3.0"
version = "0.4.0"
[deps]
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
......
......@@ -852,13 +852,30 @@ asnamedtuple(states, i) = NamedTuple(key=>val[i] for (key, val) in pairs(states)
function astimeseries(track::Track)
firststate = asnamedtuple(track.states, 1)
timeseries = LarvaBase.TimeSeries{typeof(firststate)}()
T = typeof(firststate)
timeseries = LarvaBase.TimeSeries{T}()
for (i, t) in enumerate(track.timestamps)
push!(timeseries, (t, asnamedtuple(track.states, i)))
end
return timeseries
end
LarvaBase.eachtimeseries(tracks::Vector{Track}) = astimeseries.(tracks)
function astimeseries(tracks::Vector{Track})
firststate = asnamedtuple(tracks[1].states, 1)
T = typeof(firststate)
run = OrderedDict{TrackID, LarvaBase.TimeSeries{T}}()
for track in tracks
run[track.id] = timeseries = LarvaBase.TimeSeries{T}()
for (i, t) in enumerate(track.timestamps)
push!(timeseries, (t, asnamedtuple(track.states, i)))
end
end
return run
end
LarvaBase.eachtimeseries(tracks::Vector{Track}) = astimeseries(tracks)
LarvaBase.times(track::Track) = track.timestamps
LarvaBase.times(track::Vector{Track}) = unique(sort(collect(Iterators.flatten(LarvaBase.times.(track)))))
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment