Changeset 288

Show
Ignore:
Timestamp:
11/05/08 14:39:40 (2 months ago)
Author:
emuller
Message:

Merged my changes to the wiki with signals.txt here
From now on I will make changes here.

Files:

Legend:

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

    r281 r288  
    33====================== 
    44 
    5 This module is the core of the key functions that will allow manipulation and calculus 
    6 on complex data structure like spike trains, spike lists, analog signals ...  
    7 Despite the fact that those objects (described latter) are generic, it's strongly recommended 
    8 to use the pyNN API to generate the data. The standard output format of the latter will be 
    9 the one used by NeuroTools, and you'll have to make your own loader (very simple) if you 
    10 have your own format. 
     5This module provides key functions to manipulate and perform calculations 
     6on data structures like spike trains, spike lists, analog signals.   
     7 
     8The import and export of these data structures is typically achieved using the NeuroTools :trac:`io` module. 
    119 
    1210------------ 
     
    1412------------ 
    1513 
    16 A spike train is a vector of spike times, sorted, which is the result of a simulation 
    17 It has therefore some attribute, like t_start and t_stop, which must in a general case 
    18 be specified by the user because they can't be infered from the data. Note that the standard time 
    19 unit here is the millisecond. 
    20 When several spikes train are gathered, it will be an object called a SpikeList, i.e a dictionnary 
    21 of spike trains, the id of the cells being used as a key. See descriptions for more details. 
     14A spike train is a sorted vector of spike times, which is the result of a simulation or aquired by measurement. 
     15It has therefore some attributes, like t_start and t_stop, which must in general 
     16be specified by the user, as they can not be infered from the data.   
     17 
     18'''Note:''' the standard time unit used by NeuroTools is milliseconds. 
     19 
     20When several spikes train are gathered, they are collected in a so-called SpikeList, which is actually a dictionnary 
     21of spike trains, the id of the cells being used as a key. See the SpikeList_ class for more details. 
    2222 
    2323 
     
    3333    >>> spk2 = SpikeTrain(arange(0,100,10)) 
    3434 
    35 As you can see, one can define (or not), t_start and t_stop. If those attributes are not provided, 
    36 they'll be infered from the data as the min and the max of the spike times:: 
     35As you can see, defining t_start and t_stop is optional. If those attributes are not provided, 
     36they are infered from the data as the min and the max of the spike times:: 
    3737 
    3838    >>> spk1.t_stop 
     
    4545    >>> spk1.spike_times 
    4646        array([  0.,  10.,  20.,  30.,  40.,  50.,  60.,  70.,  80.,  90.]) 
    47  
    48 Usage 
    49 ~~~~~~~~ 
    50  
     47     
    5148The ``SpikeTrain`` object by itself may be interesting, but it will be more often used within a 
    52 ``SpikeList`` objects, as we'll see later. 
    53 Note that several methods can be applied to such a ``SpikeTrain`` object. Without being explicit, one  
    54 can used ``mean_rate()``, ``copy()``, ``isi()``, ``cv_isi()``, ``raster_plot()``. See the documentation for more 
    55 details. Here is an example of a current use of a SpikeTrain object:: 
     49``SpikeList`` object, as we'll see later. 
     50 
     51The ``SpikeTrain`` object has many useful methods such as ``mean_rate()``, ``copy()``, ``isi()``, ``cv_isi()``, ``raster_plot()``. See the ``singals`` API documentation (:trac:`api:signals`) for more 
     52details.  
     53 
     54An example of basic use of a SpikeTrain object is as follows:: 
    5655 
    5756    >>> spk1.raster_plot() # Generates a raster_plot between t_start and t_stop 
     
    6261 
    6362 
     63.. _SpikeList: 
     64 
    6465The ``SpikeList`` class 
    6566----------------------- 
    6667 
    67 A SpikeList is a dictionnary of SpikeTrains. This is usally the common output of a simulation, 
    68 when one has recorded the spikes of a whole population. What you get from this recording 
    69 is a list of tuple (id, spike time), that is, in a SpikeList object, turn into a dictionary 
    70 {'id' : SpikeTrain} 
    71  
    72 Creation 
    73 ~~~~~~~~ 
    74  
    75 The constructor of a SpikeList is made as follows: it will accept a list of tuples (id, spike_time),  
    76 and additional parameters like t_start, t_stop, and the list of all the recorded ids. The last three parameters 
    77 can't be infered from the data safely, so it's better if they are specified by the user. Nevertheless, the most 
    78 commmon way to create SpikeList in NeuroTools is to use the ``load_spikelist()`` or the ``load()`` functions, as 
    79 explained below:: 
     68A SpikeList is actually a dictionary of SpikeTrains, and can be thought of conceptually as the output of a network simulation, 
     69when one records the spikes of a given population.  The SpikeList is an object to organize such a recording 
     70as a tuple of key-value pairs ( spike_source_id, spike_train), that is, a SpikeList object acts as a dictionary created as follows: 
     71{'id' : SpikeTrain, ...} 
     72 
     73Creation 
     74~~~~~~~~ 
     75 
     76The constructor of a SpikeList is works as follows: it will accepts a list of tuples (id, spike_time),  
     77parameters t_start and t_stop, and the list of all the recorded ids. The last three parameters 
     78can't be infered from the data safely, so it's better if they are specified by the user.  Here is an simple example of how to create a SpikeList:: 
    8079 
    8180    >>> list = [(numpy.random.random_integers(0,10,1)[0],1000*numpy.random.rand()) for i in xrange(1000)] 
    8281    >>> spklist = SpikeList(list, range(11), t_start=0, t_stop=1000) 
    8382 
    84 Here, range(11) is here to specify that in the lists we will have cells with id between 0 and 10 (it is needed, 
     83Here, range(11) is used to specify that in the lists we will have cells with id between 0 and 10 (it is needed, 
    8584because we can have silent cells in the SpikeList), and that I will kept the spike only between t_start and t_stop. 
    8685All the SpikeTrains objects within the SpikeList will share the same t_start and t_stop 
    8786 
    88 If you have generated your data with pyNN, you can used the loading functions made on purpose. For example if  
    89 you have recorded the spikes of a population in a file "spikes.dat", then you just have to do:: 
     87Rather than calling the SpikeList constructor,  a more commmon way to create a SpikeList in NeuroTools is to use the ``load_spikelist()`` or the ``load()`` functions. 
     88If you have generated your data with pyNN, you can used the loading functions made for this purpose. For example if  
     89you have recorded the spikes of a population in a file "spikes.dat", then one can load it as a SpikeList as follows:: 
    9090     
    9191    >>> spklist = load("spikes.dat",'spikes') 
    9292 
    93 With such a syntax, the headers informations willbe used to create the population, and t_start and t_stop will 
    94 be infered automatically as the min and the max of all the SpikeTrains within the SpikeList 
    95 If you want to keep the control on the parameters while creating the SpikeList:: 
     93Using this syntax, the header information contained in the file is used to create the population, and t_start and t_stop are 
     94infered automatically as the min and the max of all the SpikeTrains within the SpikeList. 
     95If you want to keep the control on the parameters while creating the SpikeList, do the following:: 
    9696     
    9797    >>> spklist = load_spikelist("spikes.dat", range(11), t_start=0, t_stop=1000) 
    9898 
    9999 
    100 While the SpikeList has been created, you can start to play with  
     100Now that the SpikeList has been created, you can start to explore it. 
    101101 
    102102Navigation 
     
    143143~~~~~~~~~~~~~~~~~~ 
    144144 
    145 A lot of functions have the property of being able to generate plots. Those plots are generic and you can 
    146 do yours with the raw results of the functions. Nevertheless, as you can see in the documentation of those 
    147 functions, each time you have a display flag, you can pass either a boolean set to True if you wan to 
    148 generate a new figure, either a subplot if you want to do more complicated plots. You can also provided additional 
     145Several signal object methods have the property of being able to generate plots. These plots are implemented to be generic and customizable.  As can be seen in the API documentation, plotting functions accept a ``display`` flag, which you can set to ``True`` if you want to generate a new figure, or you can set it to a subplot if you want to do more complicated plots.  You can also provided additional 
    149146parameters to the plot function of pylab as extra arguments:: 
    150147 
     
    163160-------------- 
    164161 
    165 The other type of signals which is handled by NeuroTools.signals is the analog signals. They are indeed also 
    166 recorded during a simulation, and it could be a Vm trace, a conductance or event a current. Such a signal is 
    167 defined by a number of values between t_start and t_stop with a time step dt. 
     162NeuroTools.signals also handles analog signals. These are generally also 
     163recorded during a simulation or experiment, such as for example a Vm trace, a conductance or a current. Such a signal is 
     164definied by a number of values between t_start and t_stop with a time step dt. 
    168165 
    169166The ``AnalogSignal`` class