Skip to content

Commit

Permalink
Add missing seed option for morris sampling
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnectedSystems committed Mar 30, 2020
1 parent 63ecc17 commit 4ea7f03
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/SALib/sample/morris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@


def sample(problem, N, num_levels=4, optimal_trajectories=None,
local_optimization=True):
local_optimization=True, seed=None):
"""Generate model inputs using the Method of Morris
Returns a NumPy matrix containing the model inputs required for Method of
Expand Down Expand Up @@ -87,6 +87,9 @@ def sample(problem, N, num_levels=4, optimal_trajectories=None,
of Morris. The resulting matrix has :math:`(G/D+1)*N/T` rows and
:math:`D` columns, where :math:`D` is the number of parameters.
"""
if seed:
np.random.seed(seed)

if not num_levels % 2 == 0:
warnings.warn("num_levels should be an even number, sample may be biased")
if problem.get('groups'):
Expand Down

0 comments on commit 4ea7f03

Please sign in to comment.