EventModel._estim_probs_groups collects per-group results by appending over np.unique(groups):
for cur_group in data_groups:
likes_events_group.append(self.estim_probs(...))
but then indexes that list by group id:
all_xreventprobs.data[np.ix_(groups == cur_group,
range(likes_events_group[cur_group][1].shape[1]),
self.channel_map[cur_group, :] >= 0)] = likes_events_group[cur_group][1]
If the group ids present in the data are not 0..n_groups-1 the two disagree, since the list is positional but the index is an id.
Reproduced with three declared groups (channel and time maps with 3 rows) over 4 trials:
groups = [0, 0, 1, 2] works, likelihood -16.34
groups = [0, 0, 2, 2], so group 1 is declared but empty, raises IndexError: list index out of range
This can happen when a level of a grouping variable is absent after trial rejection, or when a participant subset does not contain every condition.
The fix is to index by position, for example dict(zip(data_groups, likes_events_group)), or to error early with a clear message if a declared group has no trials.
Noticed while working on #244, where the per-trial scatter I added inherits the same pattern and so raises a few lines earlier. May be of interest to @rickdott given #309.
EventModel._estim_probs_groupscollects per-group results by appending overnp.unique(groups):but then indexes that list by group id:
If the group ids present in the data are not
0..n_groups-1the two disagree, since the list is positional but the index is an id.Reproduced with three declared groups (channel and time maps with 3 rows) over 4 trials:
groups = [0, 0, 1, 2]works, likelihood -16.34groups = [0, 0, 2, 2], so group 1 is declared but empty, raisesIndexError: list index out of rangeThis can happen when a level of a grouping variable is absent after trial rejection, or when a participant subset does not contain every condition.
The fix is to index by position, for example
dict(zip(data_groups, likes_events_group)), or to error early with a clear message if a declared group has no trials.Noticed while working on #244, where the per-trial scatter I added inherits the same pattern and so raises a few lines earlier. May be of interest to @rickdott given #309.