'Handle rubber band selector in channel tfr.'

def _onselect(self, eclick, erelease, baseline, mode, layout):

    from ..viz import plot_tfr_topomap
    if ((abs((eclick.x - erelease.x)) < 0.1) or (abs((eclick.y - erelease.y)) < 0.1)):
        return
    tmin = round((min(eclick.xdata, erelease.xdata) / 1000.0), 5)
    tmax = round((max(eclick.xdata, erelease.xdata) / 1000.0), 5)
    fmin = round(min(eclick.ydata, erelease.ydata), 5)
    fmax = round(max(eclick.ydata, erelease.ydata), 5)
    tmin = min(self.times, key=(lambda x: abs((x - tmin))))
    tmax = min(self.times, key=(lambda x: abs((x - tmax))))
    fmin = min(self.freqs, key=(lambda x: abs((x - fmin))))
    fmax = min(self.freqs, key=(lambda x: abs((x - fmax))))
    if ((tmin == tmax) or (fmin == fmax)):
        logger.info('The    selected    area    is    too    small.    Select    a    larger    time-frequency    window.')
        return
    types = list()
    if ('eeg' in self):
        types.append('eeg')
    if ('mag' in self):
        types.append('mag')
    if ('grad' in self):
        if (len(_pair_grad_sensors(self.info, topomap_coords=False, raise_error=False)) >= 2):
            types.append('grad')
        elif (len(types) == 0):
            return
    fig = figure_nobar()
    fig.suptitle('{0:.2f}    s    -    {1:.2f}    s,    {2:.2f}    Hz    -    {3:.2f}    Hz'.format(tmin, tmax, fmin, fmax), y=0.04)
    for (idx, ch_type) in enumerate(types):
        ax = fig.add_subplot(1, len(types), (idx + 1))
        plot_tfr_topomap(self, ch_type=ch_type, tmin=tmin, tmax=tmax, fmin=fmin, fmax=fmax, layout=layout, baseline=baseline, mode=mode, cmap=None, title=ch_type, vmin=None, vmax=None, axes=ax)
