GalSim-developers/GalSim — pull request #228 by barnabytprowe (2012-08-04 18:07:48+00:00)
Title: #195 - New GSObjects that store and update their init parameters as attributes

Described on #195, and motivated by the desire to allow the config machinery (#148) to introspect class objects directly so as to learn what parameters they need, we've made a rather large overhaul of the 'atomic' `GSObject` derived classes (i.e. all but the `Add` and `Convolve`).

Main points:

1. We wanted to make the GSObject derived classes (e.g. Gaussian or Exponential) know what parameters they need to initialize themselves, so that user input in config files or catalogues can be parsed. Moving this info into the classes themselves is desirable so that there is no longer any need to keep a separate record (e.g. the `object_param_dict` in `base.py`, which is our old workaround).

2. One way to do this is to make these parameters attributes of the Class, with values that get set when an instance is initialized. Then the config routines can cycle through these attributes and find which ones it needs from the user config files.

3. However, we want these attributes to have some customized behaviour, and so Jim suggested we make them descriptor instances.

There is a good bit extra overhead associated with this scheme, but it does mean that the parameters are available for query, and update each other, in a nice way. See #195.

There are also some things that need to be done, which I propose to do either on this same branch after a successful pull or in a new issue:

1. A record of applied shears and other transformations needs to be kept with the GSObjects. Note that the application of a transformation does not now invalidate the `object.fwhm` attribute that replaces `object.getFWHM()` (for example). Test script code testing this is commented out. Currently you could have a magnified object which reports its FWHM as being its original size: we probably don't want that.

2. It would be nice to store all the parameters for the atomic objects stored in the compound `Add` and `Convolve`.

I have to finish packing this weekend, but wanted to get this up for comment / debate! Will pick it up again either tomorrow or Tuesday...