esi-neuroscience / syncopy

Systems Neuroscience Computing in Python: user-friendly analysis of large-scale electrophysiology data
BSD 3-Clause "New" or "Revised" License
44 stars 13 forks source link

563 add channelcmb parameter to connectivityanalysis frontend #565

Closed tensionhead closed 1 year ago

tensionhead commented 1 year ago

Changes Summary

Now users can fine tune the channel-pairs for which to compute the connectivity measure as in FieldTrip:

senders = [0, 3] 
receivers = [1, 5, 8]
spy.connectivityanalysis(..., channelcmb=[senders, receivers])

will compute only 6 pairs: (01, 05, 08, 31, 35, 38) and the resulting CrossSpectralData is rectangular in the channel axes with channel_i=senders and channel_j=receivers.

Note: the old way of doing a channel selection on the input:

spy.connectivityanalysis(..., select={'channel': [0, 1, 3, 5, 8]})

would instead compute 20 pairs (+diagonal): the full dyadic (or tensor) product of those 5 channels.

Implementation differs according to the method

Granger causality

CSD/PPC

Coherence

Limitations

Reviewer Checklist

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 76.10% and project coverage change: +0.01% :tada:

Comparison is base (86234a8) 69.31% compared to head (765cf77) 69.33%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #565 +/- ## ========================================== + Coverage 69.31% 69.33% +0.01% ========================================== Files 87 87 Lines 10123 10213 +90 Branches 2125 2151 +26 ========================================== + Hits 7017 7081 +64 - Misses 2533 2545 +12 - Partials 573 587 +14 ``` | [Files Changed](https://app.codecov.io/gh/esi-neuroscience/syncopy/pull/565?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=esi-neuroscience) | Coverage Δ | | |---|---|---| | [syncopy/shared/parsers.py](https://app.codecov.io/gh/esi-neuroscience/syncopy/pull/565?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=esi-neuroscience#diff-c3luY29weS9zaGFyZWQvcGFyc2Vycy5weQ==) | `74.77% <0.00%> (+1.76%)` | :arrow_up: | | [syncopy/connectivity/connectivity\_analysis.py](https://app.codecov.io/gh/esi-neuroscience/syncopy/pull/565?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=esi-neuroscience#diff-c3luY29weS9jb25uZWN0aXZpdHkvY29ubmVjdGl2aXR5X2FuYWx5c2lzLnB5) | `79.85% <71.11%> (-4.46%)` | :arrow_down: | | [syncopy/connectivity/ST\_compRoutines.py](https://app.codecov.io/gh/esi-neuroscience/syncopy/pull/565?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=esi-neuroscience#diff-c3luY29weS9jb25uZWN0aXZpdHkvU1RfY29tcFJvdXRpbmVzLnB5) | `92.56% <100.00%> (+0.53%)` | :arrow_up: | | [syncopy/datatype/selector.py](https://app.codecov.io/gh/esi-neuroscience/syncopy/pull/565?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=esi-neuroscience#diff-c3luY29weS9kYXRhdHlwZS9zZWxlY3Rvci5weQ==) | `73.17% <100.00%> (-0.06%)` | :arrow_down: | | [syncopy/shared/computational\_routine.py](https://app.codecov.io/gh/esi-neuroscience/syncopy/pull/565?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=esi-neuroscience#diff-c3luY29weS9zaGFyZWQvY29tcHV0YXRpb25hbF9yb3V0aW5lLnB5) | `78.89% <100.00%> (+0.55%)` | :arrow_up: | ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/esi-neuroscience/syncopy/pull/565/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=esi-neuroscience)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dfsp-spirit commented 1 year ago

Wow, great to hear that you did not have to mess with the Selector logic at all to allow non-contiguous and unorderd channel_i and channel_j selections.