Skip to content

Commit

Permalink
Merge pull request #1 from Hiyeri/main
Browse files Browse the repository at this point in the history
add multivar seeds and targets
  • Loading branch information
vss245 authored Oct 13, 2022
2 parents c6b7b4f + cff4213 commit f61f36f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions mne_connectivity/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,40 @@ def seed_target_indices(seeds, targets):

return indices

def multivar_seed_target_indices(
seeds: ArrayLike, targets: ArrayLike
) -> tuple[ArrayLike]:
"""Generates indices parameter for seed-based multivariate connectivity
analysis.
PARAMETERS
----------
seeds : array of array of int
- Seed indices, consisting of an array composed of sub-arrays, where each
each sub-array contains the indices of the channels for the seeds of a
single connectivity node.
targets : array of array of int
- Target indices, consisting of an array composed of sub-arrays, where
each each sub-array contains the indices of the channels for the targets
of a single connectivity node. For each "seeds" sub-array, a
corresponding entry for each of the "targets" sub-arrays will be added
to the indices.
RETURNS
-------
indices : tuple of array of array of int
- The indices paramater used for multivariate connectivity computation.
Consists of two arrays corresponding to the seeds and targets,
respectively, where each array is composed of sub-arrays, where each
sub-array contains the indices of the channels for the seeds/targets of
a single connectivity node.
"""
indices = [[], []]
for seed in seeds:
for target in targets:
indices[0].append(seed)
indices[1].append(target)

return tuple(indices)


def degree(connectivity, threshold_prop=0.2):
"""Compute the undirected degree of a connectivity matrix.
Expand Down

0 comments on commit f61f36f

Please sign in to comment.