diff --git a/brainstat/stats/SLM.py b/brainstat/stats/SLM.py index c6dfa520..8ac161c2 100644 --- a/brainstat/stats/SLM.py +++ b/brainstat/stats/SLM.py @@ -322,7 +322,11 @@ def _surfstat_to_brainstat_rft(self) -> None: ) yeo_names, _ = fetch_yeo_networks_metadata(7) yeo_names.insert(0, "Undefined") - yeo7_index = yeo7[self.P["peak"]["vertid"][i]] + # vertid is stored as 1-based (inherited from SurfStat / + # MATLAB conventions in peak_clus); subtract 1 before + # indexing the 0-based yeo7 array (see #347). + vertid = self.P["peak"]["vertid"][i] + yeo7_index = yeo7[vertid - 1] if vertid is not None else None if "yeo7" not in self.P["peak"]: self.P["peak"]["yeo7"] = [] self.P["peak"]["yeo7"].append(np.take(yeo_names, yeo7_index)) diff --git a/brainstat_matlab/stats/@SLM/peak_clus.m b/brainstat_matlab/stats/@SLM/peak_clus.m index 1581be96..5997c762 100755 --- a/brainstat_matlab/stats/@SLM/peak_clus.m +++ b/brainstat_matlab/stats/@SLM/peak_clus.m @@ -157,8 +157,10 @@ function v_col = column_vector(v) % Converts the input vector to a column vector. -arguments - v {mustBeVector} +% Note: mustBeVector was introduced in MATLAB R2020b; an explicit check +% is used here to keep compatibility with R2019b and R2020a (see #285). +if ~isempty(v) && ~isvector(v) + error('column_vector:NotAVector', 'Input must be a vector.'); end v_col = v(:); end