barnabytprowe / great3-public

Public repository for the Third Gravitational Lensing Accuracy Testing Challenge
BSD 3-Clause "New" or "Revised" License
9 stars 11 forks source link

Constant galaxy size cuts #25

Open mcmarch opened 10 years ago

mcmarch commented 10 years ago

We’re doing some post-Great3 tests with the BFD code, and we ‘d like to make some further Great3 like simulations with a modification to the galaxy size cut.

We would like to modify the simulations to make a size cut for a fixed galaxy size across all images. Initially we’d like to do this for just one branch - the control ground constant branch.

I think this would require only a small change to the public Great3 simulations code - is the best approach to make the modification in the great3-public/great3sims/mass_produce.py script? [If so, could you point us towards the relevant line numbers?]

msimet commented 10 years ago

I think the code you're looking for is in great3-public/great3sims/galaxies.py. Right now there's a galaxy resolution computed (lines 324/333/349 or lines 337/359, ground/space), and then a resolution cut is applied (line 414) to choose appropriate galaxies. I think you could leave the resolution computation and not use it, but you'd need to compute an analogous size array, and then replace the line in the mask array (line 414) with your new size cut.

I'm not as familiar with the selection catalogs as I should be--looks like the most likely candidate for an already-made size measurement is the flux_radius field from rgc_fits_file, but I don't know if that's right or, if it is, how it's defined. You could also make your own size catalog and just use that of course.

@rmandelb is the real guru of these scripts, but she's on vacation at the moment--you might want to wait for her input instead!

msimet commented 10 years ago

It occurs to me belatedly, you might have meant can you alter the already-created parameter files to generate the sort of sample you want--if so, that's not a thing I know how to do, sorry! Others might though.

rmandelb commented 10 years ago

Hi @mcmarch and @gbernstein -

At present you cannot make this modification in mass_produce.py, which is just a simple driver script. (BTW are you planning to generate the sims on a cluster using PBS? It's set up to use PBS. If that doesn't work for you, you might find that tests/test_run.py is a better script for your purposes since it doesn't assume that you have PBS.)

However, a simple 1-2 line change in the other scripts in great3sims/ should do the job. If you tell me exactly what you want, I can point you to the right lines. You have a few options:

(1) Completely remove the resolution cut. (Probably a bad idea since you'll get lots of barely-resolved stuff.)

(2) Apply the resolution cut in all images according to the median seeing in the branch (or the best seeing, or whatever... the point being to choose some value of seeing and apply the cut to remove the galaxies that are too tiny to see from the ground for some specific value of seeing, ignoring any variation in seeing between the images).

(3) Make all the images have the same seeing, instead of drawing the PSF FWHM from a distribution. That way, a seeing-dependent resolution cut does the same thing in all images.

Since I know that other groups may be interested in this, I think I will make a keyword-argument to the simulation scripts that will let you do this. (The advantage here is that then you could select this option from a driver like mass_produce.py once it's defined as a keyword argument, and you don't have to go around changing hard-coded things.) But I don't want to hold you up until I have time to do that, so just let me know which option you want and I will tell you which lines to modify.

mcmarch commented 10 years ago

Many thanks all for your suggestions. Rachel, could you direct us towards the code modifications for option 2 that you suggest? Thanks!

rmandelb commented 10 years ago

Sure, but you'll have to decide what seeing you want to use for this. The (best, median, worst) seeing values are (0.5, 0.65, 0.8) arcsec, so you can just pick a number you like within that range. Then, go immediately after line 241 in great3sims/galaxies.py, staying inside the "if" statement, and add a line that says tmp_seeing = my_seeing where my_seeing should be whichever value of seeing you want to use to impose the cuts uniformly across all fields.

There's one other consequence of this that you should bear in mind. If you want to make the same apparent size cut for all images, then by definition the limiting S/N will differ in all the images (worse seeing = spread out across more pixels = lower S/N)... unless you also change the typical noise variance in each image to compensate for that. Please let me know if you want to do that and I'll show you how.