Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make empirical_cruciform the default for MRS sims. enhance test case.
Browse files Browse the repository at this point in the history
mperrin committed Dec 18, 2024
1 parent 4cc7d40 commit 8b9f8d9
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions stpsf/detectors.py
Original file line number Diff line number Diff line change
@@ -578,7 +578,7 @@ def apply_miri_ifu_broadening(hdulist, options, slice_width=0.196):
"""
# First, check an optional flag to see whether or not to include this effect.
# User can set the option to None to disable this step.
model_type = options.get('ifu_broadening', 'empirical')
model_type = options.get('ifu_broadening', 'empirical_cruciform')

if model_type is None or model_type.lower() == 'none':
return hdulist
@@ -604,7 +604,8 @@ def apply_miri_ifu_broadening(hdulist, options, slice_width=0.196):
beta_width = slice_width / pixelscl
alpha_width = _miri_mrs_analytical_sigma_alpha_broadening(wavelen * 1e6) / pixelscl
out = _miri_mrs_empirical_broadening(psf_model=hdulist[ext].data, alpha_width=alpha_width, beta_width=beta_width)
elif model_type.lower() == 'cruciform':
elif model_type.lower() == 'empirical_cruciform':
# The above empirical mode, plus an additional cruciform effect at < 7.5 microns
# Model based on empirical PSF properties, Argryiou et al.
pixelscl = float(hdulist[ext].header['PIXELSCL'])
wavelen = float(hdulist[ext].header['WAVELEN'])
4 changes: 3 additions & 1 deletion stpsf/tests/test_miri.py
Original file line number Diff line number Diff line change
@@ -233,7 +233,7 @@ def test_miri_ifu_broadening():

miri = stpsf_core.MIRI()
miri.mode = 'IFU'
psf = miri.calc_psf(monochromatic=2.8e-6, fov_pixels=10)
psf = miri.calc_psf(monochromatic=6.8e-6, fov_pixels=20)

fwhm_oversamp = stpsf.measure_fwhm(psf, ext='OVERSAMP')
fwhm_overdist = stpsf.measure_fwhm(psf, ext='OVERDIST')
@@ -243,6 +243,8 @@ def test_miri_ifu_broadening():
fwhm_detdist = stpsf.measure_fwhm(psf, ext='DET_DIST')
assert fwhm_overdist > fwhm_oversamp, "IFU broadening model should increase the FWHM for the distorted extensions"

assert np.isclose(psf['DET_SAMP'].data.sum(), psf['DET_DIST'].data.sum(), rtol=5e-3), "IFU broadening should not change total flux much"

# Now test that we can also optionally turn off that effect
miri.options['ifu_broadening'] = None
psf_nb = miri.calc_psf(monochromatic=2.8e-6, fov_pixels=10)

0 comments on commit 8b9f8d9

Please sign in to comment.