Single-trial cross-validation schema

    Use one trial for training, all others for testing.

    Parameters
    ----------
    num_trials : int
        Total number of trials
    skipstep : int
        only use every `skipstep` trial for training

    Returns
    -------
    gen : generator object
        the generator returns tuples (trainset, testset)

def singletrial(num_trials, skipstep=1):
    """ Single-trial cross-validation schema

    Use one trial for training, all others for testing.

    Parameters
    ----------
    num_trials : int
        Total number of trials
    skipstep : int
        only use every `skipstep` trial for training

    Returns
    -------
    gen : generator object
        the generator returns tuples (trainset, testset)
    """
    for t in range(0, num_trials, skipstep):
        trainset = [t]
        testset = [i for i in range(trainset[0])] + \
                  [i for i in range(trainset[-1] + 1, num_trials)]
        testset = sort([t % num_trials for t in testset])
        yield trainset, testset