-
Notifications
You must be signed in to change notification settings - Fork 92
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
[Bug] signal_processing.cross_correlation_function() scaling #265
Comments
Thank you for pointing this out! True, these functions should behave as numpy/scipy equivalent with the only difference that the input is AnalogSignal. |
First of all, thank you for the reproducible notebook with the explanations. Seems your suggestion is right, though first I need to understand why the scaling was put in the first place. Maybe, the author of this function wanted to deal with the decaying tails on purpose, I'm not sure. And so I need to look up for the equation in the book the function references to. |
Thanks, Danylo. I think this is a right approach although I could not find the book cited. |
I cannot find the book either. But the comment at line 255
The example you linked in the notebook does not mention bias correction at all. And I'm not sure what the behavior is expected by default in numpy/matlab equivalent - with or without bias correction? |
Link to Matlab scaling options: https://de.mathworks.com/help/matlab/ref/xcorr.html#d117e1608028 |
Thanks, Danylo and Michael, this explains the difference - abs(tau) term provides for an unbiased estimate, which numpy function does not. I agree adding a corresponding argument would make this clear and be more consistent with cross_correlation_histogram. |
Hello @jmbudd |
Potential Issue
The scaling of the cross correlation coefficient may not be correct at least for single pairs of AnalogSignals.
Reproduce
See notebook: https://github.com/jmbudd/misc/blob/master/ElephantCrossCorr.ipynb
(pdf of notebook: https://github.com/jmbudd/misc/blob/master/ElephantCrossCorr.pdf)
Expected Behaviour
The output from elephant code should match numpy/matlab version such that there is a stronger decay with time lag from peak correlation location.
Environment
CPython 3.5.2
IPython 7.8.0
numpy 1.17.3
scipy 1.3.1
neo 0.7.2
elephant 0.6.3
compiler : GCC 5.4.0 20160609
system : Linux
release : 4.4.0-165-generic
machine : x86_64
processor : x86_64
CPU cores : 8
interpreter: 64bit
The text was updated successfully, but these errors were encountered: