Changeset 313
- Timestamp:
- 11/10/08 14:37:36 (2 months ago)
- Files:
-
- trunk/src/__init__.py (modified) (2 diffs)
- trunk/src/io.py (modified) (1 diff)
- trunk/src/signals.py (modified) (4 diffs)
- trunk/test/test_signals.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/__init__.py
r309 r313 8 8 9 9 For more information see: 10 11 10 http://neuralensemble.org/NeuroTools 12 13 11 14 12 … … 34 32 >>> import NeuroTools.signals 35 33 >>> help(NeuroTools.signals) 36 37 38 34 """ 39 35 trunk/src/io.py
r298 r313 1 """ 2 NeuroTools.io 3 ================== 4 5 A collection of functions to handle all the inputs/outputs of the NeuroTools.signals 6 file, used by the loaders. 7 8 Classes 9 ------- 10 11 FileHandler - abstract class which should be overriden, managing how a file will load/write 12 its data 13 StandardTextFile - object used to manipulate text representation of NeuroTools objects (spikes or 14 analog signals) 15 StandardPickleFile - object used to manipulate pickle representation of NeuroTools objects (spikes or 16 analog signals) 17 DataHandler - object to establish the interface between NeuroTools.signals and NeuroTools.io 18 19 All those objects can be used with NeuroTools.signals 20 21 >> data = StandardTextFile("my_data.dat") 22 >> spikes = load(data,'s') 23 """ 24 25 1 26 from NeuroTools import check_dependency 2 27 trunk/src/signals.py
r311 r313 9 9 ------- 10 10 11 SpikeTrain - Anobject representing a spike train, for one cell. Useful for plots,11 SpikeTrain - object representing a spike train, for one cell. Useful for plots, 12 12 calculations such as ISI, CV, mean rate(), ... 13 SpikeList - Anobject representing the activity of a population of neurons. Functions as a13 SpikeList - object representing the activity of a population of neurons. Functions as a 14 14 dictionary of SpikeTrain objects, with methods to compute firing rate, 15 15 ISI, CV, cross-correlations, and so on. 16 AnalogSignal - Anobject representing an analog signal, with its data. Can be used to do16 AnalogSignal - object representing an analog signal, with its data. Can be used to do 17 17 threshold detection, event triggered averages, ... 18 AnalogSignalList - Alist of AnalogSignal objects, again with methods such as mean, std, plot,18 AnalogSignalList - list of AnalogSignal objects, again with methods such as mean, std, plot, 19 19 and so on 20 VmList - An AnalogSignalList object used for Vm traces21 ConductanceList - An AnalogSignalList object used for conductance traces22 CurrentList - An AnalogSignalList object used for current traces20 VmList - AnalogSignalList object used for Vm traces 21 ConductanceList - AnalogSignalList object used for conductance traces 22 CurrentList - AnalogSignalList object used for current traces 23 23 24 24 Functions … … 28 28 Can also load data in a different format, but then you have 29 29 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.30 load_vmlist - function to load a VmList object (inherits from AnalogSignalList) from a file. 31 31 Same comments on format as previously. 32 load_currentlist - Function to load a CurrentList object (inherits from AnalogSignalList) from a file.32 load_currentlist - function to load a CurrentList object (inherits from AnalogSignalList) from a file. 33 33 Same comments on format as previously. 34 load_conductancelist - Function to load a ConductanceList object (inherits from AnalogSignalList) from a file.34 load_conductancelist - function to load a ConductanceList object (inherits from AnalogSignalList) from a file. 35 35 Same comments on format as previously. load_conductancelist returns two 36 36 ConductanceLists, one for the excitatory conductance and one for the inhibitory conductance 37 load - Ageneric loader for all the previous load methods.37 load - a generic loader for all the previous load methods. 38 38 """ 39 39 … … 308 308 return numpy.std(isi)/numpy.mean(isi) 309 309 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 311 312 312 313 def fano_factor_isi(self): … … 1132 1133 cv_isi_hist, cv_local, cv_kl 1133 1134 """ 1134 cvs_isi = []1135 cvs_isi = numpy.empty(self.N) 1135 1136 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 1143 1140 1144 1141 trunk/test/test_signals.py
r308 r313 370 370 cc1 = self.spk.pairwise_cc_zero([(i,i) for i in xrange(5)], time_bin=0.1) 371 371 cc2 = self.spk.pairwise_cc_zero(5, time_bin=0.1) 372 print cc1, cc2373 372 assert (0 <= cc1 <= 1) and (cc1 > cc2) 374 373

