Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulations to test PSF models and shear recovery #30

Closed
esheldon opened this issue Jul 17, 2016 · 19 comments
Closed

Simulations to test PSF models and shear recovery #30

esheldon opened this issue Jul 17, 2016 · 19 comments
Milestone

Comments

@esheldon
Copy link
Collaborator

esheldon commented Jul 17, 2016

Generate galsim simulations of star fields and associated galaxies.

The motivation is

  • Create star images that can fed into a PSF fitting and interpolation algorithm. This is useful in itself, since rho statistics can be computed
  • Create associated galaxy images to be used in shear recovery tests.

These are both important: it may be that two algorithms perform equivalently in rho stats but not in shear recovery.

The sims will ideally have the following features

  • Realistic optical and atmospheric models
  • Pure star fields, with stars placed with some specified density in a focal plane.
  • Separate galaxy images, sampling the same underlying PSF, but at different locations.

If we produce MEDS files for the galaxies a number of people can run on the simulation immediately without any learning curve.

The star fields should represent a single CCD image, with proper WCS etc., which can be fed into standard packages such as PSFEx, and eventually PIFF

I (Erin) am happy to do the leg work running these sims but I need help generating the galsim configuration files

@esheldon
Copy link
Collaborator Author

We might want to launch a new git repository to host the config files and scripts for this sub-project.

@esheldon
Copy link
Collaborator Author

This might be a good start.

https://github.com/rmjarvis/DESWL/blob/master/sims/v005.yaml

It only outputs galaxies, so we need to add some ability to output the star field.

@esheldon
Copy link
Collaborator Author

Need advice from @mjarvis on which branch of galsim supports the new configuration files. Will master work?

@esheldon
Copy link
Collaborator Author

the config I linked doesn't seem to work. I tried on master and #774, so I think I just need to get the right branch from someone

Traceback (most recent call last):
  File "/astro/u/esheldon/envs/psfsim/bin/galsim", line 288, in <module>
    main()
  File "/astro/u/esheldon/envs/psfsim/bin/galsim", line 275, in main
    galsim.config.Process(config, logger, njobs=args.njobs, job=args.job, new_params=new_params)
  File "/astro/u/esheldon/envs/psfsim/lib/python2.7/site-packages/galsim/config/process.py", line 610, in Process
    ImportModules(config)
  File "/astro/u/esheldon/envs/psfsim/lib/python2.7/site-packages/galsim/config/process.py", line 445, in ImportModules
    exec('import '+module)
  File "<string>", line 1, in <module>
  File "./des_wcs.py", line 170, in <module>
    galsim.config.RegisterInputType('des_wcs', DES_FullFieldWCS, ['DES_LocalWCS'])
TypeError: RegisterInputType() takes exactly 2 arguments (3 given)

@rmjarvis
Copy link
Owner

That v005 config file was a strawman that isn't expected to work. In particular, there is currently no implementation of the epoch stuff yet, which will require some development (probably connected to issue #699).

However, the error you ran into is probably because you are using an old version of des_wcs.py. You should get the new one in the master branch of GalSim (which will soon be an official release as v1.4).

@esheldon
Copy link
Collaborator Author

I didn't realize this des_wcs.py was part of galsim

@esheldon
Copy link
Collaborator Author

I tried the v004.yaml, with the newer des_wcs.py, and it runs fine, thanks for the pointers.

Now for a star field

@esheldon
Copy link
Collaborator Author

esheldon commented Jul 18, 2016

I've put some config files here: https://github.com/esheldon/psfsim_config

The star field is in psfsim-stars-v001.yaml

I could use some help making this suitable for our tests; I've marked TODO some things in the file, but also

  • is this producing a variable psf across the field?
  • what is a good distribution function for flux?
  • are are the right DES image parameters?

@rmjarvis
Copy link
Owner

is this producing a variable psf across the field?

No. The psf.index_key = file_num means that this will keep a single PSF model for each output file. And most of the prescriptions for picking parameters are not appropriate for how to construct a reasonable PSF variation across a chip.

For useful tests of PSF interpolation, we'll want the various PSF parameters be functions of (x,y) with the meta-parameters fixed in each file. e.g.

astig1: 
    type: Eval
    str: "mean + a * image_pos.x + b * image_pos.y + c * image_pos.x**2 + d * image_pos.y**2 + e * image_pos.x*image_pos.y"
    fmean: { type: RandomGaussian, sigma: 0.13, index_key: file_num }
    fa: { type: RandomGaussian, sigma: 2.e-3, index_key: file_num }
    fb: { type: RandomGaussian, sigma: 2.e-3, index_key: file_num }
    fc: { type: RandomGaussian, sigma: 1.e-6, index_key: file_num }
    fd: { type: RandomGaussian, sigma: 1.e-6, index_key: file_num }
    fe: { type: RandomGaussian, sigma: 1.e-6, index_key: file_num }

Something like this at least. I don't really know what the right sigmas are here, but I think something around this order of magnitude. And if we do this for all the optical terms, then they will couple non-linearly, so a polynomial interpolation won't be trivially correct, so it will be an interesting test.

@rmjarvis
Copy link
Owner

gain: 2.1 # e- / ADU TODO: match to DES

I think this was the SV value. But Y1 is about 4. And Y3 will be 1.

@rmjarvis
Copy link
Owner

read_noise: 3.4 # Variance in ADU^2 TODO: match to DES

Again, I think I took this from the header of the FITS file for the SV image that we used in the GalSIm example, but I suspect it is different for Y1, and in fact probably varies somewhat from image to image. We should check what the right distribution for this is.

@esheldon
Copy link
Collaborator Author

Those values were from the lsst.yaml file

@rmjarvis
Copy link
Owner

Those values were from the lsst.yaml file

Oh. OK. Here are the values for one random Y1 image:

GAINA   =                4.039 / [electrons/adu] Gain for amp A         
RDNOISEA=                6.139 / [electrons] Read noise for amp A
GAINB   =                3.781 / [electrons/adu] Gain for amp B
RDNOISEB=                5.982 / [electrons] Read noise for amp B

I don't know how stable these values are...

@esheldon
Copy link
Collaborator Author

are those sigmas fractional or absolute?

@esheldon
Copy link
Collaborator Author

Framework for running these sims is here https://github.com/esheldon/psfsim

@rmjarvis
Copy link
Owner

are those sigmas fractional or absolute?

They're the normal definition of sigma for a Gaussian random deviate. N(mu, sigma). You can give a mean too if you like; the default is 0. cf.

https://github.com/GalSim-developers/GalSim/wiki/Config-Values#float_value

@esheldon
Copy link
Collaborator Author

What I meant, is, is sigma=0.13 a 13% scatter or is that the total scatter around the mean. Since it is fmean I thought maybe that was fractional.

@rmjarvis
Copy link
Owner

The f means float. The first letter for eval variables tells the config processing what type to use. cf. https://github.com/GalSim-developers/GalSim/wiki/Config-Values#user-defined-variables

So fmean defines a float variable called mean that is used in the eval string as just mean. Likewise fa, fb, etc. show up in the eval string as a, b, etc.

@esheldon
Copy link
Collaborator Author

I think we can close this issue, since the effort has begun. Let's continue over at https://github.com/esheldon/psfsim_config

@rmjarvis rmjarvis added this to the Version 1.0 milestone Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants