Skip to content

Missing (and negative) fluxes #70

@arunkannawadi

Description

@arunkannawadi

Cole reported some puzzling behavior with fluxes in the PSF. Here's a minimal reproducible code from him

from roman_imsim.utils import roman_utils
import galsim
import numpy as np
rmutils = roman_utils( "config/tds.yaml", 6, 17 )
sed = galsim.SED( galsim.LookupTable( [1000, 26000], [1, 1], interpolant='linear' ),
                              wave_type='Angstrom', flux_type='fphotons' )
flux = 1
wcs = rmutils.getLocalWCS( 2044, 2044 )
point = ( galsim.DeltaFunction() * sed ).withFlux( flux, rmutils.bpass )
print("point flux:", point.calculateFlux(rmutils.bpass))

psf = galsim.Convolve(point, rmutils.getPSF( 2044, 2044, pupil_bin=8 ))
print("post convolution flux:", psf.calculateFlux(bandpass=rmutils.bpass))


stamp = galsim.Image(1000,1000)
psf.drawImage(rmutils.bpass, method="no_pixel", wcs=wcs,
                              use_true_center=True, image=stamp)
print("sum stamp WCS specified:", np.sum(stamp.array))

stamp = galsim.Image(1000,1000)
psf.drawImage(rmutils.bpass, method="no_pixel", 
                              use_true_center=True, image=stamp)
print("sum stamp no WCS specified:", np.sum(stamp.array))

with outputs as

point flux: 1.0000000000000002
post convolution flux: -0.9999482024841921
sum stamp WCS specified: 0.8644274
sum stamp no WCS specified: 0.9948606

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions