inject_sources_into_l3

romanisim.l3.inject_sources_into_l3(model, cat, x=None, y=None, psf=None, rng=None, psftype='galsim', exptimes=None, seed=None, return_info=False)

Inject sources into an L3 image.

This routine allows sources to be injected onto an existing L3 image. Source injection into an L3 image relies on knowing the objects’ x and y locations, the PSF, and the exposure time; if these are not provided, reasonable defaults are generated.

The simulation proceeds by (optionally) using the model WCS to generate the x & y locations. It also optionally computes an appropriate pixel-convolved PSF for the image. It optionally uses the model Poisson variances and model fluxes to estimate the per-source exposure times appropriate for injecting the sources in the catalog onto the image. Finally, it updates the var_poisson of the input image to account for the additional variance from the added sources.

Parameters:
model: roman_datamodels.datamodels.WfiMosaic

model into which to inject sources

cat: astropy.table.Table

catalog of sources to inject into image

x: list[float] or None

x coordinates of catalog locations in image

y: list[float] or None

y coordinates of catalog locations in image

exptimeslist[float] or None

exposure times of each source. Computed from model.var_poisson and model.flux at each source location if not specified.

psf: galsim.gsobject.GSObject

PSF to use

rng: galsim.BaseDeviate

galsim random number generator to use

seedint

Seed to use for rng

psftypeOne of [‘epsf’, ‘galsim’, ‘stpsf’]

How to determine the PSF.

return_info: bool

if True, return information from romanisim.image.add_objects_to_image.

Returns:
res_modelroman_datamodels.datamodels.WfiMosaic

model with additional sources

resbool (optional)

information from romanisim.image.add_objects_to_image.