Writing this down so I don't forget...
I started using astropy.models in my own code, but have run in to some issues. First off, we need to sprint hard on the documentation -- no one will use this if we don't have good documentation explaining all of the nice features in here, which are currently buried in code!
I'm having trouble getting bounded / tied parameters to work with the Gaussian2DModel. Haven't tried this with others, and haven't yet tried to dig in to the code, but here's an example of what I'm trying to do -- fit a 2D Gaussian to some image data:
gauss = am.builtin_models.Gaussian2DModel(amplitude=10., x_mean=5., y_mean=5.,
x_stddev=4., y_stddev=4., theta=0.5,
bounds={"x_mean" : [0.,11.],
"y_mean" : [0.,11.],
"x_stddev" : [1.,4.],
"y_stddev" : [1.,4.]})
gauss_fit = am.fitting.NonLinearLSQFitter(gauss)
but when I run the code, the parameters I get are definitely not bounded:
Model: Gaussian2DModel
Dim: 2
Degree: N/A
Parameter sets: 1
Parameters:
amplitude: [1620.8534792444862]
x_stddev: [71.600369674585707]
y_stddev: [4.023002873594919]
x_mean: [-7.4567104062070975]
y_mean: [-17.633779415014097]
theta: [4.204525599803083]
Also tried this with using tied:
gauss = am.builtin_models.Gaussian2DModel(amplitude=10., x_mean=5., y_mean=5.,
x_stddev=4., y_stddev=4., theta=0.5)
gauss.x_stddev.tied = lambda g: g.y_stddev
but also does not seem to work.
cc @nden
Writing this down so I don't forget...
I started using
astropy.modelsin my own code, but have run in to some issues. First off, we need to sprint hard on the documentation -- no one will use this if we don't have good documentation explaining all of the nice features in here, which are currently buried in code!I'm having trouble getting bounded / tied parameters to work with the
Gaussian2DModel. Haven't tried this with others, and haven't yet tried to dig in to the code, but here's an example of what I'm trying to do -- fit a 2D Gaussian to some image data:but when I run the code, the parameters I get are definitely not bounded:
Also tried this with using
tied:but also does not seem to work.
cc @nden