Including bad channels in autoreject

Hi both of you,

Here the code snippet that produced the plot from my starting post:

# set parameters for autoreject
n_interpolates = np.array((1, 2, 3, 5, 7, 9))
consensus_percs = np.linspace(0.2, 0.7, 11)

# init autoreject object, picks are grads or mags respectively
rej = AutoReject(n_interpolates, consensus_percs, picks=picks,
                    thresh_method='bayesian_optimization')

# run the autoreject (local) algorithm
rej.fit(epochs)

# extract the log file
rej_log = rej.get_reject_log(epochs)

# plot
xlabels = reject_log.ch_names
image = reject_log.labels
image[image == 2] = 0.5  # move interp to 0.5
legend_label = {0: 'good', 0.5: 'interpolated', 1: 'bad'}
cmap = colors.ListedColormap(['white', 'blue', 'red'])
img = axes.imshow(image.T, cmap=cmap, vmin=0, vmax=1, interpolation='none')
plt.setp(axes, yticks=range(0, len(xlabels)), yticklabels=xlabels)
plt.setp(axes.get_yticklabels(), fontsize=2)
#add red box around rejected epochs
for idx in np.where(reject_log.bad_epochs)[0]:
    axes.add_patch(patches.Rectangle((idx - 0.5, -0.5), 1, len(xlabels),
                 linewidth=1, edgecolor='r', facecolor='none'))

The output of info I shall provide in about 2 weeks, as I am out of office for the next 2 weeks.

Eduard