Changeset 313

Show
Ignore:
Timestamp:
11/10/08 14:37:36 (2 months ago)
Author:
pierre
Message:

Module docstrings for io, and fix the cv ticket

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/__init__.py

    r309 r313  
    88 
    99For more information see: 
    10  
    1110http://neuralensemble.org/NeuroTools 
    12  
    1311 
    1412 
     
    3432>>> import NeuroTools.signals 
    3533>>> help(NeuroTools.signals) 
    36  
    37  
    3834""" 
    3935 
  • trunk/src/io.py

    r298 r313  
     1""" 
     2NeuroTools.io 
     3================== 
     4 
     5A collection of functions to handle all the inputs/outputs of the NeuroTools.signals 
     6file, used by the loaders. 
     7 
     8Classes 
     9------- 
     10 
     11FileHandler        - abstract class which should be overriden, managing how a file will load/write 
     12                     its data 
     13StandardTextFile   - object used to manipulate text representation of NeuroTools objects (spikes or 
     14                     analog signals) 
     15StandardPickleFile - object used to manipulate pickle representation of NeuroTools objects (spikes or 
     16                     analog signals) 
     17DataHandler        - object to establish the interface between NeuroTools.signals and NeuroTools.io 
     18 
     19All those objects can be used with NeuroTools.signals 
     20 
     21    >> data = StandardTextFile("my_data.dat") 
     22    >> spikes = load(data,'s') 
     23""" 
     24 
     25 
    126from NeuroTools import check_dependency 
    227 
  • trunk/src/signals.py

    r311 r313  
    99------- 
    1010 
    11 SpikeTrain       - An object representing a spike train, for one cell. Useful for plots,  
     11SpikeTrain       - object representing a spike train, for one cell. Useful for plots,  
    1212                   calculations such as ISI, CV, mean rate(), ... 
    13 SpikeList        - An object representing the activity of a population of neurons. Functions as a 
     13SpikeList        - object representing the activity of a population of neurons. Functions as a 
    1414                   dictionary of SpikeTrain objects, with methods to compute firing rate, 
    1515                   ISI, CV, cross-correlations, and so on.  
    16 AnalogSignal     - An object representing an analog signal, with its data. Can be used to do  
     16AnalogSignal     - object representing an analog signal, with its data. Can be used to do  
    1717                   threshold detection, event triggered averages, ... 
    18 AnalogSignalList - A list of AnalogSignal objects, again with methods such as mean, std, plot,  
     18AnalogSignalList - list of AnalogSignal objects, again with methods such as mean, std, plot,  
    1919                   and so on 
    20 VmList           - An AnalogSignalList object used for Vm traces 
    21 ConductanceList  - An AnalogSignalList object used for conductance traces 
    22 CurrentList      - An AnalogSignalList object used for current traces 
     20VmList           - AnalogSignalList object used for Vm traces 
     21ConductanceList  - AnalogSignalList object used for conductance traces 
     22CurrentList      - AnalogSignalList object used for current traces 
    2323 
    2424Functions 
     
    2828                       Can also load data in a different format, but then you have 
    2929                       to write your own File object that will know how to read the data (see io.py) 
    30 load_vmlist          - Function to load a VmList object (inherits from AnalogSignalList) from a file. 
     30load_vmlist          - function to load a VmList object (inherits from AnalogSignalList) from a file. 
    3131                       Same comments on format as previously. 
    32 load_currentlist     - Function to load a CurrentList object (inherits from AnalogSignalList) from a file. 
     32load_currentlist     - function to load a CurrentList object (inherits from AnalogSignalList) from a file. 
    3333                       Same comments on format as previously. 
    34 load_conductancelist - Function to load a ConductanceList object (inherits from AnalogSignalList) from a file. 
     34load_conductancelist - function to load a ConductanceList object (inherits from AnalogSignalList) from a file. 
    3535                       Same comments on format as previously. load_conductancelist returns two  
    3636                       ConductanceLists, one for the excitatory conductance and one for the inhibitory conductance 
    37 load                 - A generic loader for all the previous load methods. 
     37load                 - a generic loader for all the previous load methods. 
    3838""" 
    3939 
     
    308308            return numpy.std(isi)/numpy.mean(isi) 
    309309        else: 
    310             raise Exception("No spikes in the SpikeTrain !") 
     310            print "Warning, a CV can't be computed because there are not enough spikes" 
     311            return nan 
    311312 
    312313    def fano_factor_isi(self): 
     
    11321133            cv_isi_hist, cv_local, cv_kl 
    11331134        """ 
    1134         cvs_isi = [] 
     1135        cvs_isi = numpy.empty(self.N) 
    11351136        for id in self.id_list(): 
    1136             isi = self.spiketrains[id].isi() 
    1137             if len(isi) > 1: 
    1138                 cvs_isi.append(numpy.std(isi)/numpy.mean(isi)) 
    1139         if len(cvs_isi) > 0: 
    1140             return numpy.array(cvs_isi) 
    1141         else: 
    1142             raise Exception("No isi can be computed in the SpikeList !") 
     1137            cvs_isi[id] = self.spiketrains[id].cv_isi() 
     1138        return cvs_isi 
     1139 
    11431140 
    11441141 
  • trunk/test/test_signals.py

    r308 r313  
    370370        cc1 = self.spk.pairwise_cc_zero([(i,i) for i in xrange(5)], time_bin=0.1) 
    371371        cc2 = self.spk.pairwise_cc_zero(5, time_bin=0.1) 
    372         print cc1, cc2 
    373372        assert (0 <= cc1 <= 1) and (cc1 > cc2) 
    374373