From cff42131da32bb73f229bc903033b715b9f0338c Mon Sep 17 00:00:00 2001 From: Hiyeri <48970646+Hiyeri@users.noreply.github.com> Date: Thu, 13 Oct 2022 13:15:35 +0200 Subject: [PATCH] add multivar seed_target_indices --- mne_connectivity/utils/utils.py | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/mne_connectivity/utils/utils.py b/mne_connectivity/utils/utils.py index 5ae94acb..ba8af393 100644 --- a/mne_connectivity/utils/utils.py +++ b/mne_connectivity/utils/utils.py @@ -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.