Skip to content

Commit

Permalink
add_timeseries!
Browse files Browse the repository at this point in the history
  • Loading branch information
dfabianus committed Nov 13, 2023
1 parent d6fb3aa commit 51f8c48
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/calculators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function calc!(experiment::Experiment, calculator::Function, args...; kwargs...)
if name in colnames(Experiments.timeseries(experiment))
println("Timeseries with the name $name already exists in the experiment.")
else
push!(experiment.timeseries, ts)
add_timeseries!(experiment, ts)
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions src/importers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ using DataFrames
using TimeSeries
using Dates

function add_timeseries!(experiment::Experiment, timeseries::TimeArray)
push!(experiment.timeseries, timeseries)
end

# Wrappers around the TimeArray constructor
function timeseries(name::Symbol, datetimes::AbstractVector{<:TimeType}, values::AbstractVector...)
names = [name for i in 1:length(values)]
Expand Down
5 changes: 4 additions & 1 deletion test/usecases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ plot(ts)
# The same works for a vector of experiments
experiments
Experiments.calc!(experiments, Experiments.diff, :OD, :DCW, :p_O2)
experiments
experiments

# interpolation
ts = Experiments.timeseries(exp, :OD)

0 comments on commit 51f8c48

Please sign in to comment.