Skip to content

Commit 27fb8b4

Browse files
committed
Prevent inverse_numpy updating flm arg in-place
1 parent bdf8fc9 commit 27fb8b4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

s2fft/transforms/spherical.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ def inverse_numpy(
155155
m_start_ind = L - 1 if reality else 0
156156
L0 = L_lower
157157

158+
# Copy flm argument to avoid in-place updates being propagated back to caller
159+
flm = flm.copy()
160+
158161
# Apply harmonic normalisation
159162
flm[L0:] = np.einsum(
160163
"lm,l->lm", flm[L0:], np.sqrt((2 * np.arange(L0, L) + 1) / (4 * np.pi))

0 commit comments

Comments
 (0)