'Return an Epochs object with a copied subset of epochs.
Parameters
item : slice, array-like, str, or list
See below for use cases.
Returns
epochs : instance of Epochs
See below for use cases.
Notes
Epochs can be accessed as ``epochs[...]`` in several ways:
1. ``epochs[idx]``: Return ``Epochs`` object with a subset of
epochs (supports single index and python-style slicing).
2. ``epochs[\'name\']``: Return ``Epochs`` object with a copy of the
subset of epochs corresponding to an experimental condition as
specified by \'name\'.
If conditions are tagged by names separated by \'/\' (e.g.
\'audio/left\', \'audio/right\'), and \'name\' is not in itself an
event key, this selects every event whose condition contains
the \'name\' tag (e.g., \'left\' matches \'audio/left\' and
\'visual/left\'; but not \'audio_left\'). Note that tags like
\'auditory/left\' and \'left/auditory\' will be treated the
same way when accessed using tags.
3. ``epochs[[\'name_1\', \'name_2\', ... ]]``: Return ``Epochs`` object
with a copy of the subset of epochs corresponding to multiple
experimental conditions as specified by
``\'name_1\', \'name_2\', ...`` .
If conditions are separated by \'/\', selects every item
containing every list tag (e.g. [\'audio\', \'left\'] selects
\'audio/left\' and \'audio/center/left\', but not \'audio/right\').'

def __getitem__(self, item):

    data = self._data
    del self._data
    epochs = self.copy()
    (self._data, epochs._data) = (data, data)
    del self
    if isinstance(item, string_types):
        item = [item]
    if (isinstance(item, (list, tuple)) and isinstance(item[0], string_types)):
        select = epochs._keys_to_idx(item)
    else:
        select = (item if isinstance(item, slice) else np.atleast_1d(item))
    key_selection = epochs.selection[select]
    for k in np.setdiff1d(epochs.selection, key_selection):
        epochs.drop_log[k] = ['IGNORED']
    epochs.selection = key_selection
    epochs.events = np.atleast_2d(epochs.events[select])
    if epochs.preload:
        epochs._data = np.require(epochs._data[select], requirements=['O'])
    epochs.event_id = dict(((k, v) for (k, v) in epochs.event_id.items() if (v in epochs.events[:, 2])))
    return epochs
