LIMO-EEG-Toolbox / limo_tools

Hierarchical Linear Modelling for MEEG data
https://limo-eeg-toolbox.github.io/limo_meeg/
Other
58 stars 27 forks source link

Fix faulty input validation #69

Closed luka-ve closed 3 years ago

luka-ve commented 3 years ago

First off, thank you for this great toolbox! It's really helping me through my Master thesis. I have encountered this issue when plugging in a 3-dimensional bootM matrix into limo_cluster_correction. Perhaps I am just misusing the function. Please let me know if that's the case.

Expected behaviour

Error should be thrown if ndim is neither 3 nor 4.

Actual behaviour

Error is thrown if ndim is not 3 and 4 at the same time.

Fix

I think the logic of the original issue goes as follow:

Given ndim = 3 if ndim != 3 (which evaluates to false, since ndim is 3), check whether ndim != 4. The second comparison evaluates to true, since dim = 3. In turn, the OR operator evaluates to true and the error is thrown.

CPernet commented 3 years ago

thanks a lot - I can evaluate this fix, seems reasonable can you do a pull request toward the dev branch please - thx