GalSim  2.0
The modular galaxy image simulation toolkit
Public Member Functions | Public Attributes | List of all members
galsim.real.RealGalaxy Class Reference

A class describing real galaxies from some training dataset. More...

Inheritance diagram for galsim.real.RealGalaxy:
galsim.gsobject.GSObject

Public Member Functions

def __init__ (self, real_galaxy_catalog, index=None, id=None, random=False, rng=None, x_interpolant=None, k_interpolant=None, flux=None, flux_rescale=None, pad_factor=4, noise_pad_size=0, area_norm=1.0, gsparams=None, logger=None)
 
def withGSParams (self, gsparams)
 
def makeFromImage (cls, image, PSF, xi, kwargs)
 Create a RealGalaxy directly from image, PSF, and noise description. More...
 
def __eq__ (self, other)
 
def __hash__ (self)
 
def __repr__ (self)
 
def __str__ (self)
 
def __getstate__ (self)
 
def __setstate__ (self, d)
 
def flux (self)
 Whether there are any hard edges in the profile, which would require very small k spacing when working in the Fourier domain. More...
 

Public Attributes

 rng
 
 catalog_file
 
 catalog
 
 gal_image
 
 psf_image
 
 index
 
 pixel_scale
 
 original_psf
 
 original_gal
 

Detailed Description

A class describing real galaxies from some training dataset.

Its underlying implementation uses a Convolution instance of an InterpolatedImage (for the observed galaxy) with a Deconvolution of another InterpolatedImage (for the PSF).

This class uses a catalog describing galaxies in some training data (for more details, see the RealGalaxyCatalog documentation) to read in data about realistic galaxies that can be used for simulations based on those galaxies. Also included in the class is additional information that might be needed to make or interpret the simulations, e.g., the noise properties of the training data. Users who wish to draw RealGalaxies that have well-defined flux scalings in various passbands, and/or parametric representations, should use the COSMOSGalaxy class.

Because RealGalaxy involves a Deconvolution, ‘method = 'phot’` is unavailable for the drawImage() function.

Initialization

>>> real_galaxy = galsim.RealGalaxy(real_galaxy_catalog, index=None, id=None, random=False,
...                                 rng=None, x_interpolant=None, k_interpolant=None,
...                                 flux=None, pad_factor=4, noise_pad_size=0,
...                                 gsparams=None)

This initializes real_galaxy with three InterpolatedImage objects (one for the deconvolved galaxy, and saved versions of the original HST image and PSF). Note that there are multiple keywords for choosing a galaxy; exactly one must be set.

Note that tests suggest that for optimal balance between accuracy and speed, k_interpolant and pad_factor should be kept at their default values. The user should be aware that significant inaccuracy can result from using other combinations of these parameters; more details can be found in http://arxiv.org/abs/1401.2636, especially table 1, and in comment https://github.com/GalSim-developers/GalSim/issues/389#issuecomment-26166621 and the following comments.

If you don't set a flux, the flux of the returned object will be the flux of the original HST data, scaled to correspond to a 1 second HST exposure (though see the area_norm parameter below, and also caveats related to using the flux parameter). If you want a flux appropriate for a longer exposure, or for a telescope with a different collecting area than HST, you can either renormalize the object with the flux_rescale parameter, or by using the exptime and area parameters to drawImage.

Note that RealGalaxy objects use arcsec for the units of their linear dimension. If you are using a different unit for other things (the PSF, WCS, etc.), then you should dilate the resulting object with gal.dilate(galsim.arcsec / scale_unit).

