GalSim-developers/GalSim — pull request #154 by rmandelb (2012-05-16 02:28:14+00:00)
Title: #104 - real galaxy data

In branch #104, I've put 100 real galaxies from the training sample into the repository, along with tools to handle the training dataset galaxy catalog, read in the galaxies and their PSFs, and make simulated images from them.

This should be considered an initial design, enough to let us play with real galaxy simulations and explore issues related to accuracy, timing, and so on. I fully expect that when we are dealing with huge numbers of training galaxies, some of this will have to be revamped (to change things like when/how the galaxies are read in, what information is stored, etc.). But this should be enough to set up systematic tests of accuracy and of what steps in the analysis are bottlenecks in terms of timing.

Changes include:
* a class called ```RealGalaxyCatalog``` to store training galaxy catalog information
* a base class called ```RealGalaxy``` to store real galaxies read in from the training dataset. It has all the methods of the standard GalSim base classes, and its member SBProfile is a deconvolved image (fully deconvolved, not pseudo-deconvolved)
* a function called ```simReal``` to simulate a lower-resolution, sheared/rotated/renormalized/resampled version of some ```RealGalaxy```
* updated atmosphere.DoubleGaussian which is more consistent with our newly-adopted ways of specifying radii (#152)
* a Deconvolve base class, which I didn't end up needing but left in because it seemed potentially useful
* a script examples/DemoReal.py that shows example usage. This script is pretty simple, and mostly serves as a guide for usage that might be useful when writing MultiObjectDemo.py script 3 later this week.

To give a sense of where we stand, DemoReal.py reads in a single training galaxy, makes 2 double Gaussian PSFs, 4 simulated images (sheared and unsheared with each of the PSFs), and 4 PSF images, all of which get written to file. This takes 1s to run on my machine, so we're at 0.25s per simulated (galaxy, PSF) pair assuming the PSF is a double Gaussian, without any attempt at optimization. My take is that this is not a bad place to start, and I'm hopeful that we can achieve the factor of ~3 that we would like in order for large amounts of real galaxy simulations to be feasible. Moffat is quite slow, as already noted elsewhere -- the majority of that is making the PSF images, not the galaxies.

Note: I put the training data into examples/data/ so that examples/DemoReal.py can be run while sitting in examples/. These training data take up 6MB total for galaxies and PSFs. I wouldn't want to put much larger files on github, but I think this is okay for now.

Barring major objections, I'd like to merge this into master by Thursday evening, so that we can incorporate it into our final demo script for milestone 2 by the end of Friday.

As usual, comments / concern / question / criticism / etc. are welcome.