You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fitting with bounds and NonLinearLSQFitter broken? #2400
I've noticed some odd behavior on the current master that seems like a bug.
class MyModel(modeling.Fittable1DModel):
a = modeling.Parameter(default=1)
b = modeling.Parameter(default=0)
@staticmethod
def eval(x, a, b):
return a*x + b
m_real = MyModel(a=1.5, b= -3)
x = np.arange(100)
y = m_real(x)
With that model defined, I see the following:
>>> m = MyModel()
>>> f=modeling.fitting.NonLinearLSQFitter()
>>> f(m,x,y)
<MyModel(a=Parameter('a', value=1.5), b=Parameter('b', value=-3.0), param_dim=1)>
>>> m2 = MyModel()
>>> m2.a.bounds = (-2,2) # same if I do e.g. m2.a.bounds = (0, None)
>>> f2=modeling.fitting.NonLinearLSQFitter()
>>> f2(m2,x,y)
<MyModel(a=Parameter('a', value=1.0), b=Parameter('b', value=0.0), param_dim=1)>
That looks wrong. It seems like adding the bounds to m2 has caused it to stop trying to fit. And indeed, here's what the fitter says:
Activity
eteq commentedon May 1, 2014
cc @embray @nden
embray commentedon May 1, 2014
Pretty sure this is effectively a duplicate of #2235 but I need to confirm.
eteq commentedon May 5, 2014
@embray - I think its subtly different, because it happens even if the parameter values are well within the bounds (at least initially).
embray commentedon May 5, 2014
What I mean though is that I'm pretty sure the cause is the same.
embray commentedon Jun 20, 2014
As I wrote in #2235 (comment), this actually appears to be more or less fixed by #2634 .
Add two new regression tests based on issues astropy#2235 and astropy…
embray commentedon Jun 26, 2014
This should be fixed by #2634, though if you find it isn't--or find another example where this isn't working--feel free to reopen or whatever.