-
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
[Feature] pairwise phase consistency #392
base: master
Are you sure you want to change the base?
Conversation
Hello @TRuikes! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2023-09-25 09:45:53 UTC |
Hi Thijs, The tests are missing. If you're lazy to write them, I can come up with something, though I'm not an expert in this field. |
bibtex citation, doc style
Allright, thanks for the quick response! I'll think of some tests (wasn't too lazy, just didn't want spend time before knowing if you were going to use it ;) ) and add myself to authors. The authors made impoved versions of PPC (this one they call 'ppc0' and then there are two more, I think). Long story short, when computing PPC between pairs, they dont want to draw samples from the same trial (their full reasoning written here, due to spiking properties of a neuron). To compute this I'd have to give information on trial nr per phase. I think I'll add an optional keyword I'm going to work on this next week again (monday), so I'll push something around then. |
Yes, you're right, I didn't think of that. Regarding your previous comment about ppc1, if you think that it could take much time or you're unsure how to implement this additional feature that potentially (!) improves the estimate, it's better to come up with another pull request that addresses the improvement after this PR is merged. |
-changed np.tile to np.broadcast_to -added dtype=np.float32 added tests in test_phase_analysis.py
Let me know when it's ready for review. |
It's ready for review! I'm allready testing it on a (large) dataset and will let you know if something comes up. |
If I'm supposed to do something please let me know |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a PR again TRuikes#2
There was a todo "handle nans". Nans can occur iff the sum is zero and n_trials=1. In such cases, nans are the valid output.
Once the PR is merged, I merge this.
Hi @TRuikes , Since I am taking over this PR, I am unfortunately not familiar with all the details.
If there is anything blocking progress on this project, that I could help to solve, please let me know, I am happy to do my part. Update
|
# Conflicts: # doc/authors.rst # doc/bib/elephant.bib # doc/reference/phase_analysis.rst # elephant/phase_analysis.py
Fixed many small things about PPC0
Hi @Moritz-Alexander-Kern , happy to help. I talked to @rjurkus about this briefly, he mentioned there might be a need for more tests. I'm also happy to work on those, but that will be after september. |
Hi @TRuikes , |
Hi!
In our lab we are using 'pairwise phase consistency' as a metric to measure spike-LFP interactions. The conventional method 'Phase Locking Value' can give faulty output if there are few spikes, and PPC improves on this. (function as implemented by authors. In short you compute the phase of an lfp during spike times (spike_triggered_phase) and then compute the angular distance between each pair of phases.
The output for the function
phase_analysis.spike_triggered_phase
can be directly fed into this function. While PPC can also be used to compute synchony between two EEG/LFP signals, I think there are allready other (better) measures for this and we can leave it at this simple implementation for now.It can be a nice addition, let me know if you want to add this and if so what you would like me to change/add. In addition I suggest a tutorial on 'spike-field' functionality of elephant, briefly describing basic LFP processing steps (filtering, hilbert transform) and possible metrics/functions (spike_triggered_phase, sta.spike_field_coherence, sta.spike_triggered_average (<-that's PLV)).