Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SciML/SciMLBase.jl
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.16.0
Choose a base ref
...
head repository: SciML/SciMLBase.jl
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.16.1
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Jan 4, 2024

  1. Copy the full SHA
    7608e15 View commit details
  2. Merge pull request #586 from SciML/ensemble2

    Ensemble depwarn fixes
    ChrisRackauckas authored Jan 4, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f775b30 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d64832d View commit details
Showing with 18 additions and 18 deletions.
  1. +1 −1 Project.toml
  2. +17 −17 src/ensemble/ensemble_analysis.jl
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SciMLBase"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
authors = ["Chris Rackauckas <accounts@chrisrackauckas.com> and contributors"]
version = "2.16.0"
version = "2.16.1"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
34 changes: 17 additions & 17 deletions src/ensemble/ensemble_analysis.jl
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ timestep_mean(sim, ::Colon) = timeseries_steps_mean(sim)
function timestep_median(sim, i)
arr = componentwise_vectors_timestep(sim, i)
if typeof(first(arr)) <: AbstractArray
return reshape([median(x) for x in arr], size(sim[1][i])...)
return reshape([median(x) for x in arr], size(sim.u[1][i])...)
else
return median(arr)
end
@@ -37,7 +37,7 @@ timestep_median(sim, ::Colon) = timeseries_steps_median(sim)
function timestep_quantile(sim, q, i)
arr = componentwise_vectors_timestep(sim, i)
if typeof(first(arr)) <: AbstractArray
return reshape([quantile(x, q) for x in arr], size(sim[1][i])...)
return reshape([quantile(x, q) for x in arr], size(sim.u[1][i])...)
else
return quantile(arr, q)
end
@@ -61,51 +61,51 @@ function timestep_weighted_meancov(sim, W, ::Colon, ::Colon)
end

function timeseries_steps_mean(sim)
DiffEqArray([timestep_mean(sim, i) for i in 1:length(sim[1])], sim[1].t)
DiffEqArray([timestep_mean(sim, i) for i in 1:length(sim.u[1])], sim.u[1].t)
end
function timeseries_steps_median(sim)
DiffEqArray([timestep_median(sim, i) for i in 1:length(sim[1])], sim[1].t)
DiffEqArray([timestep_median(sim, i) for i in 1:length(sim.u[1])], sim.u[1].t)
end
function timeseries_steps_quantile(sim, q)
DiffEqArray([timestep_quantile(sim, q, i) for i in 1:length(sim[1])], sim[1].t)
DiffEqArray([timestep_quantile(sim, q, i) for i in 1:length(sim.u[1])], sim.u[1].t)
end
function timeseries_steps_meanvar(sim)
m, v = timestep_meanvar(sim, 1)
means = [m]
vars = [v]
for i in 2:length(sim[1])
for i in 2:length(sim.u[1])
m, v = timestep_meanvar(sim, i)
push!(means, m)
push!(vars, v)
end
DiffEqArray(means, sim[1].t), DiffEqArray(vars, sim[1].t)
DiffEqArray(means, sim.u[1].t), DiffEqArray(vars, sim.u[1].t)
end
function timeseries_steps_meancov(sim)
reshape([timestep_meancov(sim, i, j) for i in 1:length(sim[1])
for j in 1:length(sim[1])], length(sim[1]), length(sim[1]))
reshape([timestep_meancov(sim, i, j) for i in 1:length(sim.u[1])
for j in 1:length(sim.u[1])], length(sim.u[1]), length(sim.u[1]))
end
function timeseries_steps_meancor(sim)
reshape([timestep_meancor(sim, i, j) for i in 1:length(sim[1])
for j in 1:length(sim[1])], length(sim[1]), length(sim[1]))
reshape([timestep_meancor(sim, i, j) for i in 1:length(sim.u[1])
for j in 1:length(sim.u[1])], length(sim.u[1]), length(sim.u[1]))
end
function timeseries_steps_weighted_meancov(sim, W)
reshape([timestep_meancov(sim, W, i, j) for i in 1:length(sim[1])
for j in 1:length(sim[1])], length(sim[1]), length(sim[1]))
reshape([timestep_meancov(sim, W, i, j) for i in 1:length(sim.u[1])
for j in 1:length(sim.u[1])], length(sim.u[1]), length(sim.u[1]))
end

timepoint_mean(sim, t) = componentwise_mean(get_timepoint(sim, t))
function timepoint_median(sim, t)
arr = componentwise_vectors_timepoint(sim, t)
if typeof(first(arr)) <: AbstractArray
return reshape([median(x) for x in arr], size(sim[1][1])...)
return reshape([median(x) for x in arr], size(sim.u[1][1])...)
else
return median(arr)
end
end
function timepoint_quantile(sim, q, t)
arr = componentwise_vectors_timepoint(sim, t)
if typeof(first(arr)) <: AbstractArray
return reshape([quantile(x, q) for x in arr], size(sim[1][1])...)
return reshape([quantile(x, q) for x in arr], size(sim.u[1][1])...)
else
return quantile(arr, q)
end
@@ -122,8 +122,8 @@ function timepoint_weighted_meancov(sim, W, t1, t2)
end

function SciMLBase.EnsembleSummary(sim::SciMLBase.AbstractEnsembleSolution{T, N},
t = sim[1].t; quantiles = [0.05, 0.95]) where {T, N}
if sim[1] isa SciMLSolution
t = sim.u[1].t; quantiles = [0.05, 0.95]) where {T, N}
if sim.u[1] isa SciMLSolution
m, v = timeseries_point_meanvar(sim, t)
med = timeseries_point_median(sim, t)
qlow = timeseries_point_quantile(sim, quantiles[1], t)