Skip to content

Commit

Permalink
Refinement of parameter sampling an fix of mac/unix numpy error
Browse files Browse the repository at this point in the history
  • Loading branch information
thouska committed Jan 30, 2024
1 parent c7f61c3 commit 78a5be0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/spotpy/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def name(self):
:return: name
"""
# Check if args[0] is string like (and exists)
if self.args and str(self.args[0]) == self.args[0]:
#if self.args and str(self.args[0]) == self.args[0]:
if self.args and (str(self.args[0]) == self.args[0]):
#if (self.args & isinstance(self.args[0], str)).all():
name = self.args.pop(0)
self.processed_args += 1
# else get the name from the keywords
Expand Down Expand Up @@ -148,7 +150,7 @@ def _round_sig(x, sig=3):
if abs(x) < 1e-12:
return 0
else:
return round(x, sig - int(floor(log10(abs(x)))) - 1)
return round(x, sig - int(floor(log10(abs(x)))))


class Base(object):
Expand Down Expand Up @@ -200,7 +202,7 @@ def __init__(self, rndfunc, rndfuncname, *args, **kwargs):
["step", "optguess", "minbound", "maxbound"], as_dict=True
)
# Draw one sample of size 1000
sample = self(size=1000)
sample = self(size=100000)
self.step = param_args.get(
"step",
_round_sig(np.percentile(sample, 50) - np.percentile(sample, 40)),
Expand Down

0 comments on commit 78a5be0

Please sign in to comment.