Render source models as simulated survey observations.
Engine(survey, min_snr, truncate_radius, no_margin, verbose_render)¶
Rendering engine to simulate survey observations.
Any pixels outside of the truncation radius or below the minimum S/N cut will have their flux set to zero in the rendered image. As a result the total rendered flux may be below the total model flux.
- survey (descwl.survey.Survey) – Survey that rendered images will simulate.
- min_snr (float) – Simulate signals from individual sources down to this S/N threshold, where the signal N is calculated for the full exposure time and the noise N is set by the expected fluctuations in the sky background during a full exposure.
- truncate_radius (float) – All extended sources are truncated at this radius in arcseconds.
- no_margin (bool) – Do not simulate the tails of objects just outside the field.
- verbose_render (bool) – Provide verbose output on rendering process.
Add command-line arguments for constructing a new
The added arguments are our constructor parameters with ‘_’ replaced by ‘-‘ in the names. Note that constructor parameter defaults are specified here rather than in the constructor, so that they are included in command-line help.
Parameters: parser (argparse.ArgumentParser) – Arguments will be added to this parser object using its add_argument method.
Describe our rendering configuration.
- Description of the rendering configuration that we be used to simulate
- the survey.
Return type: str
Create a new
Engineobject from a set of arguments.
A newly constructed Engine object.
render_galaxy(galaxy, no_partials=False, calculate_bias=False)¶
Render a galaxy model for a simulated survey.
- (stamps,bounds) where stamps is a
(nstamp,width,height) pixel values that represents nstamp postage-stamp images with the same dimensions (width,height) determined by the rendering options provided. The returned bounds give the position of these stamps within the full simulated survey image as a galsim.BoundsI object. Note that these bounds might extend beyond the survey image, but will always have some overlap where the source is above threshold.
Return type: Raises:
SourceNotVisible– Galaxy has no pixels above threshold that are visible in the simulated survey.
- (stamps,bounds) where stamps is a
GalaxyRenderer(galaxy, stamp, survey)¶
Rendering engine for a single galaxy.
- galaxy (descwl.model.Galaxy) – Model of the galaxy we will render.
- stamp (galsim.Image) – Previously rendered image of this galaxy with no transforms applied. Zero pixels in this image are used to define a mask where all subsequently rendered images will have pixels values set to zero. The input stamp is copied and not modified. The stamp bounds determine the region of the full survey image that we will render into.
- survey (descwl.survey.Survey) – Survey that rendered images will simulate. Used to determine the mapping from survey positions to stamp positions and specify the PSF to use.
draw(df=0.0, dx=0.0, dy=0.0, ds=0.0, dg1=0.0, dg2=0.0)¶
Draw the galaxy with the specified transforms applied.
descwl.galaxy.Galaxy.get_transformed_model()to apply all transforms except for df, which we implement internally using rescaling. The transformed model is convolved with the survey PSF, rendered into the stamp specified in our constructor, and masked (zero pixels in the untransformed rendering are forced to zero). Repeated calls with the same transform parameters return a cached image immediately. The same is true if only the df parameter is changed from the last call.
- df (float) – Relative amount to scale the total galaxy flux.
- dx (float) – Amount to shift centroid in x, in arcseconds.
- dy (float) – Amount to shift centroid in y, in arcseconds.
- ds (float) – Relative amount to scale the galaxy profile in the radial direction while conserving flux, before applying shear or convolving with the PSF.
- dg1 (float) – Amount to adjust the + shear applied to the galaxy profile, with |g| = (a-b)/(a+b), before convolving with the PSF.
- dg2 (float) – Amount to adjust the x shear applied to the galaxy profile, with |g| = (a-b)/(a+b), before convolving with the PSF.
Rendering of the transformed galaxy.