Skip to content

Commit

Permalink
Merge pull request #542 from tupui/skip_sobol
Browse files Browse the repository at this point in the history
Fix skip_values integer check
  • Loading branch information
ConnectedSystems committed Oct 17, 2022
2 parents 54d21fe + 72e8b80 commit c5cc5f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SALib/sample/sobol.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def sample(
qrng = qmc.Sobol(d=2 * D, scramble=scramble, seed=seed)

# fast-forward logic
if skip_values > 0:
if skip_values > 0 and isinstance(skip_values, int):
M = skip_values
if not ((M & (M - 1) == 0) and (M != 0 and M - 1 != 0)):
msg = f"""
Expand All @@ -125,7 +125,7 @@ def sample(
warnings.warn(msg, stacklevel=2)

qrng.fast_forward(M)
elif skip_values < 0 or isinstance(skip_values, int):
elif skip_values < 0 or not isinstance(skip_values, int):
raise ValueError("`skip_values` must be a positive integer.")

# sample Sobol' sequence
Expand Down

0 comments on commit c5cc5f2

Please sign in to comment.