From 9268c4bef3d26a06037eaea50024c44a445f3a82 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Sun, 8 Sep 2024 12:29:06 -0400 Subject: [PATCH 1/2] update change log --- CHANGES.rst | 17 +++++++++++++++++ changes/281.bugfix.rst | 1 - changes/284.general.rst | 1 - 3 files changed, 17 insertions(+), 2 deletions(-) delete mode 100644 changes/281.bugfix.rst delete mode 100644 changes/284.general.rst diff --git a/CHANGES.rst b/CHANGES.rst index f7462f670..1dd1bafd0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,20 @@ +1.8.1 (2024-09-08) +================== + +Bug Fixes +--------- + +- Fixed memory leak in C-extension. (`#281 + `_) + + +General +------- + +- use ``towncrier`` to handle changelog entries (`#284 + `_) + + 1.8.0 (2024-08-14) ================== diff --git a/changes/281.bugfix.rst b/changes/281.bugfix.rst deleted file mode 100644 index 1535f2deb..000000000 --- a/changes/281.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed memory leak in C-extension. diff --git a/changes/284.general.rst b/changes/284.general.rst deleted file mode 100644 index 5019825fe..000000000 --- a/changes/284.general.rst +++ /dev/null @@ -1 +0,0 @@ -use ``towncrier`` to handle changelog entries From eb35e2a151aa2b7100c35f4a67e3a77c87682a2d Mon Sep 17 00:00:00 2001 From: Tyler Pauly Date: Mon, 9 Sep 2024 13:49:14 -0400 Subject: [PATCH 2/2] JP-3664: Numpy 2.0 incompatibility with existing use of newbyteorder (#282) * np2 compatibility * more newbyteorder instances * move change entry to fragment --- changes/282.bugfix.rst | 1 + src/stcal/ramp_fitting/ols_fit.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changes/282.bugfix.rst diff --git a/changes/282.bugfix.rst b/changes/282.bugfix.rst new file mode 100644 index 000000000..d7394df4d --- /dev/null +++ b/changes/282.bugfix.rst @@ -0,0 +1 @@ +Implement byteorder swap method that is forward-compatible with numpy 2.0 in jwst ramp_fitting. \ No newline at end of file diff --git a/src/stcal/ramp_fitting/ols_fit.py b/src/stcal/ramp_fitting/ols_fit.py index 1473dd864..8d95e3690 100644 --- a/src/stcal/ramp_fitting/ols_fit.py +++ b/src/stcal/ramp_fitting/ols_fit.py @@ -687,9 +687,9 @@ def ols_ramp_fit_single(ramp_data, buffsize, save_opt, readnoise_2d, gain_2d, we # ramp fitting. rn_bswap, gain_bswap = bswap if rn_bswap: - readnoise_2d.newbyteorder('S').byteswap(inplace=True) + readnoise_2d.view(readnoise_2d.dtype.newbyteorder('S')).byteswap(inplace=True) if gain_bswap: - gain_2d.newbyteorder('S').byteswap(inplace=True) + gain_2d.view(gain_2d.dtype.newbyteorder('S')).byteswap(inplace=True) c_diff = c_end - c_start log.info(f"Ramp Fitting C Time: {c_diff}") @@ -731,7 +731,7 @@ def handle_array_endianness(arr, sys_order): arr_order = arr.dtype.byteorder bswap = False if (arr_order == ">" and sys_order == "<") or (arr_order == "<" and sys_order == ">"): - arr.newbyteorder('S').byteswap(inplace=True) + arr.view(arr.dtype.newbyteorder('S')).byteswap(inplace=True) bswap = True return arr, bswap