Skip to content

Commit

Permalink
Refs #8373 Return zeros if fitting parameters become negative
Browse files Browse the repository at this point in the history
  • Loading branch information
jmborr committed Nov 15, 2013
1 parent 4ff0358 commit 77026d6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def validateParams(self):
if value <=0:
message = 'Parameter {} in StretchedExpFT must be positive. Got {} instead'.format(name, str(value))
logger.error(message)
raise ValueError(message)
#raise ValueError(message)
return None
return {'height':height, 'tau':tau, 'beta':beta}

def function1D(self, xvals, **optparms):
Expand Down Expand Up @@ -100,6 +101,8 @@ def function1D(self, xvals, **optparms):
import scipy.interpolate

p=self.validateParams()
if not p:
return np.zeros(len(xvals), dtype=float) # return zeros if parameters not valid
# override parameter values with optparms (used for the numerical derivative)
if optparms:
if self._parmset.issubset( set(optparms.keys()) ):
Expand Down

0 comments on commit 77026d6

Please sign in to comment.