From 36728a371379d2fdaa10bfe13ee1bc185005f890 Mon Sep 17 00:00:00 2001 From: Brett Graham Date: Wed, 29 May 2024 10:30:16 -0400 Subject: [PATCH] use doubles for filter values used with fft in refpix (#8512) --- CHANGES.rst | 6 ++++++ jwst/refpix/irs2_subtract_reference.py | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index e8c9eba2e1..cf3a80a9f3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -129,6 +129,12 @@ ramp_fitting fitting or "OLS_C" to use the C extension implementation of ramp fitting. [#8503] +refpix +------ + +- Use ``double`` for fft filter coefficients to improve compatibility + across system. [#8512] + resample -------- diff --git a/jwst/refpix/irs2_subtract_reference.py b/jwst/refpix/irs2_subtract_reference.py index 7eaff7627a..7277a3cfce 100644 --- a/jwst/refpix/irs2_subtract_reference.py +++ b/jwst/refpix/irs2_subtract_reference.py @@ -1082,19 +1082,19 @@ def fill_bad_regions(data0, ngroups, ny, nx, row, scipix_n, refpix_r, pad, hnorm (scipix_n + refpix_r + 2) * ny // 2 - elen // 2 # Construct the filter [1, cos, 0, cos, 1]. - temp_a1 = (np.cos(np.arange(elen, dtype=np.float32) * + temp_a1 = (np.cos(np.arange(elen, dtype=np.float64) * np.pi / float(elen)) + 1.) / 2. # elen = 5000 # blen = 30268 # row * ny // 2 - 2 * blen - 2 * elen = 658552 # len(temp_a2) = 729088 - temp_a2 = np.concatenate((np.ones(blen, dtype=np.float32), + temp_a2 = np.concatenate((np.ones(blen, dtype=np.float64), temp_a1.copy(), np.zeros(row * ny // 2 - 2 * blen - 2 * elen, - dtype=np.float32), + dtype=np.float64), temp_a1[::-1].copy(), - np.ones(blen, dtype=np.float32))) + np.ones(blen, dtype=np.float64))) roll_a2 = np.roll(temp_a2, -1) aa = np.concatenate((temp_a2, roll_a2[::-1]))