Skip to content

Commit

Permalink
use doubles for filter coefficients used with fft in refpix
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed May 28, 2024
1 parent f866557 commit 67c779b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------

Expand Down
8 changes: 4 additions & 4 deletions jwst/refpix/irs2_subtract_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down

0 comments on commit 67c779b

Please sign in to comment.