GalSim icon indicating copy to clipboard operation
GalSim copied to clipboard

name for correlated noise in config

Open rmandelb opened this issue 8 years ago • 8 comments

Hi @rmjarvis - Do I understand correctly that the only way to make correlated noise using config is with the COSMOS noise option? And that the file_name, cosmos_scale, and variance can be reset to any other correlated noise you want?

If so, I wonder if we could perhaps change the name of this from COSMOS to something more general? The name implies that you can only do COSMOS-like noise, but it seems like it's much more powerful than that. Given those inputs it seems you could make essentially any arbitrary correlated noise field provided that you have a description of its correlation function.

rmandelb avatar Mar 29 '16 14:03 rmandelb

I guess so. But it uses the correlatednoise.getCOSMOSNoise function, so if you want to change the name, we should probably change the name of that function too.

I think @barnabytprowe named it that because we don't have any other examples to use for the file here. cf. this part of the doc string for getCOSMOSNoise:

    This function uses a stacked estimate of the correlation function in COSMOS noise fields.
    The correlation function was computed by the GalSim team as described in

        /YOUR/REPO/PATH/GalSim/devel/external/hst/make_cosmos_cfimage.py

    and the resulting file is distributed with GalSim as

        /YOUR/REPO/PATH/GalSim/share/acs_I_unrot_sci_20_cf.fits

However, I guess one could run make_cosmos_cfimage.py with different input images and produce the correlated noise file for a different telescope.

rmjarvis avatar Mar 29 '16 14:03 rmjarvis

Yes. I'm doing this with an externally-produced noise CF right now, and it's not for COSMOS.

I can think of a few options (other than leaving it as-is):

  1. Leave getCOSMOSNoise and the "COSMOS" noise option as-is, but make a more general one as well, like correlatednoise.getCorrNoise and "Correlated" (for config). That one would not have defaults.
  2. Change the names of the python routine and the config option to be more general, like the options in (1), but let the keywords keep their current COSMOS-specific defaults.
  3. Change the names of the python routine and the config option to be more general, like the options in (1). Make the keywords for filename, pixel scale, and variance not have the COSMOS default, but add a keyword for noise_type that can be set to COSMOS and if so, use the current COSMOS-specific defaults.

By the way, I think this doesn't have to be resolved before we merge the PR for #732. May as well get the bug fix quickly onto master, even if we don't quickly converge to an answer on this issue.

rmandelb avatar Mar 29 '16 15:03 rmandelb

I think I'd be happy with a generic version of this that didn't have defaults (your number 3), but keep the getCOSMOSNoise function (and COSMOS noise type in config) that would just call this generic function with the COSMOS values.

rmjarvis avatar Jun 05 '16 05:06 rmjarvis

OK, that sounds good. But in the meantime - I realized we have the same issue with overly-specific naming for COSMOSCatalog, given that Josh et al are working on an AEGIS-based multi-band catalog.

My suggestion is that we move ahead with v1.4 without this, but during this summer I would like to take care of both of these things. I've assigned myself.

rmandelb avatar Jun 05 '16 16:06 rmandelb

Hi guys! Just thought I'd drop in and say hi and apologies for hardcoding the name cosmos into the getCOSMOSNoise cf function generator :) Great that you're using the same tech with another noise cf Rachel! (I hope it's working OK... Do you run into any issues if the pixel scale of the "cosmos" cf is closer to the pixel scale of the output image? This is a risk due one of the less satisfying approximations we have to make in the modelling of the CF profile so as to give it a finite fourier domain representation.)

This conversation takes me back. The cf was estimated using cutouts of object-free noise from a selection of representative ACS images provided by Alexie Leauthaud early on in the life of the galsim project. In fact I think I may have cobbled together the essentials of make_cosmos_cfimage.py around the time of our first meeting all together at Princeton, when the brief was to try and plan a galaxy image simulator that could handle correlated noise properly (so we could use real galaxies in GREAT3) and (more importantly) be half decent.

barnabytprowe avatar Jun 09 '16 19:06 barnabytprowe

Fun times!

barnabytprowe avatar Jun 09 '16 19:06 barnabytprowe

I haven't run into any issues using this other correlation function, unless my tests haven't been good enough to reveal the issues - my main test was to generate the noise, calculate the correlation function, and compare it with the input one. Seems fine to me.

In fact I think I may have cobbled together the essentials of make_cosmos_cfimage.py around the time of our first meeting all together at Princeton

Sounds about right. You made some plots related to the noise correlation functions and noise whitening already around the time of our HST archival research proposal back in ~2011 or 2012.

rmandelb avatar Jun 10 '16 02:06 rmandelb

Considering that this would probably be an API change (although we could certainly keep the old name as well for backwards compatibility), it might be a good time to try to decide on this and get it into v2.0.

Suggestions:

  • galsim.getCOSMOSNoise(file, rng, cosmos_scale,...) -> galsim.CorrelatedNoise.from_file(file, rng, scale,...)
  • galsim.COSMOSCatalog(file, sample,...) keeps current name, but is a thin wrapper around a galsim.GalaxySample or galsim.TrainingSample which would be the generic back end that could include AEGIS as well.
  • COSMOS noise type in config keeps current name, but builder would be a subclass of CorrelatedNoiseBuilder, which would handle arbitrary input files.
  • cosmos_catalog -> galaxy_sample or training_sample to match above name change.
  • COSMOSGalaxy -> SampleGalaxy or TrainingGalaxy
  • scene.py could also maybe change to something that better matches the name we come up with for the training sample catalog class.

rmjarvis avatar May 07 '18 02:05 rmjarvis

Done via #1174

rmjarvis avatar Aug 15 '22 20:08 rmjarvis