From e25d23ee4275fb5acfd34bb4320332a50980bb6e Mon Sep 17 00:00:00 2001 From: Ned Molter Date: Tue, 9 Apr 2024 17:10:31 -0400 Subject: [PATCH 1/2] JP-3589: fixed deprecated code from numpy 2.0 release --- jwst/ami/leastsqnrm.py | 6 +++--- jwst/extract_1d/soss_extract/atoca.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jwst/ami/leastsqnrm.py b/jwst/ami/leastsqnrm.py index 2bc81fce0c..87f011ed63 100644 --- a/jwst/ami/leastsqnrm.py +++ b/jwst/ami/leastsqnrm.py @@ -615,7 +615,7 @@ def matrix_operations(img, model, flux=None, linfit=False, dqm=None): from linearfit import linearfit # dependent variables - M = np.mat(flatimg) + M = np.asmatrix(flatimg) # photon noise noise = np.sqrt(np.abs(flatimg)) @@ -625,9 +625,9 @@ def matrix_operations(img, model, flux=None, linfit=False, dqm=None): # uniform weight wy = weights - S = np.mat(np.diag(wy)) + S = np.asmatrix(np.diag(wy)) # matrix of independent variables - C = np.mat(flatmodeltransp) + C = np.asmatrix(flatmodeltransp) # initialize object result = linearfit.LinearFit(M, S, C) diff --git a/jwst/extract_1d/soss_extract/atoca.py b/jwst/extract_1d/soss_extract/atoca.py index a2afcd81fe..1331c7a7b3 100644 --- a/jwst/extract_1d/soss_extract/atoca.py +++ b/jwst/extract_1d/soss_extract/atoca.py @@ -1485,7 +1485,7 @@ def bin_to_pixel(self, i_order=0, grid_pix=None, grid_f_k=None, convolved_spectr # Integrate integrand = fct_f_k(x_grid) * x_grid - bin_val.append(np.trapz(integrand, x_grid)) + bin_val.append(np.trapezoid(integrand, x_grid)) # Convert to array and return with the pixel centers. return pix_center, np.array(bin_val) From ba2f60ebbeecaf64cfb7c24aee1aa6147675029c Mon Sep 17 00:00:00 2001 From: Ned Molter Date: Tue, 9 Apr 2024 17:16:38 -0400 Subject: [PATCH 2/2] added changelog entry --- CHANGES.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 6899e2c5d3..3e55fec513 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,11 @@ 1.14.1 (unreleased) =================== +ami +--- + +- Replaced deprecated ``np.mat()`` with ``np.asmatrix()``. [#8415] + associations ------------ @@ -16,6 +21,11 @@ documentation - Added docs for the NIRSpec MSA metadata file to the data products area of RTD. [#8399] +extract_1d +---------- + +- Replaced deprecated ``np.trapz`` with ``np.trapezoid()``. [#8415] + pipeline --------