astropy/astropy — pull request #2054 by nden (2014-02-06 18:26:27+00:00)
Title: Allow array parameters

This is an attempt to fix #2049.

However, I noticed some type of persistence between instances of a model (in some cases) which I can't explain. Here's an example with the existing code:

```
from astropy.modeling.tests.test_parameters import TestParModel
import numpy as np
c = np.array([[1,2], [3,4]])
# this works
t = TestParModel(coeff=c, e=1, param_dim=2)
# this repeats the value of parameter "e" param_dim times

# this fails because the required shape for coeff is now ()
t = TestParModel(coeff=c, e=1, param_dim=1)
```
This only fails if I create an instance of the model with param_dim>1 first.

I think this is due to the "magic" in `ParametricModel._initialize_parameters` which tries to "save" the user to type a few characters by looking at `param_dim` and repeating a value of a parameter if it's a scalar, so that the first example will work. I think this complicates the code and prevents a use case like the second one to work easily.
Another potential contribution to the problem comes from the fact that models are written in way to allow users to omit the `param_dim` parameter even if it is > 1 by trying to determine what the user meant from the size of the parameters. This naturally prevents iterables to be used as parameters with param_dim=1.
So, in short, if the analysis is correct, I would think we should keep this a bit simpler and not allow use cases as the first example.