astropy/astropy — pull request #1022 by adrn (2013-04-25 16:50:15+00:00)
Title: Renamed parameters in Gaussian and added a cov_matrix kwarg

- Renamed Gauss -> Gaussian
- In `Gauss1D`, changed xsigma, xcen -> sigma, mu
- In `Gauss2D`, changed xsigma, ysigma -> x_sigma, y_sigma and xcen,ycen -> x_mu, y_mu
- In all files, made any abbreviation for 'parameters' = 'param':
+ psets -> param_sets
+ paramdim -> param_dim
+ parnames -> param_names
- In `Gauss2D`, removed the 'ratio' parameter -- too many ways to specify the same thing. Is this really necessary?
- In `Gauss2D`, added x_fwhm and y_fwhm to be consistent...but I would be in favor of removing the fwhm option entirely from both models and just requiring the standard deviation.
- Added a 'cov_matrix' option to `Gaussian2D`, but this is kind of klugy...I think the more general way to think about Gaussians is as a quadratic form -- it naturally generalizes to many dimensions -- so I think the definition in `eval()` should change. But then there's the issue of how to treat the covariance matrix as a `Parameter` (see notes below).

Notes:
--------------

- When I added the cov_matrix option I realized that there is room here for a single `GaussianModel` object that accepts a scalar or vector `mu`, and either `sigma` or `cov_matrix`. `sigma` could be a scalar or vector, in which case the Gaussian is assumed to be aligned with the coordinates, e.g. sqrt of each value along the diagonal of the covariance matrix. This would be a good way to support N-dimensional Gaussians.
- I started implementing the above, but got stuck on some weirdness that was going on with the `Parameter` class. I made the covariance matrix 2-dimensional, but it ends up becoming a list of arrays, so::

array([[0.2,0.],
[0.,0.3]])

becomes

[array([0.2,0.]),array([0.,0.3])]

when I define it as a `Parameter`...Then the fitting all fails because obviously you can't treat the cov. matrix like other parameters when feeding in to a NL fitting algorithm. We should think about this a bit more...