inject_galsim_objects_into_exposure

lsst.source.injection.inject_galsim_objects_into_exposure(exposure: ExposureF, objects: Generator[tuple[lsst.geom.SpherePoint, lsst.geom.Point2D, int, galsim.gsobject.GSObject], None, None], mask_plane_name: str = 'INJECTED', calib_flux_radius: float = 12.0, draw_size_max: int = 1000, inject_variance: bool = True, add_noise: bool = True, noise_seed: int = 0, bad_mask_names: list[str] | None = None, logger: Any | None = None) tuple[list[int], list[galsim.bounds.BoundsI], list[bool], list[bool]]

Inject sources into given exposure using GalSim.

Parameters:
exposurelsst.afw.image.ExposureF

The exposure to inject synthetic sources into.

objectsGenerator [tuple, None, None]

An iterator of tuples that contains (or generates) locations and object surface brightness profiles to inject. The tuples should contain the following elements: lsst.geom.SpherePoint, lsst.geom.Point2D, int, galsim.gsobject.GSObject.

mask_plane_namestr

Name of the mask plane to use for the injected sources.

calib_flux_radiusfloat

Radius in pixels to use for the flux calibration. This is used to produce the correct instrumental fluxes within the radius. The value should match that of the field defined in slot_CalibFlux_instFlux.

draw_size_maxint

Maximum allowed size of the drawn object. If the object is larger than this, the draw size will be clipped to this size.

inject_variancebool

Whether, when injecting flux into the image plane, to inject a corresponding amount of variance into the variance plane.

add_noisebool

Whether to randomly vary the amount of injected image flux in each pixel by an amount consistent with the amount of injected variance.

noise_seedint

Seed for generating the noise of the first injected object. The seed actually used increases by 1 for each subsequent object, to ensure independent noise realizations.

bad_mask_nameslist[str], optional

List of mask plane names indicating pixels to ignore when fitting flux vs variance in preparation for variance plane modification. If None, then the all pixels are used.

loggerlsst.utils.logging.LsstLogAdapter, optional

Logger to use for logging messages.

Returns:
draw_sizeslist [int]

Draw sizes of the injected sources.

common_boundslist [galsim.BoundsI]

Common bounds of the drawn objects.

fft_size_errorslist [bool]

Boolean flags indicating whether a GalSimFFTSizeError was raised.

psf_compute_errorslist [bool]

Boolean flags indicating whether a PSF computation error was raised.