abflux_from_photom_keywords

romanisim.image.abflux_from_photom_keywords(model, gain)

Get the electron rate of an AB source implied by an image’s photometric calibration.

L2 images are in DN / s, and the conversion to MJy / sr in meta.photometry.conversion_megajanskys contains a factor of the gain; see romanisim.util.update_photom_keywords. Given the gain, that conversion can be inverted to get the number of electron / s that the image’s calibration assigns to a source of one maggie; this is needed to get Poisson noise calculations correct. We therefore use this abflux computation in L2 source injection given a particular gain to get roughly the right Poisson noise while preserving the total fluxes consistently.

Parameters:
modelroman_datamodels.datamodels.ImageModel

model whose photometry keywords should be inverted

gainfloat [electron / DN]

gain of the image

Returns:
abfluxfloat or None

electron / s corresponding to a source of one maggie, or None if the image lacks valid photometry keywords. The keywords are valid only if both the conversion and the pixel area are positive; this excludes placeholder values like the -999999 in fake data models.