Simulation spike trains with rate changing every millisecond: issue with the inh_poisson_generator f

26 views
Skip to first unread message

Servant Mathieu

unread,
Aug 1, 2017, 4:28:19 PM8/1/17
to Neural Ensemble
Hello,

I would like to simulate a spike train during 2000ms. The rate of the Poisson process changes every millisecond. It is comprised between 20 spikes/second and 160 spikes/second.

I've tried the following simulation, using the inh_poisson_generator function:

import NeuroTools
import numpy as np
from NeuroTools import stgen
import matplotlib.pyplot as plt
import random


st_gen = stgen.StGen()

time = np.arange(0, 2000)
t_rate = []
for i in range (2000):
    t_rate.append(random.randrange(20, 161, 1))
t_rate = np.array(t_rate)
Psim = st_gen.inh_poisson_generator(rate = t_rate, t = time, t_stop = 2000., array = True)
print Psim


The code, however, generally returns very few timestamps (e.g.,  array([ 1317.21345232,  1319.43234986,  1703.89908678])  )  which appears very weird to me. Am I doing things correctly?

Best,
Mathieu

Andrew Davison

unread,
Aug 28, 2017, 10:11:09 AM8/28/17
to Neural Ensemble
Dear Mathieu,

I suggest testing the function with simple rate values that allow you to more easily compare the output to your expectation, rather than with random values.

Best regards,

Andrew
Reply all
Reply to author
Forward
0 new messages