From 78a5be0a7a3410c9fe5b6a4d421021208a74913f Mon Sep 17 00:00:00 2001 From: thouska Date: Tue, 30 Jan 2024 11:11:37 +0100 Subject: [PATCH] Refinement of parameter sampling an fix of mac/unix numpy error --- src/spotpy/parameter.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/spotpy/parameter.py b/src/spotpy/parameter.py index 9bb24be9..5b8ed7a0 100644 --- a/src/spotpy/parameter.py +++ b/src/spotpy/parameter.py @@ -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 @@ -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): @@ -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)),