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:
- exposure
lsst.afw.image.ExposureF
The exposure to inject synthetic sources into.
- objects
Generator
[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_name
str
Name of the mask plane to use for the injected sources.
- calib_flux_radius
float
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_max
int
Maximum allowed size of the drawn object. If the object is larger than this, the draw size will be clipped to this size.
- inject_variance
bool
Whether, when injecting flux into the image plane, to inject a corresponding amount of variance into the variance plane.
- add_noise
bool
Whether to randomly vary the amount of injected image flux in each pixel by an amount consistent with the amount of injected variance.
- noise_seed
int
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_names
list[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.
- logger
lsst.utils.logging.LsstLogAdapter
, optional Logger to use for logging messages.
- exposure
- Returns:
- draw_sizes
list
[int
] Draw sizes of the injected sources.
- common_bounds
list
[galsim.BoundsI
] Common bounds of the drawn objects.
- fft_size_errors
list
[bool
] Boolean flags indicating whether a GalSimFFTSizeError was raised.
- psf_compute_errors
list
[bool
] Boolean flags indicating whether a PSF computation error was raised.
- draw_sizes