Skip to content

Commit 7608e15

Browse files
Ensemble depwarn fixes
1 parent fd5f143 commit 7608e15

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/ensemble/ensemble_analysis.jl

+17-17
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ timestep_mean(sim, ::Colon) = timeseries_steps_mean(sim)
2828
function timestep_median(sim, i)
2929
arr = componentwise_vectors_timestep(sim, i)
3030
if typeof(first(arr)) <: AbstractArray
31-
return reshape([median(x) for x in arr], size(sim[1][i])...)
31+
return reshape([median(x) for x in arr], size(sim.u[1][i])...)
3232
else
3333
return median(arr)
3434
end
@@ -37,7 +37,7 @@ timestep_median(sim, ::Colon) = timeseries_steps_median(sim)
3737
function timestep_quantile(sim, q, i)
3838
arr = componentwise_vectors_timestep(sim, i)
3939
if typeof(first(arr)) <: AbstractArray
40-
return reshape([quantile(x, q) for x in arr], size(sim[1][i])...)
40+
return reshape([quantile(x, q) for x in arr], size(sim.u[1][i])...)
4141
else
4242
return quantile(arr, q)
4343
end
@@ -61,51 +61,51 @@ function timestep_weighted_meancov(sim, W, ::Colon, ::Colon)
6161
end
6262

6363
function timeseries_steps_mean(sim)
64-
DiffEqArray([timestep_mean(sim, i) for i in 1:length(sim[1])], sim[1].t)
64+
DiffEqArray([timestep_mean(sim, i) for i in 1:length(sim.u[1])], sim.u[1].t)
6565
end
6666
function timeseries_steps_median(sim)
67-
DiffEqArray([timestep_median(sim, i) for i in 1:length(sim[1])], sim[1].t)
67+
DiffEqArray([timestep_median(sim, i) for i in 1:length(sim.u[1])], sim.u[1].t)
6868
end
6969
function timeseries_steps_quantile(sim, q)
70-
DiffEqArray([timestep_quantile(sim, q, i) for i in 1:length(sim[1])], sim[1].t)
70+
DiffEqArray([timestep_quantile(sim, q, i) for i in 1:length(sim.u[1])], sim.u[1].t)
7171
end
7272
function timeseries_steps_meanvar(sim)
7373
m, v = timestep_meanvar(sim, 1)
7474
means = [m]
7575
vars = [v]
76-
for i in 2:length(sim[1])
76+
for i in 2:length(sim.u[1])
7777
m, v = timestep_meanvar(sim, i)
7878
push!(means, m)
7979
push!(vars, v)
8080
end
81-
DiffEqArray(means, sim[1].t), DiffEqArray(vars, sim[1].t)
81+
DiffEqArray(means, sim.u[1].t), DiffEqArray(vars, sim.u[1].t)
8282
end
8383
function timeseries_steps_meancov(sim)
84-
reshape([timestep_meancov(sim, i, j) for i in 1:length(sim[1])
85-
for j in 1:length(sim[1])], length(sim[1]), length(sim[1]))
84+
reshape([timestep_meancov(sim, i, j) for i in 1:length(sim.u[1])
85+
for j in 1:length(sim.u[1])], length(sim.u[1]), length(sim.u[1]))
8686
end
8787
function timeseries_steps_meancor(sim)
88-
reshape([timestep_meancor(sim, i, j) for i in 1:length(sim[1])
89-
for j in 1:length(sim[1])], length(sim[1]), length(sim[1]))
88+
reshape([timestep_meancor(sim, i, j) for i in 1:length(sim.u[1])
89+
for j in 1:length(sim.u[1])], length(sim.u[1]), length(sim.u[1]))
9090
end
9191
function timeseries_steps_weighted_meancov(sim, W)
92-
reshape([timestep_meancov(sim, W, i, j) for i in 1:length(sim[1])
93-
for j in 1:length(sim[1])], length(sim[1]), length(sim[1]))
92+
reshape([timestep_meancov(sim, W, i, j) for i in 1:length(sim.u[1])
93+
for j in 1:length(sim.u[1])], length(sim.u[1]), length(sim.u[1]))
9494
end
9595

9696
timepoint_mean(sim, t) = componentwise_mean(get_timepoint(sim, t))
9797
function timepoint_median(sim, t)
9898
arr = componentwise_vectors_timepoint(sim, t)
9999
if typeof(first(arr)) <: AbstractArray
100-
return reshape([median(x) for x in arr], size(sim[1][1])...)
100+
return reshape([median(x) for x in arr], size(sim.u[1][1])...)
101101
else
102102
return median(arr)
103103
end
104104
end
105105
function timepoint_quantile(sim, q, t)
106106
arr = componentwise_vectors_timepoint(sim, t)
107107
if typeof(first(arr)) <: AbstractArray
108-
return reshape([quantile(x, q) for x in arr], size(sim[1][1])...)
108+
return reshape([quantile(x, q) for x in arr], size(sim.u[1][1])...)
109109
else
110110
return quantile(arr, q)
111111
end
@@ -122,8 +122,8 @@ function timepoint_weighted_meancov(sim, W, t1, t2)
122122
end
123123

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

0 commit comments

Comments
 (0)