Changeset 300

Show
Ignore:
Timestamp:
11/06/08 21:26:10 (2 months ago)
Author:
mschmucker
Message:

updated stgen docs to reflect eilifs improvements to the API

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/doc/stgen.txt

    r294 r300  
    33==================== 
    44 
    5 This module offers ways to generate spike trains with certain statistical properties, like poisson-distributed spike trains. It uses the fast and well-tested routines from GNU Scientific Library (gsl) to create random numbers, if they are available. 
     5This module offers various stochastic generators for point processes that can 
     6be used as spike trains.  
    67 
    78--------------- 
     
    1617    >>> st_gen = StGen() 
    1718 
    18 This will by default try to create a pygsl random generator instance. If Pygsl is not available, numpy will be used. 
     19This will initialize the stochastic generator and by default try to create a 
     20numpy random generator instance.  
    1921     
    20 Optionally, you can also pass a random number generator instance to the constructor. To use gsl: 
     22Optionally, you can also pass a random number generator instance to the  
     23constructor: 
     24 
     25    >>> import numpy 
     26    >>> st_gen = StGen(rng = numpy.random.RandomState()) 
     27 
     28You can also use random number generators from gnu scientific library (gsl): 
    2129 
    2230    >>> from pygsl.rng import rng 
    23     >>> st_gen_gsl = StGen(gslrng = rng()) 
     31    >>> st_gen_gsl = StGen(rng = rng()) 
     32 
     33If you want to seed the random number generator with a specific seed, you can  
     34do so in the constructor: 
     35 
     36    >>> st_gen = StGen(seed = 1234567) 
     37 
     38Alternatively, you can re-seed the random number generator when the StGen  
     39object has already been created: 
     40 
     41    >>> st_gen.seed(7654321) 
    2442     
    25 Or using numpy: 
    2643 
    27     >>> import numpy 
    28     >>> st_gen_numpy = StGen(numpyrng = numpy.random.RandomState()) 
     44Poisson-distributed point processes 
     45~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    2946 
    30 Poisson-distributed spike trains 
    31 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    32  
    33 Using the ``StGen``-object, you can generate spike trains with inter-spike-intervals distributed according to a poisson distribution: 
     47Using the ``StGen``-object, you can generate point processes with  
     48inter-spike-intervals distributed according to a poisson distribution: 
    3449 
    3550    >>> st_gen = StGen() 
    36     >>> spike_train_poisson = st_gen.poisson_generator(rate = 100., tsim = 2.5) 
     51    >>> spike_train_poisson = st_gen.poisson_generator(rate = 100.,  
     52                                                       tstart = 0.,  
     53                                                       tstop = 2500.) 
    3754 
    38 This generates an array of spike times with an approximate rate of 100 Hz and a duration of 2.5 seconds. Note that the spike times are in seconds - If spike times should be in ms (as it is a convention in PyNN), rate should be in spikes/ms. 
     55This generates a NeuroTools.SpikeTrain object, containing spike times with an  
     56approximate rate of 100 Hz and a duration of 2.5 seconds.  
    3957 
    40 Dynamic poisson-distributes spike trains 
    41 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     58If you want a numpy array of spike times rather than a SpikeTrain object,  
     59specify the array keyword: 
    4260 
    43 StGen can also generate poisson spike trains with dynamically changing rates: 
     61    >>> spike_train_array = st_gen.poisson_generator(rate = 100., array = True) 
     62 
     63Dynamic poisson-distributes point processes 
     64~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     65 
     66StGen can also generate inhomogeneous poisson processes, i.e. spike trains with  
     67dynamically changing rates: 
    4468     
    45     >>> spike_train_dyn = st_gen.poissondyn_generator(tbins = [0., 1., 2.],  
    46                                                       rate = [50., 80., 30.],  
    47                                                       tsim = 2.5) 
     69    >>> spike_train_dyn = st_gen.poissondyn_generator(rate = [50., 80., 30.],  
     70                                                      t = [0., 1000., 2000.],  
     71                                                      tstop = 2.5, 
     72                                                      array = False) 
    4873 
    49 This will generate an array with spike times, with an approximate rate of 50 Hz for one second, followed by 80 Hz for one second, and finally 30 Hz for half a second. 
     74This will generate a SpikeTrain object containing spike times with an  
     75approximate rate of 50 Hz for one second, followed by 80 Hz for one second, and  
     76finally 30 Hz for half a second. Note that t[0] is used as tstart.