neuroprob/utils/stats.py
def discrete_rate_rescale(sample_bin, rate, spike_ind):
    r"""
    Treats the rate as a step-wise constant continuous function, see [1]. We dequantize the 
    rescaled times by adding uniform noise between discrete steps in the rescaled times.
    
    References:
    
    [1] `Rescaling, thinning or complementing? On goodness-of-fit procedures for 
    point process models and Generalized Linear Models`,
    Felipe Gerhard, Wulfram Gerstner
    
    :param float sample_bin: time of a bin
    :param numpy.array rate: rate sampled at sample_bin
    :param numpy.array spike_ind: indices of the spike times
    :returns: Spike times as rescaled with rate rescaling in units of sample_bin
    :rtype: numpy.array
    """
    rtime = np.cumsum(rate)*sample_bin
    drtime = np.concatenate((rtime[0:1], rtime[1:] - rtime[:-1]))
    rspk = rtime[spike_ind] - np.random.rand(*spike_ind.shape)*drtime[spike_ind]
    rspk = np.sort(rspk) # re-oder in case of duplicate spike_ind
    
    return rspk
r"""
    Treats the rate as a step-wise constant continuous function, see [1]. We dequantize the 
    rescaled times by adding uniform noise between discrete steps in the rescaled times.
    
    References:
    
    [1] `Rescaling, thinning or complementing? On goodness-of-fit procedures for 
    point process models and Generalized Linear Models`,
    Felipe Gerhard, Wulfram Gerstner
    
    :param float sample_bin: time of a bin
    :param numpy.array rate: rate sampled at sample_bin
    :param numpy.array spike_ind: indices of the spike times
    :returns: Spike times as rescaled with rate rescaling in units of sample_bin
    :rtype: numpy.array
    
r"""
Treats the rate as a step-wise constant continuous function, see [1]. We dequantize the
rescaled times by adding uniform noise between discrete steps in the rescaled times.



[1] `Rescaling, thinning or complementing. On goodness-of-fit procedures for
point process models and Generalized Linear Models`,
Felipe Gerhard, Wulfram Gerstner
r " " " Treats the rate as a step - wise constant continuous function see [ 1 ] . We dequantize the rescaled times by adding uniform noise between discrete steps in the rescaled times . [ 1 ] ` Rescaling thinning or complementing . On goodness - of - fit procedures for point process models and Generalized Linear Models ` Felipe Gerhard Wulfram Gerstner
def discrete_rate_rescale(sample_bin, rate, spike_ind):
    rtime = np.cumsum(rate)*sample_bin
    drtime = np.concatenate((rtime[0:1], rtime[1:] - rtime[:-1]))
    rspk = rtime[spike_ind] - np.random.rand(*spike_ind.shape)*drtime[spike_ind]
    rspk = np.sort(rspk) 
    return rspk
def discrete_rate_rescale ( sample_bin , rate , spike_ind ) : rtime = np . cumsum ( rate ) * sample_bin drtime = np . concatenate ( ( rtime [ 0 : 1 ] , rtime [ 1 : ] - rtime [ : - 1 ] ) ) rspk = rtime [ spike_ind ] - np . random . rand ( * spike_ind . shape ) * drtime [ spike_ind ] rspk = np . sort ( rspk ) return rspk
r"""
Treats the rate as a step-wise constant continuous function, see [1].
r " " " Treats the rate as a step - wise constant continuous function see [ 1 ] .
r"""
    Treats the rate as a step-wise constant continuous function, see [1]. We dequantize the 
    rescaled times by adding uniform noise between discrete steps in the rescaled times.
    
    References:
    
    [1] `Rescaling, thinning or complementing? On goodness-of-fit procedures for 
    point process models and Generalized Linear Models`,
    Felipe Gerhard, Wulfram Gerstner
    
    :param float sample_bin: time of a bin
    :param numpy.array rate: rate sampled at sample_bin
    :param numpy.array spike_ind: indices of the spike times
    :returns: Spike times as rescaled with rate rescaling in units of sample_bin
    :rtype: numpy.array
    """ # re-oder in case of duplicate spike_ind
Spike times as rescaled with rate rescaling in units of sample_bin
Spike times as rescaled with rate rescaling in units of sample_bin
numpy.array
sample_bin
time of a bin
time of a bin
rate
rate sampled at sample_bin
rate sampled at sample_bin
spike_ind
indices of the spike times
indices of the spike times