Skip to content

Commit 9bb7667

Browse files
committed
Make np where args explicit with out=.
1 parent 43d4215 commit 9bb7667

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/aspire/classification/legacy_implementations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def bispec_2drot_large(coef, freqs, eigval, alpha, sample_n, seed=None):
145145
# This became a problem with very noisy images...
146146
p = np.power(eigval, alpha)
147147
mask = np.where(p, p, -1) # taking the log in the next step will yield a 0
148-
m = np.exp(o1 * np.log(p, where=(mask > 0)))
148+
m = np.exp(o1 * np.log(p, where=(mask > 0), out=None))
149149
p_m = m / m.sum()
150150
x = random(size=len(m), seed=seed)
151151
m_id = np.where(x < sample_n * p_m)[0]

src/aspire/utils/matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def fix_signs(u):
364364
# Create array of sign corrections
365365
signs = np.take_along_axis(u, np.expand_dims(index_array, axis=0), axis=0).squeeze()
366366
_abs = np.absolute(signs)
367-
signs = np.divide(_abs, signs, where=_abs != 0)
367+
np.divide(_abs, signs, out=signs, where=_abs != 0)
368368

369369
# Now we only care about the sign +1/-1.
370370
# The following corrects for any numerical division noise,

tests/test_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def testFixSigns(self):
190190
"""
191191

192192
# Create simple array
193-
x = np.arange(25).reshape(5, 5)
193+
x = np.arange(25, dtype=np.float32).reshape(5, 5)
194194
# Set diagonal elements = -1
195195
x[np.diag_indices_from(x)] *= -1
196196
# Negate largest elem (last row) of first col

0 commit comments

Comments
 (0)