bug in GAUSS2DFIT [message #9515] |
Wed, 09 July 1997 00:00 |
Richard G. French
Messages: 65 Registered: June 1997
|
Member |
|
|
I'd like to report a bug in GAUSS2DFIT, which is part of the standard
library in IDL5.0
but which may have been around earlier in some form. It is a routine to
fit a 2-D
gaussian, including an aribitrary orientation of the axes of the
gaussian. The error is
in the sign of the partial derivative with respect to the tilt angle,
theta, which defines
the orientation of the axes. In GAUSS2DFIT.PRO, there should be a minus
sign in
front of the expression for pder[0,6] in line 73 of the routine. I
confirmed this both
numerically and using Mathematica. As it turns out, this error does not
show up when
you use GAUSS2DFIT directly, since it is written in a mode that uses
numerical
derivatives instead of analytic derivatives. Perhaps this is because RSI
realized that
the analytic derivatives did not work! If you want to test the feature,
try a fit with
A[6] set to a non-zero initial value, use /TILT, and edit GAUSS2DFIT.PRO
to
omit the /NODERIVATIVE keyword in the call to curvefit near the end of
the program.
The fit will not converge to the correct value of theta. If you then
change the sign
of pder[0,6] as indicated above, the fit will converge correctly.
By the way, there is a nice feature in LMFIT that lets you specify
which parameters you would like to fit and which you would like to keep
fixed. It is the FITA keyword. I've
implemented a similar feature into my highly modified version of
CURVEFIT, and I
hope that RSI will modify curvefit to do the same thing.
Dick French
rfrench@ahab.wellesley.edu
|
|
|