Ejemplo n.º 1
0
    def gen_spike_train(self, input_signal, t_start, t_stop):
        t_start /= brian.second / pq.s
        t_stop /= brian.second / pq.s
        max_input = input_signal.max()
        dt = self.signal_gen.dt
        max_rate = max_input / self.signal_gen.dt
        input_signal_duration = input_signal.size * dt
        input_signal_times = self.signal_gen.current_time - \
            input_signal_duration + np.arange(input_signal.size) * dt

        def modulation(ts):
            return np.interp(
                ts.rescale(pq.s).magnitude, input_signal_times,
                input_signal) / max_input

        return stg.gen_inhomogeneous_poisson(
            modulation, max_rate / brian.hertz * pq.Hz,
            t_start=t_start, t_stop=t_stop,
            refractory=self.refractory_period / brian.second * pq.s)
 def invoke_gen_func(self, max_rate, **kwargs):
     modulation = lambda ts: sp.sin(ts / (5.0 * pq.s) * sp.pi)
     return stg.gen_inhomogeneous_poisson(modulation, max_rate, **kwargs)
 def invoke_gen_func(self, max_rate, **kwargs):
     modulation = lambda ts: sp.sin(ts / (5.0 * pq.s) * sp.pi)
     return stg.gen_inhomogeneous_poisson(modulation, max_rate, **kwargs)