GalSim-developers/GalSim — pull request #452 by rmjarvis (2013-08-05 14:33:24+00:00)
Title: #449 Changes needed for great3 control branches

This PR includes a number of changes that were either required or deemed helpful in getting the
great3 simulation run working correctly. (So far, just the control branch -- there will be more required for the other branches.)

The changes include:

- Added the ability to have multiple input catalogs in the same config file. And generally, all of the input fields are allowed to be a list. If they are, then you can indicate which catalog to use by specifying `num`. The default is `num=0` which is the first and usually only one. We ended up not using this feature in the end, but I still think it's a cool feature to leave in.
- Added a Dict option to read in a python dictionary from a file. This can be YAML, JSON, or Pickle formats, with the type automatically determined from the extension by default, or specifiable if necessary.
- Changed the name of InputCatalog to just Catalog. Input seemed superfluous and unnecessarily restrictive, since we might eventually use it as a class for writing an output Catalog at some point.
- Made some speedups to the code for InterpolatedImage. Especially KTable interpolate where I use explicit SSE commands if possible. Also a bunch of individually minor micro-optimizations that in aggregate came to about a 10% speedup.
- Updated Add feature in config to skip components with flux=0. This makes using flux=0 an efficient way to use fewer than the normal number of components without requiring calculations that will eventaully be multiplied by 0.
- Added offset as a config option for the image field, which applies the given offset in pixels when calling the draw command. (Added example of this to demo6.)
- Changed lensing module to interpolate mu-1 rather than mu, so the implicit zero padding doesn't mean the edge is a big cliff.
- Improved the accuracy of the small-e approximations in CppShear. The old approximations were only valid to about 1.e-6. Now they are accurate to 1.e-16. We need some kind of special handling near e=0 to avoid division by zero and possible under/overflow issues. But we don't need to sacrifice accuracy to do this, especially since these are never time-critical calculations.
- Introduced UncorrelatedNoise class for the case where we initially have a pure Gaussian field for the noise model, but we want to keep track of the correlations introduced by applications of shear, PSF, etc.
- Updated RealGalaxy and RealGalaxyCatalog to use the new noise_filename field. If not present, use UncorrelatedNoise as the initial noise model. The noise is stored as a gal.noise attribute.

These last two weren't needed yet, but they will be required for the real_galaxy branches. Further work related to this will take place on branch #430. But they do make the code compatible with both the old RealGalaxyCatalogs and with the new ones that Rachel just made (with the noise_filename column).