Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFT_main.m cannot deal when there is no clear peak in a cluster #83

Open
NicolasClairis opened this issue May 7, 2020 · 1 comment
Open

Comments

@NicolasClairis
Copy link
Contributor

In some cases the amount of clusters identified by RFT_main.m (nc line 165) and the number of peaks identified (is line 221) does not match. (If no local maxima could be found in particular because there is no peak in the cluster). Then RFT_main.m and hence also RFT_GLM_contrast.m crashes. Could this case be handled somehow, just by reporting there was no peak eventhough the cluster as a full is significant for example?

@NicolasClairis NicolasClairis changed the title RFT_main.m cannot deal with multiple peaks in the same cluster RFT_main.m cannot deal when there is no clear peak in a cluster May 7, 2020
@NicolasClairis
Copy link
Contributor Author

Hi.
I just re-experienced this bug when using data that was not smoothed.
In summary, what happens is that if too neighbour values of X are the same, RFT_localmax (line 151) does not extract them which then causes a mismatch between the elements in peaks.ind and those extracted by RFT_clusters (line 164) in clusters.ind. Because of this, when the script extracts the peaks (line 220) with ismember(peaks.ind, clusters.imax) which are then extracted in the variable is (line 221), there is a mismatch between the number of clusters identified in the variable nc and those present in is which makes the script crash.

I would recommend to add a checkup before the for loop to warn the user from this bug as it took me a lot of time to figure. Something simple could be:
if nc > length(is) error('Mismatch between number of clusters and number of peaks. Please verify that you smoothed the data in X and try again.'); end

Indeed, in my case, smoothing the data solved the problem, but maybe it would be good to add a more generic way to solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant