Skip to content

Commit

Permalink
[DOC] Update functon-container cross-references and fix incorrect typ…
Browse files Browse the repository at this point in the history
…es (#214)
  • Loading branch information
tsbinns authored Jul 12, 2024
1 parent d6982d1 commit 1de4097
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 37 deletions.
18 changes: 16 additions & 2 deletions mne_connectivity/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,9 @@ class SpectralConnectivity(BaseConnectivity, SpectralMixin):
See Also
--------
mne_connectivity.phase_slope_index
mne_connectivity.spectral_connectivity_epochs
mne_connectivity.spectral_connectivity_time
"""

expected_n_dim = 2
Expand Down Expand Up @@ -998,6 +1000,11 @@ class SpectroTemporalConnectivity(BaseConnectivity, SpectralMixin, TimeMixin):
%(spec_method)s
%(n_epochs_used)s
%(connectivity_kwargs)s
See Also
--------
mne_connectivity.phase_slope_index
mne_connectivity.spectral_connectivity_epochs
"""

def __init__(
Expand Down Expand Up @@ -1045,6 +1052,10 @@ class EpochSpectralConnectivity(SpectralConnectivity):
%(method)s
%(spec_method)s
%(connectivity_kwargs)s
See Also
--------
mne_connectivity.spectral_connectivity_time
"""

# whether or not the connectivity occurs over epochs
Expand Down Expand Up @@ -1090,6 +1101,11 @@ class EpochTemporalConnectivity(TemporalConnectivity):
%(indices)s
%(method)s
%(connectivity_kwargs)s
See Also
--------
mne_connectivity.envelope_correlation
mne_connectivity.vector_auto_regression
"""

# whether or not the connectivity occurs over epochs
Expand Down Expand Up @@ -1179,7 +1195,6 @@ class Connectivity(BaseConnectivity):
See Also
--------
mne_connectivity.vector_auto_regression
mne_connectivity.envelope_correlation
"""

def __init__(
Expand Down Expand Up @@ -1224,7 +1239,6 @@ class EpochConnectivity(BaseConnectivity):
See Also
--------
mne_connectivity.vector_auto_regression
mne_connectivity.envelope_correlation
"""

# whether or not the connectivity occurs over epochs
Expand Down
19 changes: 8 additions & 11 deletions mne_connectivity/effective.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def phase_slope_index(
A positive value means that time series 0 is ahead of time series 1 and
a negative value means the opposite.
The PSI is computed from the coherency (see spectral_connectivity_epochs),
The PSI is computed from the coherency (see :func:`spectral_connectivity_epochs`),
details can be found in :footcite:`NolteEtAl2008`.
Parameters
Expand Down Expand Up @@ -103,16 +103,13 @@ def phase_slope_index(
Returns
-------
conn : instance of Connectivity
Computed connectivity measure(s). Either a
``SpectralConnnectivity``, or ``SpectroTemporalConnectivity``
container. The shape of each array is either
(n_signals ** 2, n_bands) mode: 'multitaper' or 'fourier'
(n_signals ** 2, n_bands, n_times) mode: 'cwt_morlet'
when "indices" is None, or
(n_con, n_bands) mode: 'multitaper' or 'fourier'
(n_con, n_bands, n_times) mode: 'cwt_morlet'
when "indices" is specified and "n_con = len(indices[0])".
conn : instance of SpectralConnectivity or SpectroTemporalConnectivity
Computed connectivity measure(s). Either a :class:`SpectralConnectivity`, or
:class:`SpectroTemporalConnectivity` container. The shape of each array is
either (n_signals ** 2, n_bands) mode: 'multitaper' or 'fourier' (n_signals **
2, n_bands, n_times) mode: 'cwt_morlet' when "indices" is None, or (n_con,
n_bands) mode: 'multitaper' or 'fourier' (n_con, n_bands, n_times) mode:
'cwt_morlet' when "indices" is specified and "n_con = len(indices[0])".
See Also
--------
Expand Down
14 changes: 7 additions & 7 deletions mne_connectivity/envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def envelope_correlation(
the correlation matrix will not be returned with
absolute values.
log : bool
If True (default False), square and take the log before orthonalizing
If True (default False), square and take the log before orthogonalizing
envelopes or computing correlations.
absolute : bool
If True (default), then take the absolute value of correlation
Expand All @@ -51,29 +51,29 @@ def envelope_correlation(
Returns
-------
corr : instance of EpochConnectivity
corr : instance of EpochTemporalConnectivity
The pairwise orthogonal envelope correlations.
This matrix is symmetric. The array
will have three dimensions, the first of which is ``n_epochs``.
The data shape would be ``(n_epochs, (n_nodes + 1) * n_nodes / 2)``.
See Also
--------
mne_connectivity.EpochConnectivity
mne_connectivity.EpochTemporalConnectivity
Notes
-----
This function computes the power envelope correlation between
orthogonalized signals :footcite:`HippEtAl2012,KhanEtAl2018`.
If you would like to combine Epochs after the fact using some
function over the Epochs axis, see the ``combine`` function from
`EpochConnectivity` classes.
If you would like to combine Epochs after the fact using some function over the
Epochs axis, see the :meth:`~EpochTemporalConnectivity.combine` method of the
:class:`EpochTemporalConnectivity` class.
References
----------
.. footbibliography::
""" # noqa
"""
_check_option("orthogonalize", orthogonalize, (False, "pairwise"))
from scipy.signal import hilbert

Expand Down
13 changes: 7 additions & 6 deletions mne_connectivity/spectral/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,10 +728,11 @@ def spectral_connectivity_epochs(
Returns
-------
con : array | list of array
Computed connectivity measure(s). Either an instance of
``SpectralConnectivity`` or ``SpectroTemporalConnectivity``.
The shape of the connectivity result will be:
con : instance of SpectralConnectivity or SpectroTemporalConnectivity | list
Computed connectivity measure(s). An instance of :class:`SpectralConnectivity`,
:class:`SpectroTemporalConnectivity`, or a list of instances corresponding to
connectivity measures if several connectivity measures are specified. The shape
of the connectivity result will be:
- ``(n_cons, n_freqs)`` for multitaper or fourier modes
- ``(n_cons, n_freqs, n_times)`` for cwt_morlet mode
Expand Down Expand Up @@ -759,8 +760,8 @@ def spectral_connectivity_epochs(
measure is stationary. The spectral measures implemented in this function
are computed across Epochs. **Thus, spectral measures computed with only
one Epoch will result in errorful values and spectral measures computed
with few Epochs will be unreliable.** Please see
``spectral_connectivity_time`` for time-resolved connectivity estimation.
with few Epochs will be unreliable.** Please see :func:`spectral_connectivity_time`
for time-resolved connectivity estimation.
The spectral densities can be estimated using a multitaper method with
digital prolate spheroidal sequence (DPSS) windows, a discrete Fourier
Expand Down
17 changes: 8 additions & 9 deletions mne_connectivity/spectral/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,15 @@ def spectral_connectivity_time(
Returns
-------
con : instance of Connectivity | list
con : instance of EpochSpectralConnectivity or SpectralConnectivity | list
Computed connectivity measure(s). An instance of
:class:`EpochSpectralConnectivity`, :class:`SpectralConnectivity`
or a list of instances corresponding to connectivity measures if
several connectivity measures are specified.
The shape of each connectivity dataset is (n_epochs, n_cons, n_freqs).
When "indices" is None and a bivariate method is called,
"n_cons = n_signals ** 2", or if a multivariate method is called
"n_cons = 1". When "indices" is specified, "n_con = len(indices[0])"
for bivariate and multivariate methods.
:class:`EpochSpectralConnectivity`, :class:`SpectralConnectivity`, or a list of
instances corresponding to connectivity measures if several connectivity
measures are specified. The shape of each connectivity dataset is ([n_epochs,]
n_cons, n_freqs). When "indices" is None and a bivariate method is called,
"n_cons = n_signals ** 2", or if a multivariate method is called "n_cons = 1".
When "indices" is specified, "n_con = len(indices[0])" for bivariate and
multivariate methods.
See Also
--------
Expand Down
5 changes: 3 additions & 2 deletions mne_connectivity/vector_ar/var.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ def vector_auto_regression(
Returns
-------
conn : Connectivity | TemporalConnectivity | EpochConnectivity
conn : Connectivity | EpochConnectivity | EpochTemporalConnectivity
The connectivity data estimated.
See Also
--------
mne_connectivity.Connectivity
mne_connectivity.EpochConnectivity
mne_connectivity.EpochTemporalConnectivity
Notes
-----
Expand Down Expand Up @@ -126,7 +127,7 @@ def vector_auto_regression(
References
----------
.. footbibliography::
""" # noqa
"""
if model not in ["avg-epochs", "dynamic"]:
raise ValueError(
f'"model" parameter must be one of ' f"(avg-epochs, dynamic), not {model}."
Expand Down

0 comments on commit 1de4097

Please sign in to comment.