- Timestamp:
- 10/01/09 17:29:53 (3 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
src/stgen.py (modified) (1 diff)
-
test/test_stgen.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/stgen.py
r379 r437 396 396 397 397 def inh_gamma_generator(self, a, b, t, t_stop, array=False): 398 """ 399 Returns a SpikeList whose spikes are a realization of an inhomogeneous gamma process 400 (dynamic rate). The implementation uses the thinning method, as presented in the 401 references. 402 403 Inputs: 404 a,b - arrays of the parameters of the gamma PDF where a[i] and b[i] 405 will be active on interval [t[i],t[i+1]] 406 t - an array specifying the time bins (in milliseconds) at which to 407 specify the rate 408 t_stop - length of time to simulate process (in ms) 409 array - if True, a numpy array of sorted spikes is returned, 410 rather than a SpikeList object. 411 412 Note: 413 t_start=t[0] 414 a is a dimensionless quantity > 0, but typically on the order of 2-10. 415 a = 1 results in a poisson process. 416 b is assumed to be in units of 1/Hz (seconds). 417 418 References: 419 420 Eilif Muller, Lars Buesing, Johannes Schemmel, and Karlheinz Meier 421 Spike-Frequency Adapting Neural Ensembles: Beyond Mean Adaptation and Renewal Theories 422 Neural Comput. 2007 19: 2958-3010. 423 424 Devroye, L. (1986). Non-uniform random variate generation. New York: Springer-Verlag. 425 426 Examples: 427 See source:trunk/examples/stgen/inh_gamma_psth.py 428 429 See also: 430 inh_poisson_generator, gamma_hazard 431 """ 432 398 433 if not self.rpy_checked: 399 434 self.have_rpy = check_dependency('rpy') -
trunk/test/test_stgen.py
r356 r437 187 187 188 188 189 def testInhGammaBasic(self): 190 191 from numpy import array 192 import NeuroTools.signals 193 194 stg = stgen.StGen() 195 196 st = stg.inh_gamma_generator(array([3.0,3.0]),array([1.0/100.0/3.0,1.0/200.0/3.0]),array([500.0,1500.0]),2500.0,array=True) 197 198 assert(type(st)==numpy.ndarray) 199 200 st = stg.inh_gamma_generator(array([3.0,3.0]),array([1.0/100.0/3.0,1.0/200.0/3.0]),array([500.0,1500.0]),2500.0,array=False) 201 202 assert(type(st)==NeuroTools.signals.spikes.SpikeTrain) 203 204 205 189 206 def testStatsInhGamma(self): 190 207 … … 192 209 193 210 from numpy import array 211 import NeuroTools.signals 194 212 195 213 stg = stgen.StGen() … … 198 216 199 217 st = stg.inh_gamma_generator(array([3.0,3.0]),array([1.0/100.0/3.0,1.0/200.0/3.0]),array([500.0,1500.0]),2500.0,array=True) 218 219 assert(type(st)==numpy.ndarray) 200 220 201 221
