GalSim-developers/GalSim — pull request #450 by barnabytprowe (2013-07-12 01:24:10+00:00)
Title: #325 - Expanding (and testing) the allowed range of Sersic n values

Hi all,

This is the Pull Request for #325, which was designed to explore by experiment a useable range of Sersic n indices. the primary test was the comparison of photon shooting profiles and DFT-drawn profiles using `hsm.FindAdaptiveMom`.

Quite a lot changed in the course of this long-running issue, covered in some detail on #325 . Changes that fed into this work, some of which are already merged into master:

* The addition of a utility for directly comparing GSObjects by photon shooting versus by DFT. This was #408 / #401 .
* My lame (time consuming) attempts, then Mike's much more thorough rewriting of the way GSParams are handled in the C++ layer, allowing them to be used in a map. This was needed to get some of the GSParams deep into the SBProfiles, particularly the `OneDimensionalDeviate`.
* The clincher, which made everything work well (after many, unsuccessful, tests): #426 / #433 . Here Mike fixed the interpolation used in the lookup tables for Hankel transforms, removing the sharp changes in first derivatives.

What's in this Pull Request therefore is mainly the test scripts, in `devel/external/test_sersic_highn`. The basic pattern was established in `test_sersic_highn_basic.py` - tests were run shooting photons until required statistical uncertainties were achieved, many photons for this level of accuracy.

Many derivatives of the 'basic' test (which uses the default set of GSParams) were run, with filenames indicating which GSParams were changed and by what factor. Before #433 these did not seem to make much improvement (see #325 ), but after this they all became redundant because I believe the default GSParams are adequately representing ellipticities and sizes up to Sersic n ~ 6.2, which is plenty for now.

There are some plots which show this in the repo. These were run for a reduced (but covering the range of interest) set of Sersic n values on Gary's suggestion mid-way through #325 , but I can run more. Here are the shear results post #433 :
![sersic_highn_basic_zoomin_g1](https://f.cloud.github.com/assets/1454961/785839/9d314d5c-ea90-11e2-870a-b79fdfb5f1b1.png)
![sersic_highn_basic_zoomin_g2](https://f.cloud.github.com/assets/1454961/785840/9fea8504-ea90-11e2-99be-466b843ef43a.png)

As discussed on #325, we believe the slope of these relations can be related to a STEP-style m or c bias in the representation of shear. I think we want to shoot for being a factor of 10 smaller than Stage-IV experiment type requirements on m and c (from Massey et al 2012 I think we are therefore aiming for |m| < 2.e-4 and |c| < 2.e-5). The shear slopes match these requirements (just, for n=6.2, but I'm happy with it). I didn't plot the c values as these tests have an isotropic distribution of input ellipticities, there is also not mechanism for generating additive biases in these tests.

We are also interested in representing galaxy sizes well to be able to simulate magnification. Here we also do well:
![sersic_highn_basic_zoomin_sigma](https://f.cloud.github.com/assets/1454961/785856/40b74224-ea91-11e2-9cba-a612f7b773d1.png)

Note when the above tests were run, it should have been possible to generate and measure moments for images with `n=6.5`. However, HSM produced `RuntimeError` exceptions in those cases. In the interests of time, and since there is not thought to be a substantial real population with n=6.5 or above, I did not waste a great deal of time investigating these further.

Finally, therefore, I set the new maximum allowed Sersic n to be `n < 6.2` in `SBSersic.h` based on these results.

There are a couple of things that I could do in addition, but they don't (I expect) change the basic results of this Pull Request, so I will add these as comments below...