Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include prism bandpasses in the roman module #1307

Merged
merged 11 commits into from
Sep 11, 2024
13 changes: 10 additions & 3 deletions galsim/roman/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@
'H158': 0.04,
'F184': 0.17,
'K213': 4.52,
'W146': 0.98}
'W146': 0.98,
'SNPrism': 0.00,
'Grism_0thOrder': 0.00,
'Grism_1stOrder': 0.00,
}

# Physical pixel size
pixel_scale_mm = 0.01 # mm
Expand All @@ -64,8 +68,11 @@
# Which bands should use the long vs short pupil plane files for the PSF.
# F184, K213
longwave_bands = ['F184', 'K213']
# R062, Z087, Y106, J129, H158, W146
shortwave_bands = ['R062', 'Z087', 'Y106', 'J129', 'H158', 'W146']
# R062, Z087, Y106, J129, H158, W146, SNPrism, Grism_0thOrder, Grism_1stOrder.
# Note that the last three are not imaging bands.
non_imaging_bands = ['Grism_0thOrder', 'Grism_1stOrder', 'SNPrism']
shortwave_bands = ['R062', 'Z087', 'Y106', 'J129', 'H158', 'W146'] \
+ non_imaging_bands

stray_light_fraction = 0.1

Expand Down
12 changes: 8 additions & 4 deletions galsim/roman/roman_bandpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from ..errors import galsim_warn
from .. import Bandpass, LookupTable

def getBandpasses(AB_zeropoint=True, default_thin_trunc=True, **kwargs):
def getBandpasses(AB_zeropoint=True, default_thin_trunc=True, include_all_bands=False, **kwargs):
"""Utility to get a dictionary containing the Roman ST bandpasses used for imaging.

This routine reads in a file containing a list of wavelengths and throughput for all Roman
Expand Down Expand Up @@ -91,12 +91,17 @@ def getBandpasses(AB_zeropoint=True, default_thin_trunc=True, **kwargs):
use no thinning and truncation of bandpasses, or who want control over
the level of thinning and truncation, should have this be False.
[default: True]
include_all_bands: Should the routine include the non-imaging bands (e.g., grisms)?
This does not implement any dispersion physics by itself.
There is currently no estimate for the thermal background for these
bands and they are set to zero arbitrarily.
[default: False]
**kwargs: Other kwargs are passed to either `Bandpass.thin` or
`Bandpass.truncate` as appropriate.

@returns A dictionary containing bandpasses for all Roman imaging filters.
"""
from . import collecting_area
from . import collecting_area, non_imaging_bands

# Begin by reading in the file containing the info.
datafile = os.path.join(meta_data.share_dir, "roman", "Roman_effarea_20210614.txt")
Expand Down Expand Up @@ -134,8 +139,7 @@ def getBandpasses(AB_zeropoint=True, default_thin_trunc=True, **kwargs):
bandpass_dict = {}
# Loop over the bands.
for index, bp_name in enumerate(data.dtype.names[1:]):
# Need to skip the prism and grism (not used for weak lensing imaging).
if bp_name=='SNPrism' or bp_name=='Grism_1stOrder' or bp_name=='Grism_0thOrder':
if include_all_bands is False and bp_name in non_imaging_bands:
continue

# Initialize the bandpass object.
Expand Down
26 changes: 25 additions & 1 deletion tests/test_roman.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,26 @@ def test_roman_bandpass():
for key in nozp_bp:
assert nozp_bp[key].zeropoint is None

@timer
def test_roman_nonimaging_bandpass():
"""Test the Roman non-imaging bandpasses for basic sanity.
"""
bp_imaging = galsim.roman.getBandpasses(AB_zeropoint=True)
bp_all = galsim.roman.getBandpasses(AB_zeropoint=True, include_all_bands=True)

# Check that the imaging bandpasses are in the all bandpasses
for key in bp_imaging:
assert key in bp_all

# Check that the non-imaging bandpasses are in the all bandpasses
assert 'Grism_0thOrder' in bp_all
assert 'Grism_1stOrder' in bp_all
assert 'SNPrism' in bp_all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or do it here, adding the converse asserts that these are not in bp_imaging.


# Check that the non-imaging bandpasses are not in the imaging bandpasses
assert 'Grism_0thOrder' not in bp_imaging
assert 'Grism_1stOrder' not in bp_imaging
assert 'SNPrism' not in bp_imaging

@timer
def test_roman_detectors():
Expand Down Expand Up @@ -783,7 +803,11 @@ def test_roman_basic_numbers():
'H158': 0.04,
'F184': 0.17,
'K213': 4.52,
'W146': 0.98}
'W146': 0.98,
'SNPrism': 0.00,
'Grism_0thOrder': 0.00,
'Grism_1stOrder': 0.00,
}
ref_pupil_plane_file = os.path.join(
galsim.meta_data.share_dir, 'roman', 'SCA2_rim_mask.fits.gz')
ref_stray_light_fraction = 0.1
Expand Down
Loading