-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Median-averaging of complex CSDs #12669
Comments
@hadrev agreed they should be processed separately (not 100% sure it's correct but seems reasonable to me), would you be up for making a PR for this? |
Separately median-average real and imaginary components of complex CSDs. This avoids unexpected behavior when np.median is passed a complex array. This addresses scipy#12669
Good catch @hadrev! It definitely looks like that the current behavior of I haven't looked at this carefully yet, but I think that for cross-spectra, we may in fact want something more like a geometric median rather than the medians of the real and imaginary parts of the array, as this may throw away correlations between the two. |
No consensus on this so I'm removing the 1.6.0 milestone |
Separately median-average real and imaginary components of complex CSDs. This avoids unexpected behavior when np.median is passed a complex array. This addresses scipy#12669
* BUG: update median averaging in signal.csd Separately median-average real and imaginary components of complex CSDs. This avoids unexpected behavior when np.median is passed a complex array. This addresses #12669 * Update CSD docstring to mention complex averaging Average the real and imaginary parts separately. Co-authored-by: hadrev <>
signal.csd
does not median-average complex CSDs correctly because of unexpected behavior ofnp.median
for complex-valued arrays (see the numpy issue). Line 589 of signal/spectral.py could be modified so that if the CSD is complex, its real and imaginary parts are separately median-averaged.Reproducing code example:
The real and imaginary parts of
P12
should have similar variances, but in the median-averaged case the variance of the imaginary portion is much too high.Scipy/Numpy/Python version information:
The text was updated successfully, but these errors were encountered: