GalSim icon indicating copy to clipboard operation
GalSim copied to clipboard

Make it easier to access the zphot record in the COSMOS catalog

Open rmjarvis opened this issue 6 years ago • 1 comments

@rearmstr asked about accessing the redshift information that is in the COSMOS catalog for use with an NFWHalo simulation (which uses the redshift of each galaxy to compute the correct amount of lensing).

It doesn't seem like there is currently any easy way to do this either in config (his use case) or even using the regular COSMOSCatalog class. It requires a bit of insider knowledge of the record attribute and such.

Anyway, here is the custom ValueType code that I proposed to access this value from a config file:

def COSMOS_ZPhot(config, base, value_type):
    cosmos_cat = galsim.config.GetInputObj('cosmos_catalog', config, base, 'COSMOS_ZPhot')
    # Requires that galaxy uses an explicit index.
    # This will raise an exception if index is not set.
    index = galsim.config.GetCurrentValue('gal.index', base, value_type=int)
    record = cosmos_cat.getParametricRecord(index)
    return record['zphot']

However, it requires that the gal object explicitly set the index to be used. It can be simply type : Random, which will approximate the effect of not using an explicit type, just without the optional weight scheme for selecting an appropriate galaxy.

I propose the following updates in this issue:

  • Put something like the above code into GalSim-proper, so as not to require a custom type to do this
  • Have the regular COSMOSGalaxy code store the index that gets used somewhere, whether it is set via an explicit index parameter or not (including if the weights are used).
  • Update the above code to use the stored index value, rather than using GetCurrentValue.
  • Maybe also add a few other accessors. E.g. flux, half-light-radius, others?
  • Probably also make the config code not require the galaxy type to be COSMOSGalaxy in order to use these accessors.
  • Add this to the demo9 example. It is currently our example for InclinedExponential, but it would be nice if we could take the size, flux, and redshift from the COSMOS catalog using the above new accessors.

rmjarvis avatar Mar 12 '18 19:03 rmjarvis

This all sounds good to me.

rmandelb avatar Mar 16 '18 01:03 rmandelb

Done via #1174

rmjarvis avatar Aug 15 '22 20:08 rmjarvis