swagnercarena / paltas

Conduct simulation-based inference on strong gravitational lensing systems.
MIT License
13 stars 12 forks source link

Random Sersic sources #10

Closed JelleAalbers closed 3 years ago

JelleAalbers commented 3 years ago

https://github.com/swagnercarena/manada/pull/6 added CosmosSersicCatalog, which generates Sersic profiles matching individual COSMOS images. This misses out on one significant advantage of analytic profiles: it's easy to create many distinct ones by continuously varying their parameters.

This adds a source class and configuration file to generates random Elliptical Sersic light models. The class is just a few lines, after factoring some common code out from GalaxyCatalog to a new SourceBase class. The tests are probably inadequate (I just test that lenstronomy produces a non-zero image), but the images produced by generate.py using the new config look reasonable (just looking at the separately-normalized PNGs that generate.py outputs, I was too lazy to even check the normalization):

image_0000000image_0000001image_0000002image_0000003image_0000004image_0000005image_0000006image_0000007image_0000008image_0000009 image_0000000image_0000001image_0000002image_0000003image_0000004image_0000005image_0000006image_0000007image_0000008image_0000009

Here are 10 images from CosmosSersicCatalog for comparison:

image_0000000image_0000001image_0000002image_0000003image_0000004image_0000005image_0000006image_0000007image_0000008image_0000009

For each Sersic parameter, the config uses a distribution I roughly fitted to the distribution of the Sersicfit parameters that came with the COSMOS images for z<1. By drawing each parameter independently we probably miss out on all sorts of astrophysically meaningful correlations -- but for realism we have real images.

One exception is the Sersic index n; I draw this uniformly from 1 to 4. COSMOS has a strange distribution with a big mass at n=6, which would give many unrealistically small Einstein rings. Not sure what to make of this, maybe the n=6 fits are poor? Several previous groups (NYU/Liege and Imperial) fixed n=1, which gives quite fat Einstein rings:

image_0000000image_0000001image_0000002image_0000003image_0000004image_0000005image_0000006image_0000007image_0000008image_0000009

Alexander et al. fixed n = 2.5 instead, and I couldn't find what the Harvard group did. Anyhow, plenty of settings to experiment with if we want to try and reproduce some of the literature results.

I noticed I accidentally branched off an earlier unmerged commit that changed the z cut from 0.1 to 1.0 in the galaxy selection. Since it seemed to help a lot, maybe we want this in anyway? If not, or maybe later, happy to undo or rebase.

swagnercarena commented 3 years ago

This all looks good to me. The tests are light as you mentioned, but I think it working with lenstronomy covers the most important failure modes.