Skip to content

Commit

Permalink
Update container get_data method
Browse files Browse the repository at this point in the history
  • Loading branch information
tsbinns committed Jul 15, 2024
1 parent 69a8abd commit 8d7e7eb
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions mne_connectivity/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,11 +717,15 @@ def get_data(self, output="compact"):
if output == "raveled":
data = self._data
else:
if self.method in _multivariate_methods:
# multivariate results cannot be returned in a dense form as a
# single set of results would correspond to multiple entries in
# the matrix, and there could also be cases where multiple
# results correspond to the same entries in the matrix.
if (
isinstance(self.indices, tuple)
and not np.all(isinstance(self.indices[0], int))
and not np.all(isinstance(self.indices[1], int))
): # i.e. check if multivariate results based on nested indices
# multivariate results cannot be returned in a dense form as a single
# set of results would correspond to multiple entries in the matrix, and
# there could also be cases where multiple results correspond to the
# same entries in the matrix.
raise ValueError(
"cannot return multivariate connectivity data in a dense form"
)
Expand All @@ -736,6 +740,8 @@ def get_data(self, output="compact"):
# and thus appends the connectivity matrices side by side, so the
# shape is N x N * lags
new_shape.extend([self.n_nodes, self.n_nodes])
if "components" in self.dims:
new_shape.append(len(self.coords["components"]))
if "freqs" in self.dims:
new_shape.append(len(self.coords["freqs"]))
if "times" in self.dims:
Expand Down

0 comments on commit 8d7e7eb

Please sign in to comment.