GalSim-developers/GalSim — pull request #285 by rmjarvis (2012-09-25 07:00:46+00:00)
Title: #243 Updates to the demo*.py and demo*.yaml tutorials

I've added two new demo files to our tutorial sequence, so we're now up to demo10. I've also modified the others a bit to make them read more like a tutorial, so there are longer descriptions for new functionality introduced in each file, but not much about things that have already been seen in previous demo files.

As usual, there were also some changes to the code itself to enable these demo scripts. Most of the changes were in the config parsing code in galsim/config/*.py, but there was some significant changes in lensing.py and some minor changes elsewhere.

The main changes:
- add demo9, which uses the NFWHalo class to make 5 separate files for each of 4 different halo masses. Each file has 20 galaxies scattered around at random positions. Furthermore, the 20 files are made in parallel, and also include bad pixel masks (which are all 0) and weight maps as the 2nd and 3rd hdus respectively.
- add demo10, which uses the PowerSpectrum class to make a tiled image of 10x10 galaxies selecting randomly from 5 particularly irregular RealGalaxy's. The PSF is also variable, and the noise-free PSF image is written as the second hdu.
- make demo4.py not use the config machinery. Rather it now shows how to use an InputCatalog directly.
- make demo8.py use the config machinery. There wasn't much new there aside from the multiprocessing, so it seemed like a good choice for showing how to use the config stuff from within python. The multiprocessing stuff is now in demo9.py.
- update NFWHalo and PowerSpectrum inputs to take more kinds of options for the input positions. Also, the output g1,g2 are scalars if the input had a single element, but lists if not.
- update PowerSpectrum to work for multiple calls to getShear after a first one that sets up the grid. I think this function should really be split up into two different functions, since I think it is currently trying to do too much. But in the interest of maintaining the functionality described in the docstring (albeit as not implemented yet), I did this within the existing structure. My preference would be to have a buildGrid function that builds the initial grid and outputs the numpy arrays g1,g2 and also saves them to the SBInterpolatedImages. Then subsequent calls to getShear(pos) could access those and interpolate to arbitrary locations. Maybe we can look to do this as part of #248.

I'd also appreciate it if people could look over the config [documentation](https://github.com/GalSim-developers/GalSim/wiki/Config-Documentation) as part of this pull request. Maybe some of the people who have recently been doing the doc string reviews could check out this documentation as well to see if I missed anything.