Skip to content

Commit

Permalink
Merge branch 'main' into cacoh
Browse files Browse the repository at this point in the history
  • Loading branch information
tsbinns committed Feb 5, 2024
2 parents 0c90cfa + 196a7fc commit 8789416
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
pyvista: false
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pip setuptools wheel
pip install --upgrade --upgrade-strategy eager .[test]
- if: matrix.mne-version == 'mne-stable'
run: pip install --upgrade mne
Expand Down
1 change: 1 addition & 0 deletions benchmarks/bench_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
against that of statsmodels to prevent us from creating
a dependency on statsmodels.
"""

import numpy as np
from memory_profiler import profile
from statsmodels.tsa.vector_ar.var_model import VAR
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/single_epoch_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
Generate Test Dataset for Spectral Connectivity Over Time With Frites
=====================================================================
As of v0.3, mne-connectivity ported over an implementation for
As of v0.3, mne-connectivity ported over an implementation for
spectral connectivity over epochs. This file will generate the test
dataset used with Frites v0.4.1.
"""

import mne
import numpy as np
from frites.conn import conn_spec
Expand Down
24 changes: 21 additions & 3 deletions mne_connectivity/spectral/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,27 @@ def spectral_connectivity_epochs(
method : str | list of str
Connectivity measure(s) to compute. These can be ``['coh', 'cohy',
'imcoh', 'cacoh', 'mic', 'mim', 'plv', 'ciplv', 'ppc', 'pli', 'dpli',
'wpli', 'wpli2_debiased', 'gc', 'gc_tr']``. Multivariate methods
(``['cacoh', 'mic', 'mim', 'gc', 'gc_tr]``) cannot be called with the
other methods.
'wpli', 'wpli2_debiased', 'gc', 'gc_tr']``. These are:
* %(coh)s
* %(cohy)s
* %(imcoh)s
* %(cacoh)s
* %(mic)s
* %(mim)s
* %(plv)s
* %(ciplv)s
* %(ppc)s
* %(pli)s
* %(pli2_unbiased)s
* %(dpli)s
* %(wpli)s
* %(wpli2_debiased)s
* %(gc)s
* %(gc_tr)s
Multivariate methods (``['cacoh', 'mic', 'mim', 'gc', 'gc_tr]``) cannot
be called with the other methods.
indices : tuple of array | None
Two arrays with indices of connections for which to compute
connectivity. If a bivariate method is called, each array for the seeds
Expand Down
28 changes: 15 additions & 13 deletions mne_connectivity/spectral/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,21 @@ def spectral_connectivity_time(
Only the frequencies within the range specified by ``fmin`` and
``fmax`` are used.
method : str | list of str
Connectivity measure(s) to compute. These can be
``['coh', 'cacoh', 'mic', 'mim', 'plv', 'ciplv', 'pli', 'wpli', 'gc',
'gc_tr']``. These are:
* 'coh' : Coherence
* 'cacoh' : Canonical Coherency (CaCoh)
* 'mic' : Maximised Imaginary part of Coherency (MIC)
* 'mim' : Multivariate Interaction Measure (MIM)
* 'plv' : Phase-Locking Value (PLV)
* 'ciplv' : Corrected imaginary Phase-Locking Value
* 'pli' : Phase-Lag Index
* 'wpli' : Weighted Phase-Lag Index
* 'gc' : State-space Granger Causality (GC)
* 'gc_tr' : State-space GC on time-reversed signals
Connectivity measure(s) to compute. These can be ``['coh', 'cacoh',
'mic', 'mim', 'plv', 'ciplv', 'pli', 'wpli', 'gc', 'gc_tr']``. These
are:
* %(coh)s
* %(cacoh)s
* %(mic)s
* %(mim)s
* %(plv)s
* %(ciplv)s
* %(pli)s
* %(wpli)s
* %(gc)s
* %(gc_tr)s
Multivariate methods (``['cacoh', 'mic', 'mim', 'gc', 'gc_tr]``) cannot
be called with the other methods.
average : bool
Expand Down
17 changes: 17 additions & 0 deletions mne_connectivity/utils/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,23 @@
as xarray ``attrs``.
"""

docdict["coh"] = "'coh' : Coherence"
docdict["cohy"] = "'cohy' : Coherency"
docdict["imcoh"] = "'imcoh' : Imaginary part of coherency"
docdict["cacoh"] = "'cacoh' : Canonical Coherency (CaCoh)"
docdict["mic"] = "'mic' : Maximised Imaginary part of Coherency (MIC)"
docdict["mim"] = "'mim' : Multivariate Interaction Measure (MIM)"
docdict["plv"] = "'plv' : Phase-Locking Value (PLV)"
docdict["ciplv"] = "'ciplv' : Corrected Imaginary PLV (ciPLV)"
docdict["ppc"] = "'ppc' : Pairwise Phase Consistency (PPC)"
docdict["pli"] = "'pli' : Phase Lag Index (PLI)"
docdict["pli2_unbiased"] = "'pli2_unbiased' : Unbiased estimator of squared PLI"
docdict["dpli"] = "'dpli' : Directed PLI (DPLI)"
docdict["wpli"] = "'wpli' : Weighted PLI (WPLI)"
docdict["wpli2_debiased"] = "'wpli2_debiased' : Debiased estimator of squared WPLI"
docdict["gc"] = "'gc' : State-space Granger Causality (GC)"
docdict["gc_tr"] = "'gc_tr' : State-space GC on time-reversed signals"

# Downstream container variables
docdict[
"freqs"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ test = [
'pandas',
'pymatreader',
'PyQt6',
'pytest',
'pytest-cov',
'pytest<8.0.0',
'statsmodels',
]

Expand Down

0 comments on commit 8789416

Please sign in to comment.