Back to the main page.

Bug 2663 - ft_rejectvisual sorting of minimum values

Status CLOSED FIXED
Reported 2014-07-29 16:56:00 +0200
Modified 2019-08-10 12:28:34 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P5 normal
Assigned to:
URL:
Tags:
Depends on:
Blocks:
See also:

Gio Piantoni - 2014-07-29 16:56:20 +0200

Hi, ft_rejectvisual/summary works really well for most metrics but it does not plot the correct values when you want the minimum values across trials and channels. With metric = 'min', rejectvisual_summary first gets the lowest value for each channel [1], and then it takes the maximum value across trials [2]. It should take the minimum value across trials too. Example data: ChanA = [-5, -2, 3]; ChanB = [-10, -5, 0]; ChanC = [5, 2, -2]; If the metric is min, you get: ChanA = -5, ChanB = -10, ChanC = -2. Then it takes the max value, which is -2, while it should be -10. I suggest to flip the sign before computing the max. So to insert at line 214: if strcmp(info.metric, 'min') level = level * -1; end [maxperchan maxpertrl maxperchan_all maxpertrl_all] = set_maxper(level, info.chansel, info.trlsel); if strcmp(info.metric, 'min') maxperchan = maxperchan * -1; maxpertrl = maxpertrl * -1; maxperchan_all = maxperchan_all * -1; maxpertrl_all = maxpertrl_all * -1; level = level * -1; % see point below end The second part is necessary to have the correct sign in the plots. I'm not sure about the second "level = level * -1", because by flipping the sign again the color palette is the opposite of the color palette for the other metrics (red -> dangerously high values) and there is no colorbar with interpretable values. I can commit the changes if you agree. -g [1] https://github.com/fieldtrip/fieldtrip/blob/master/private/rejectvisual_summary.m#L172 [2] https://github.com/fieldtrip/fieldtrip/blob/master/private/rejectvisual_summary.m#L214


Jan-Mathijs Schoffelen - 2014-09-10 15:47:41 +0200

(In reply to Gio Piantoni from comment #0) You have obviously give this a lot of thought ;-) If you trust this to work well, I would say please commit!


Gio Piantoni - 2014-09-10 17:52:00 +0200

(In reply to Jan-Mathijs Schoffelen from comment #1) Sure, I'll commit the changes (I'll be on vacation for two weeks now, so don't expect it soon). I think I waited at the time to see if somebody else had a better overview than me of the steps in ft_rejectvisual.


Gio Piantoni - 2014-09-24 23:47:13 +0200

fix applied: Sending private/rejectvisual_summary.m Transmitting file data . Committed revision 9839.


Robert Oostenveld - 2019-08-10 12:28:34 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue describing the issue on https://github.com/fieldtrip/fieldtrip/issues.