Parameters
real_galaxy_catalogA RealGalaxyCatalog object with basic information about where to find the data, etc.
indexIndex of the desired galaxy in the catalog. [One of index, id, or random is required.]
idObject ID for the desired galaxy in the catalog. [One of index, id, or random is required.]
randomIf True, then select a random galaxy from the catalog. If the catalog has a 'weight' associated with it to allow for correction of selection effects in which galaxies were included, the 'weight' factor is used to remove those selection effects rather than selecting a completely random object. [One of index, id, or random is required.]
rngA random number generator to use for selecting a random galaxy (may be any kind of BaseDeviate or None) and to use in generating any noise field when padding. This user-input random number generator takes precedence over any stored within a user-input CorrelatedNoise instance (see noise_pad parameter below). [default: None]
x_interpolantEither an Interpolant instance or a string indicating which real-space interpolant should be used. Options are 'nearest', 'sinc', 'linear', 'cubic', 'quintic', or 'lanczosN' where N should be the integer order to use. [default: galsim.Quintic()]
k_interpolantEither an Interpolant instance or a string indicating which k-space interpolant should be used. Options are 'nearest', 'sinc', 'linear', 'cubic', 'quintic', or 'lanczosN' where N should be the integer order to use. We strongly recommend leaving this parameter at its default value; see text above for details. [default: galsim.Quintic()]
fluxTotal flux, if None then original flux in image is adopted without change. Note that, technically, this parameter sets the flux of the postage stamp image and not the flux of the contained galaxy. These two values will be strongly correlated when the signal-to-noise ratio of the galaxy is large, but may be considerably different if the flux of the galaxy is small with respect to the noise variations in the postage stamp. To avoid complications with faint galaxies, consider using the flux_rescale parameter. [default: None]
flux_rescaleFlux rescaling factor; if None, then no rescaling is done. Either flux or flux_rescale may be set, but not both. [default: None]
pad_factorFactor by which to pad the Image when creating the InterpolatedImage. We strongly recommend leaving this parameter at its default value; see text above for details. [default: 4]
noise_pad_sizeIf provided, the image will be padded out to this size (in arcsec) with the noise specified in the real galaxy catalog. This is important if you are planning to whiten the resulting image. You should make sure that the padded image is larger than the postage stamp onto which you are drawing this object. [default: None]
area_normArea in cm^2 by which to normalize the flux of the returned object. When area_norm=1 (the default), drawing with drawImage keywords exptime=1 and area=1 will simulate an image with the appropriate number of counts for a 1 second exposure with the original telescope/camera (e.g., with HST when using the COSMOS catalog). If you would rather explicitly specify the collecting area of the telescope when using drawImage with a RealGalaxy, then you should set area_norm equal to the collecting area of the source catalog telescope when creating the RealGalaxy (e.g., area_norm=45238.93416 for HST). [default: 1]
gsparamsAn optional GSParams argument. See the docstring for GSParams for details. [default: None]
loggerA logger object for output of progress statements if the user wants them. [default: None]

Methods

There are no additional methods for RealGalaxy beyond the usual GSObject methods.

Constructor & Destructor Documentation

◆ __init__()

def galsim.real.RealGalaxy.__init__ (   self,
  real_galaxy_catalog,
  index = None,
  id = None,
  random = False,
  rng = None,
  x_interpolant = None,
  k_interpolant = None,
  flux = None,
  flux_rescale = None,
  pad_factor = 4,
  noise_pad_size = 0,
  area_norm = 1.0,
  gsparams = None,
  logger = None 
)

Member Function Documentation

◆ __eq__()

def galsim.real.RealGalaxy.__eq__ (   self,
  other 
)

◆ __getstate__()

def galsim.real.RealGalaxy.__getstate__ (   self)

◆ __hash__()

def galsim.real.RealGalaxy.__hash__ (   self)

◆ __repr__()

def galsim.real.RealGalaxy.__repr__ (   self)

◆ __setstate__()

def galsim.real.RealGalaxy.__setstate__ (   self,
  d 
)

◆ __str__()

def galsim.real.RealGalaxy.__str__ (   self)

◆ flux()

def galsim.gsobject.GSObject.flux (   self)
inherited

Whether there are any hard edges in the profile, which would require very small k spacing when working in the Fourier domain.

◆ makeFromImage()

def galsim.real.RealGalaxy.makeFromImage (   cls,
  image,
  PSF,
  xi,
  kwargs 
)

Create a RealGalaxy directly from image, PSF, and noise description.

Parameters
imageImage of the galaxy you want to simulate.
PSFGSObject representing the PSF of the galaxy image. Note that this PSF should include the response of the pixel convolution.
xiCorrelatedNoise or UncorrelatedNoise object characterizing the noise in the input image.

◆ withGSParams()

def galsim.real.RealGalaxy.withGSParams (   self,
  gsparams 
)

Member Data Documentation

◆ catalog

galsim.real.RealGalaxy.catalog

◆ catalog_file

galsim.real.RealGalaxy.catalog_file

◆ gal_image

galsim.real.RealGalaxy.gal_image

◆ index

galsim.real.RealGalaxy.index

◆ original_gal

galsim.real.RealGalaxy.original_gal

◆ original_psf

galsim.real.RealGalaxy.original_psf

◆ pixel_scale

galsim.real.RealGalaxy.pixel_scale

◆ psf_image

galsim.real.RealGalaxy.psf_image

◆ rng

galsim.real.RealGalaxy.rng

The documentation for this class was generated from the following file: