From 1830d07ffe94ec4ccd90856d91575221f993a805 Mon Sep 17 00:00:00 2001 From: Jarron Leisenring Date: Mon, 6 Nov 2023 10:47:38 -0700 Subject: [PATCH 1/3] update NRC coron dispersion coeffs --- webbpsf/optics.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/webbpsf/optics.py b/webbpsf/optics.py index c54a1ef7..b10d91c1 100644 --- a/webbpsf/optics.py +++ b/webbpsf/optics.py @@ -1503,13 +1503,23 @@ def __init__(self, instrument, **kwargs): self.fm_long = np.poly1d(lw_focus_cf) # Coronagraphic tilt (`ctilt`) offset model - # Primarily effects the LW channel (approximately a 0.031mm diff from 3.5um to 5.0um). - # SW module is small compared to LW, but we include it for completeness. - # Values have been determined using the Zernike offsets as reported in the - # NIRCam Zemax models. The center reference positions will correspond to the - # NIRCam target acquisition filters (3.35um for LW and 2.1um for SW) - sw_ctilt_cf = np.array([125.849834, -289.018704]) / 1e9 - lw_ctilt_cf = np.array([146.827501, -2000.965222, 8385.546158, -11101.658322]) / 1e9 + # Due to dispersion in the wedge elements, the location of the coronagraphic + # image on the detectors is wavelength dependent. The relative shift of the COM + # features at the image plane in raw pixels: + # LWA (relative to 3.5um) + # 2.5, 3.0, 3.5, 4.0, 4.5 umhttps://www.google.com/search?client=safari&rls=en&q=16&ie=UTF-8&oe=UTF-8 + # -1.43, -0.32, 0.00, -0.15, -0.60 (ypix) + # SWA (relative to 2.0um) + # 0.5, 1.0, 1.5, 2.0, 2.5 um + # 30.51, 8.15, 3.29, 0.00, -3.31 (ypix) + # Note: This does not affect the mapping of the COM to the sky, but the COM and sky + # will both shift on the detector due to the dispersion. + # The final center reference positions will correspond to the NIRCam target acquisition + # filter wavelengths (3.35um for LW and 2.1um for SW). + # For SW filters, we only care about wavelength between 1.7 and 2.3um, which has a linear offset. + sw_ctilt_cf = np.array([-1620.3792, +3240.7584]) / 1e9 + # LW dispersion is a little more complicated, so we use a 3rd order polynomial + lw_ctilt_cf = np.array([-134.9596, +1939.0256, -8683.2786, +12515.1242]) / 1e9 self.ctilt_short = np.poly1d(sw_ctilt_cf) self.ctilt_long = np.poly1d(lw_ctilt_cf) @@ -1591,7 +1601,7 @@ def get_opd(self, wave): tilt_offset = ctilt_model(wave_um) - ctilt_model(ta_ref_wave) _log.info(" Applying OPD tilt adjustment based on NIRCam tilt vs wavelength model") - _log.info(" Modified tilt from {} to {} um: {:.3f} nm wfe".format( + print(" Modified tilt from {} to {} um: {:.3f} nm wfe".format( ta_ref_wave, wave_um, tilt_offset * 1e9) ) From 59c324d3bea8ba564fe82c2a728e5349a3258467 Mon Sep 17 00:00:00 2001 From: Jarron Leisenring Date: Mon, 6 Nov 2023 10:51:45 -0700 Subject: [PATCH 2/3] return print statement to _log.info --- webbpsf/optics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webbpsf/optics.py b/webbpsf/optics.py index b10d91c1..6e09131d 100644 --- a/webbpsf/optics.py +++ b/webbpsf/optics.py @@ -1601,7 +1601,7 @@ def get_opd(self, wave): tilt_offset = ctilt_model(wave_um) - ctilt_model(ta_ref_wave) _log.info(" Applying OPD tilt adjustment based on NIRCam tilt vs wavelength model") - print(" Modified tilt from {} to {} um: {:.3f} nm wfe".format( + _log.info(" Modified tilt from {} to {} um: {:.3f} nm wfe".format( ta_ref_wave, wave_um, tilt_offset * 1e9) ) From 5af8d400c3942c56104013e13207e5dcbeca5ab0 Mon Sep 17 00:00:00 2001 From: Jarron Leisenring Date: Mon, 6 Nov 2023 12:43:21 -0700 Subject: [PATCH 3/3] update test_nircam_coron_wfe_offset --- webbpsf/tests/test_nircam.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/webbpsf/tests/test_nircam.py b/webbpsf/tests/test_nircam.py index ff95f45c..c56f1a44 100644 --- a/webbpsf/tests/test_nircam.py +++ b/webbpsf/tests/test_nircam.py @@ -381,8 +381,8 @@ def test_nircam_coron_wfe_offset(fov_pix=15, oversample=2, fit_gaussian=True): """ Test offset of LW coronagraphic PSF w.r.t. wavelength due to optical wedge dispersion. Option to fit a Gaussian to PSF core in order to better determine peak position. - Difference from 2.5 to 3.3 um should be ~0.015mm. - Difference from 3.3 to 5.0 um should be ~0.030mm. + Difference from 2.5 to 3.3 um should be ~0.025mm. + Difference from 3.3 to 5.0 um should be ~0.021mm. """ # Disable Gaussian fit if astropy not installed @@ -436,12 +436,12 @@ def test_nircam_coron_wfe_offset(fov_pix=15, oversample=2, fit_gaussian=True): yloc.append(xvals[yvals==yvals.max()][0]) yloc = np.array(yloc) - # Difference from 2.5 to 3.3 um should be ~0.015mm + # Difference from 2.5 to 3.3 um should be ~0.025mm diff_25_33 = np.abs(yloc[0] - yloc[1]) - assert np.allclose( diff_25_33, 0.016, rtol=rtol), "PSF shift between {:.2f} and {:.2f} um of {:.3f} mm does not match expected value (~0.016 mm).".format(warr[1], warr[0], diff_25_33) - # Difference from 3.3 to 5.0 um should be ~0.030mm + assert np.allclose( diff_25_33, 0.025, rtol=rtol), "PSF shift between {:.2f} and {:.2f} um of {:.3f} mm does not match expected value (~0.025 mm).".format(warr[1], warr[0], diff_25_33) + # Difference from 3.3 to 5.0 um should be ~0.020mm diff_50_33 = np.abs(yloc[2] - yloc[1]) - assert np.allclose( diff_50_33, 0.032, rtol=rtol), "PSF shift between {:.2f} and {:.2f} um of {:.3f} mm does not match expected value (~0.032 mm).".format(warr[1], warr[2], diff_50_33) + assert np.allclose( diff_50_33, 0.021, rtol=rtol), "PSF shift between {:.2f} and {:.2f} um of {:.3f} mm does not match expected value (~0.021 mm).".format(warr[1], warr[2], diff_50_33) def test_nircam_auto_aperturename(): """