Closed kenjimarshall closed 2 years ago
Hi @kenjimarshall thanks for the contribution! Do you mind adding a few extra things?
what's_new.rst
file inside doc/
?examples/
showing the difference (perhaps a simulation similar to one of the existing examples, or in the attached paper) between dPLI and PLI? It would be nice to be able to communicate to users what are the (nuanced) differences pros/cons of dPLI vs other related measures. Perhaps the title of the example could be something along the lines of Directed vs Weighted Phase Lag Index
Hi @adam2392 yes I'll work on the example! And update the whats_new.rst
.
As per the unit tests, all the errors are from test_spectral_connectivity_time_resolved
and test_time_resolved_spectral_conn_regression
whenever the multitaper method is used. In particular, a shape mismatch keeps getting raised at line 219 in time.py
.
E.g.
___________ test_spectral_connectivity_time_resolved[multitaper-coh] ___________
mne_connectivity/spectral/tests/test_spectral.py:476: in test_spectral_connectivity_time_resolved
data, freqs=freqs, method=method, mode=mode)
mne_connectivity/spectral/time.py:219: in spectral_connectivity_time
conn[epoch_idx, ...] = np.stack(conn_tr, axis=1)
E ValueError: shape mismatch: value array of shape (2,6,3,18,256) could not be broadcast to indexing result of shape (2,6,18,256)
I'm not sure if/how my changes are causing this, but I can take a closer look at it if you'd like.
As per the unit tests, all the errors are from
test_spectral_connectivity_time_resolved
andtest_time_resolved_spectral_conn_regression
whenever the multitaper method is used. In particular, a shape mismatch keeps getting raised at line 219 intime.py
.___________ test_spectral_connectivity_time_resolved[multitaper-coh] ___________ mne_connectivity/spectral/tests/test_spectral.py:476: in test_spectral_connectivity_time_resolved data, freqs=freqs, method=method, mode=mode) mne_connectivity/spectral/time.py:219: in spectral_connectivity_time conn[epoch_idx, ...] = np.stack(conn_tr, axis=1) E ValueError: shape mismatch: value array of shape (2,6,3,18,256) could not be broadcast to indexing result of shape (2,6,18,256)
Is dPLI a symmetric measure, or is it asymmetric because it is directed? If so, then it's because the data structure constructed assumes a symmetric array. I can take a look later
Yes dPLI is asymmetric, so that could be it. Let me know how I should approach this.
Hmmm... weird. I cannot reproduce the error locally.
Can you give me permissions on your fork account? In the meantime, feel free to work on the example.
I just gave you write permissions on the fork. I will work on the example in the meantime.
@kenjimarshall I believe I fixed the issue. It was unrelated to your additions.
The spectral connectivity over time has some issues, and are being sorted out right now still in #73
Great thank you!
I'm getting some warnings when I build the docs locally for spectral_connectivity_time
WARNING: [numpydoc] Validation warnings while processing docstring for 'mne_connectivity.spectral_connectivity_time':
PR01: Parameters {'sm_kernel'} not documented
PR02: Unknown parameters {'kernel'}
PR09: Parameter "sm_freqs" description should finish with "."
I just made those minor changes to fix circleCI.
@kenjimarshall I've merged in extra changes from main branch here. Ping me when you want me to review the example
Hi @kenjimarshall any challenges finishing this off?
Hi @adam2392 thanks for checking in. I'm actually just going through final revisions today and should have it submitted either today or tomorrow.
Hi @adam2392 -- the example is now included
Great start and contribution @kenjimarshall ! I'm pinging some other folks here to take a look, since examples should always be pretty generally understandable by a new user/viewer.
This might go through some reviews if you're okay with that. Just want to iterate to make sure the example is as good as possible before merging in.
Hi @adam2392, I just wanted to check in on this PR. Let me know if there are any other changes I can make while the example awaits further review.
@agramfort @britta-wstnr @larsoner any thoughts?
I'll give the other MNE folks some time in case they wanted to check it out before merging in by end of the day today, but it looks good to me.
Thanks @kenjimarshall !
My pleasure!
PR Description
Closes: #77
Implementation of dPLI added to the
spectral_connectivity_epochs
module.Merge checklist
Maintainer, please confirm the following before merging: