Ejemplo n.º 1
0
def gen_single_trial(interval_length, rates):
    """ Generates a single spike train with intervals of length
    `interval_length` and the firing rates given in `rates`.
    """
    return stools.st_concatenate([stg.gen_homogeneous_poisson(
        rate, t_start=i * interval_length,
        t_stop=(i + 1) * interval_length) for i, rate in enumerate(rates)])
Ejemplo n.º 2
0
def gen_single_trial(interval_lengths, rates):
    """ Generates a single spike train with intervals of length
    `interval_lengths` and the firing rates given in `rates`.
    """
    boundaries = sp.ones(len(interval_lengths) + 1) * pq.s
    boundaries[1:] = [l.rescale(boundaries.units) for l in interval_lengths]
    rates = rates[sp.nonzero(boundaries[1:])]
    boundaries = boundaries[sp.nonzero(boundaries)]
    boundaries[0] = 0.0 * pq.s
    boundaries = sp.cumsum(boundaries)
    return stools.st_concatenate([stg.gen_homogeneous_poisson(
        rate, t_start=boundaries[i], t_stop=boundaries[i + 1])
        for i, rate in enumerate(rates)])