Skip to content

Commit 917f40e

Browse files
committed
Add N keyword arg to analyze sobol
1 parent db8d52c commit 917f40e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/mcs/sobol.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ function sample!(sim::SobolSimulation, samplesize::Int)
3939
end
4040
end
4141

42-
function analyze(sim::SobolSimulation, model_output::AbstractArray{<:Number, N}) where N
42+
function analyze(sim::SobolSimulation, model_output::AbstractArray{<:Number, N1}; N::Union{Nothing, Int}=nothing) where N1
43+
if N != nothing
44+
sim.trials = N
45+
end
46+
47+
if sim.trials == 0
48+
error("Cannot analyze simulation with 0 trials (sim.trials == 0), either run generate_trials with a given N, or pass N to analyze function")
49+
end
50+
4351
payload = create_GSA_payload(sim)
4452
return GlobalSensitivityAnalysis.analyze(payload, model_output)
4553
end

0 commit comments

Comments
 (0)