def discriminateEvents(events, threshold):
    """
    Discriminate triggers when different kind of events are on the same channel.
    A time threshold is used to determine if two events are from the same trial.

    Parameters
    ----------
    events : instance of pandas.core.DataFrame
        Dataframe containing the list of events obtained with
        mne.find_events(raw).
    threshold : float
        Time threshold in milliseconds. Keeps an event if the time difference
        with the next one is superior than threshold.

    Returns:

    newData : instance of pandas.series.Series
        List of trial number filling the requirements.
    """

    # calculate the rolling difference (between n and n+1)
    events['diff'] = events[0].diff()
    # replace the nan with the first value
    events['diff'].iloc[0] = events.iloc[0, 0]
    # select events with time distance superior to threshold
    events = events[events['diff']>threshold]
    events = events.reset_index(drop=True)
    del events['diff']
    return events