8000 BUG: specify axis for np.mean() in mlab.cohere_pairs · matplotlib/matplotlib@71a9e15 · GitHub
[go: up one dir, main page]

Skip to content

Commit 71a9e15

Browse files
committed
BUG: specify axis for np.mean() in mlab.cohere_pairs
This bug probably resulted from a change long ago in the numeric/numpy history in which the default behavior of mean() changed from operating over the first axis to operating over the entire array.
1 parent 332faa6 commit 71a9e15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/mlab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ def cohere_pairs( X, ij, NFFT=256, Fs=2, detrend=detrend_none,
638638
FFTSlices[iCol] = < 9462 span class=pl-v>Slices
639639
if preferSpeedOverMemory:
640640
FFTConjSlices[iCol] = np.conjugate(Slices)
641-
Pxx[iCol] = np.divide(np.mean(abs(Slices)**2), normVal)
641+
Pxx[iCol] = np.divide(np.mean(abs(Slices)**2, axis=0), normVal)
642642
del Slices, ind, windowVals
643643

644644
# compute the coherences and phases for all pairs using the
@@ -656,7 +656,7 @@ def cohere_pairs( X, ij, NFFT=256, Fs=2, detrend=detrend_none,
656656
Pxy = FFTSlices[i] * FFTConjSlices[j]
657657
else:
658658
Pxy = FFTSlices[i] * np.conjugate(FFTSlices[j])
659-
if numSlices>1: Pxy = np.mean(Pxy)
659+
if numSlices>1: Pxy = np.mean(Pxy, axis=0)
660660
#Pxy = np.divide(Pxy, normVal)
661661
Pxy /= normVal
662662
#Cxy[(i,j)] = np.divide(np.absolute(Pxy)**2, Pxx[i]*Pxx[j])

0 commit comments

Comments
 (0)
0