From 70f404575d23f73bcbc81ad28ce7866a2a567c3a Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 18 Oct 2024 16:34:38 -0400 Subject: [PATCH] use descriptive variable names --- src/stcal/outlier_detection/utils.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/stcal/outlier_detection/utils.py b/src/stcal/outlier_detection/utils.py index a910e23d..886fac37 100644 --- a/src/stcal/outlier_detection/utils.py +++ b/src/stcal/outlier_detection/utils.py @@ -93,21 +93,22 @@ def _abs_deriv(array): out[np.isnan(array)] = np.nan # compute row-wise absolute diffference - d = np.abs(np.diff(array, axis=0)) - np.putmask(out[1:], np.isfinite(d), d) # no need to do max yet + row_diff = np.abs(np.diff(array, axis=0)) + np.putmask(out[1:], np.isfinite(row_diff), row_diff) # no need to do max yet # since these are absolute differences |r0-r1| = |r1-r0| # make a view of the target portion of the array - v = out[:-1] + row_offset_view = out[:-1] # compute an in-place maximum - np.putmask(v, d > v, d) + np.putmask(row_offset_view, row_diff > row_offset_view, row_diff) + del row_diff # compute col-wise absolute difference - d = np.abs(np.diff(array, axis=1)) - v = out[:, 1:] - np.putmask(v, d > v, d) - v = out[:, :-1] - np.putmask(v, d > v, d) + col_diff = np.abs(np.diff(array, axis=1)) + col_offset_view = out[:, 1:] + np.putmask(col_offset_view, col_diff > col_offset_view, col_diff) + col_offset_view = out[:, :-1] + np.putmask(col_offset_view, col_diff > col_offset_view, col_diff) return out