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

Couple small fixes to LRS support #850

Merged
merged 3 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions webbpsf/match_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ def setup_sim_to_match_file(filename_or_HDUList, verbose=True, plot=False, choic
inst.image_mask = 'LYOT2300'
elif header['FILTER'] == 'P750L':
inst.pupil_mask = 'P750L'
if header['APERNAME'] == 'MIRIM_SLIT':
inst.image_mask = 'LRS slit'

if header['APERNAME'] == 'MIRIM_SLIT':
inst.image_mask = 'LRS slit'

# TODO add other per-instrument keyword checks

Expand Down
15 changes: 15 additions & 0 deletions webbpsf/tests/test_miri.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,21 @@ def test_mode_switch():
assert miri.aperturename == 'MIRIFU_CHANNEL2A'
assert imager_pixelscale < miri.pixelscale < 2*imager_pixelscale


# Test also we can switch to LRS, and then back to a regular imaging aperture
# this tests another edge case for aperture and pixel scale switches
miri.set_position_from_aperture_name('MIRIM_SLIT')
assert 'IFU' not in miri.aperturename
assert miri.detector =='MIRIM'
assert miri.aperturename == 'MIRIM_SLIT'
assert miri.pixelscale == imager_pixelscale
miri.set_position_from_aperture_name('MIRIM_FULL')
assert 'IFU' not in miri.aperturename
assert miri.detector =='MIRIM'
assert miri.aperturename == 'MIRIM_FULL'
assert miri.pixelscale == imager_pixelscale


def test_IFU_wavelengths():
""" Test computing the wqvelength sampling for a sim IFU cube """
miri = webbpsf_core.MIRI()
Expand Down
1 change: 1 addition & 0 deletions webbpsf/webbpsf_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ def aperturename(self, value):
# The point is to check if the pixel scale is set to a custom or default value,
# and if it's custom then don't override that.
# Note, check self._aperturename first to account for the edge case when this is called from __init__ before _aperturename is set
# and also check first that it's not a SLIT type aperture, for which the usual _get_pixelscale_from_apername won't work.
# and also check neither current nor requested aperture are of type SLIT since that doesn't have a pixelscale to get.
has_custom_pixelscale = (
self._aperturename
Expand Down
Loading