Changeset 210

Show
Ignore:
Timestamp:
09/24/08 10:19:05 (4 months ago)
Author:
pierre
Message:

Should slow down all the commits, sorry for over commiting. Implement Andrew's idea of removing the id_list attribute for SpikeList and AnalogSignalList? objects. Add also a copy() method to all those objects, add_offset(),.... We should really find a clear definition for the key objects, to avoid refactoring the code too often. Now, the cleanup branch is roughly operationnal, if you admit that we don't have yet any unit tests :-)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/cleanup/src/signals.py

    r209 r210  
    127127        return self.spike_times[i:j] 
    128128     
     129    def copy(self): 
     130        """ 
     131        Return a copy of the SpikeTrain object 
     132        """ 
     133        return SpikeTrain(self.spike_times, self.dt, self.t_start, self.t_stop) 
     134     
    129135    def __getdisplay__(self,display): 
    130136        """ 
     
    345351                pylab.draw() 
    346352 
     353    def add_offset(self, offset): 
     354        """ 
     355        Add an offset to the SpikeTrain object. t_start and t_stop are 
     356        shifted from offset, so does all the spike times. 
     357          
     358        Inputs: 
     359            offset - the time offset, in ms 
     360         
     361        Examples: 
     362            >>>spktrain = SpikeTrain(arange(0,100,10)) 
     363            >>>spktrain.add_offset(50) 
     364            >>>spklist.spike_times 
     365            >>>[  50.,   60.,   70.,   80.,   90.,  100.,  110.,   
     366                120.,  130.,  140.] 
     367        """ 
     368        self.t_start += offset 
     369        self.t_stop  += offset 
     370        self.spike_times += offset 
    347371 
    348372    def time_slice(self, t_start, t_stop): 
     
    611635            SpikeList, loadSpikeList 
    612636        """ 
    613         self.id_list = id_list 
    614         self.t_start = t_start 
    615         self.t_stop  = t_stop 
    616         self.dt      = dt 
     637        self.t_start     = t_start 
     638        self.t_stop      = t_stop 
     639        self.dt          = dt 
    617640        self.dimensions  = dims 
    618         self.N           = len(id_list) 
    619641        self.spiketrains = {} 
    620642 
     
    622644            self.spiketrains[id] = [] 
    623645        for id,time in spikes: 
    624             if id in self.id_list: #id_list can be a subset of the list of recorded neurons 
     646            if id in self.id_list(): #id_list can be a subset of the list of recorded neurons 
    625647                self.spiketrains[id].append(time) 
    626648 
     
    632654            self.__calc_startstop() 
    633655 
     656    def id_list(self): 
     657        """  
     658        Return the list of all the cells ids contained in the 
     659        SpikeList object 
     660        """ 
     661        return numpy.array(self.spiketrains.keys()) 
     662 
     663    def copy(self): 
     664        """ 
     665        Return a copy of the SpikeList object 
     666        """ 
     667        # Maybe not optimal, should be optimized 
     668        spklist = SpikeList([], [], self.dt, self.t_start, self.t_stop, self.dimensions) 
     669        for id in self.id_list(): 
     670            spklist.append(id, self.spiketrains[id]) 
     671        return spklist 
     672 
    634673    def __calc_startstop(self): 
    635674        """ 
     
    640679        if len(self) > 0: 
    641680            if self.t_start is None: 
    642                 start_times = numpy.array([self.spiketrains[idx].t_start for idx in self.id_list]) 
     681                start_times = numpy.array([self.spiketrains[idx].t_start for idx in self.id_list()]) 
    643682                self.t_start = numpy.min(start_times) 
    644683                logging.debug("Warning, t_start is infered from the data : %f" %self.t_start) 
     
    646685                    self.spiketrains[id].t_start = self.t_start 
    647686            if self.t_stop is None: 
    648                 stop_times = numpy.array([self.spiketrains[idx].t_stop for idx in self.id_list]) 
     687                stop_times = numpy.array([self.spiketrains[idx].t_stop for idx in self.id_list()]) 
    649688                self.t_stop  = numpy.max(stop_times) 
    650689                logging.debug("Warning, t_stop  is infered from the data : %f" %self.t_stop) 
     
    657696        return self.spiketrains[id] 
    658697     
    659     #def __getslice__(self, i, j): 
     698    def __getslice__(self, i, j): 
     699        """ 
     700        Return a new SpikeList object with all the ids between i and j 
     701        """ 
     702        ids = numpy.where((self.id_list() > i) and (self.id_list() < j)) 
     703        return self.id_slice(ids) 
     704     
    660705    #def __setslice__(self, i, j): 
    661706 
     
    663708        assert isinstance(spktrain, SpikeTrain), "A SpikeList object can only contain SpikeTrain objects" 
    664709        self.spiketrains[id] = spktrain 
    665         if not id in self.id_list: 
    666             self.id_list.append(id) 
    667710        self.__calc_startstop() 
    668711 
     
    673716        return len(self.spiketrains) 
    674717 
     718    def __sub_id_list(self, sub_list=None): 
     719        if sub_list == None: 
     720            return self.id_list() 
     721        if type(sub_list) == int: 
     722            return numpy.random.permutation(self.id_list())[0:sub_list] 
     723        if type(sub_list) == list: 
     724            return sub_list 
     725     
    675726    def __getdisplay__(self,display): 
    676727        """ 
     
    725776        """ 
    726777        assert isinstance(spktrain, SpikeTrain), "A SpikeList object can only contain SpikeTrain objects" 
    727         if id in self.id_list
     778        if id in self.id_list()
    728779            raise Exception("id %d already present in SpikeList. Use __setitem__ (spk[id]=...) instead()" %id) 
    729780        else: 
    730781            self.spiketrains[id] = spktrain.time_slice(self.t_start, self.t_stop) 
    731             self.id_list.append(id) 
    732             self.N += 1 
    733  
     782             
    734783    def get_time_parameters(self): 
    735784        """ 
     
    770819                raise Exception("Spike Lists should have similar time_axis") 
    771820        for sl in spklists: 
    772             for id in sl.id_list
     821            for id in sl.id_list()
    773822                self.append(id, sl.spiketrains[id]) 
    774823 
     
    781830        """ 
    782831        for id, spiketrain in spikelist.spiketrains.items(): 
    783             if id in self.id_list
     832            if id in self.id_list()
    784833                self.spiketrains[id].merge(spiketrain, relative_times) 
    785834            else: 
     
    810859        """ 
    811860        new_SpkList = SpikeList([], [], self.dt, self.t_start, self.t_stop, self.dimensions) 
    812         if isinstance(id_list, int): 
    813             id_list = numpy.random.permutation(self.id_list)[0:id_list] 
     861        id_list = self.__sub_id_list(id_list) 
    814862        for id in id_list: 
    815863            try: 
     
    831879        """ 
    832880        new_SpkList = SpikeList([], [], self.dt, t_start, t_stop, self.dimensions) 
    833         for id in self.id_list
     881        for id in self.id_list()
    834882            new_SpkList.append(id, self.spiketrains[id].time_slice(t_start, t_stop)) 
    835883        new_SpkList.__calc_startstop() 
    836884        return new_SpkList 
    837          
     885     
     886    def add_offset(self, offset): 
     887        """ 
     888        Add an offset to the whole SpikeList object. t_start and t_stop are 
     889        shifted from offset, so does all the SpikeTrain. 
     890          
     891        Inputs: 
     892            offset - the time offset, in ms 
     893         
     894        Examples: 
     895            >>>spklist.t_start 
     896            >>> 1000 
     897            >>>spklist.add_offset(50) 
     898            >>>spklist.t_start 
     899            >>> 1050 
     900        """ 
     901        self.t_start += offset 
     902        self.t_stop  += offset 
     903        for id in self.id_list(): 
     904            self.spiketrains[id].add_offset(offset) 
    838905     
    839906    def save(self, filename, method="text"): 
     
    870937        """ 
    871938        isis = [] 
    872         for id in self.id_list
     939        for id in self.id_list()
    873940            isis.append(self.spiketrains[id].isi()) 
    874941        return isis 
     
    915982        """ 
    916983        cvs_isi = [] 
    917         for idx,id in enumerate(self.id_list): 
     984        for id in self.id_list(): 
    918985            isi = self.spiketrains[id].isi() 
    919986            if len(isi) > 1: 
     
    10081075        """ 
    10091076        rates = [] 
    1010         for id in self.id_list
     1077        for id in self.id_list()
    10111078            rates.append(self.spiketrains[id].mean_rate(t_start, t_stop)) 
    10121079        return rates 
     
    10591126        """ 
    10601127        nbins      = self.time_axis(time_bin) 
    1061         spike_hist = numpy.zeros((self.N, len(nbins)), float) 
     1128        N          = len(self) 
     1129        spike_hist = numpy.zeros((N, len(nbins)), float) 
    10621130        subplot    = self.__getdisplay__(display) 
    1063         for idx,id in enumerate(self.id_list): 
     1131        for idx,id in enumerate(self.id_list()): 
    10641132            spike_hist[idx,:] = self.spiketrains[id].time_histogram(time_bin, normalized) 
    10651133        if not subplot or not ENABLE_PLOTS: 
     
    10721140            xlabel = "Time (ms)" 
    10731141            self.__labels__(subplot, xlabel, ylabel) 
    1074             subplot.plot(self.time_axis(time_bin),numpy.sum(spike_hist, axis=0)/self.N,**kwargs) 
     1142            subplot.plot(self.time_axis(time_bin),numpy.sum(spike_hist, axis=0)/N,**kwargs) 
    10751143            pylab.draw() 
    10761144             
     
    11231191        """ 
    11241192        fano_factors = [] 
    1125         for id in self.id_list
     1193        for id in self.id_list()
    11261194            try: 
    11271195                fano_factors.append(self.spiketrains[id].fano_factor_isi()) 
     
    12001268            activity_map = numpy.zeros(self.dimensions, float) 
    12011269            rates        = spklist.mean_rates() 
    1202             for id in spklist.id_list
     1270            for id in spklist.id_list()
    12031271                position = spklist.id2position(id) 
    12041272                activity_map[position] = rates[id] 
     
    12831351            pylab.draw() 
    12841352 
     1353 
     1354    def CrossCorrZero(self, pairs, spklist=None, time_bin=1., mode="auto"): 
     1355        #Just the Aertsen Value at 0 delay 
     1356        t_start = float(time_parameters[0]) 
     1357        t_stop  = float(time_parameters[1]) 
     1358         
     1359        spk1 = CutSpikeList(f1, time_parameters) 
     1360        spk2 = CutSpikeList(f2, time_parameters) 
     1361     
     1362        if ((size(spk1)==0) or (size(spk2)==0)): 
     1363            return 0 
     1364         
     1365        if mode == "auto": 
     1366            if (selected_set==None): 
     1367                selected_set = GetCells(spk1) 
     1368            if isinstance(selected_set,int): 
     1369                all_positions = GetCells(spk1) 
     1370                selected_set  = numpy.random.permutation(all_positions)[0:selected_set] 
     1371            spk1 = CutSpikeList2(spk1,selected_set) 
     1372            spk2 = CutSpikeList2(spk2,selected_set) 
     1373            cells_id = sort(selected_set) 
     1374            for idx in xrange(len(spk1[0])): 
     1375                spk1[1][idx] = numpy.where(cells_id == spk1[1][idx])[0] 
     1376            for idx in xrange(len(spk2[0])): 
     1377                spk2[1][idx] = numpy.where(cells_id == spk2[1][idx])[0] 
     1378            nb_neur   = len(selected_set) 
     1379         
     1380        if mode == "cross": 
     1381            # If nothing is entered, we perform the cross correlation between the two 
     1382            # whole spike trains 
     1383            if (selected_set==None): 
     1384                cell_1 = GetCells(spk1) 
     1385                cell_2 = GetCells(spk2) 
     1386                N      = min(len(cell_1),len(cell_2)) 
     1387                cell_1 = cell_1[0:N] 
     1388                cell_2 = cell_2[0:N] 
     1389             
     1390            # If we want to select only X pairs of cells to performs the auto 
     1391            # correlation, we select those random pairs. 
     1392            if isinstance(selected_set,int): 
     1393                N = selected_set 
     1394                all_positions = GetCells(spk1) 
     1395                shuffle       = numpy.random.permutation(all_positions) 
     1396                cell_1        = shuffle[0:N] 
     1397                # If we perform a cross correlation within the same spike file, 
     1398                # we prevent the same neuron to be in the two signals, to have a real 
     1399                # non overlapping cross correlation 
     1400                if not(any(equal(spk1,spk2) == False)): 
     1401                    shuffle = numpy.random.permutation(all_positions) 
     1402                    cell_2  = shuffle[0:N] 
     1403                else: 
     1404                    # Otherwise we don't care... 
     1405                    all_positions = GetCells(spk2) 
     1406                    shuffle = numpy.random.permutation(all_positions) 
     1407                    cell_2  = shuffle[0:N] 
     1408            spk1 = CutSpikeList2(spk1,cell_1) 
     1409            spk2 = CutSpikeList2(spk2,cell_2) 
     1410            cells_id_1 = sort(cell_1) 
     1411            cells_id_2 = sort(cell_2) 
     1412            for count, cell in enumerate(cells_id_1): 
     1413                spk1[1][numpy.where(cell == spk1[1])] = count 
     1414            for count, cell in enumerate(cells_id_2): 
     1415                spk2[1][numpy.where(cell == spk2[1])] = count 
     1416            nb_neur = len(cells_id_1) 
     1417         
     1418         
     1419        num_bins  = int((t_stop-t_start)/time_bin)+1 
     1420        mat_neur1 = numpy.zeros((num_bins,nb_neur)) 
     1421        mat_neur2 = numpy.zeros((num_bins,nb_neur)) 
     1422         
     1423        timespk1 = numpy.array(((spk1[0] - t_start)/time_bin),'int') 
     1424        timespk2 = numpy.array(((spk2[0] - t_start)/time_bin),'int') 
     1425         
     1426        mat_neur1[timespk1,spk1[1]] = 1 
     1427        mat_neur2[timespk2,spk2[1]] = 1 
     1428        Z = float(sum(sum(mat_neur1*mat_neur2))) 
     1429         
     1430        N = float(num_bins*nb_neur) 
     1431        X = float(len(spk1[0])) 
     1432        Y = float(len(spk2[0])) 
     1433         
     1434        X=X/N 
     1435        Y=Y/N 
     1436        Z=Z/N 
     1437         
     1438        return (Z-X*Y)/sqrt((X*(1-X))*(Y*(1-Y))) 
    12851439     
    12861440    def VictorPurpuraDistance(self, id_list, spklist=None, cost=0.5): 
     
    14071561        subplot = self.__getdisplay__(display) 
    14081562        if id_list == None:  
    1409             id_list = self.id_list 
     1563            id_list = self.id_list() 
    14101564            spk = self 
    1411         elif id_list != self.id_list
     1565        else
    14121566            spk = self.id_slice(id_list) 
    14131567 
     
    14231577            idx = numpy.where((spike_times >= t_start) & (spike_times <= t_stop))[0] 
    14241578            if len(spike_times) > 0: 
    1425                 logging.debug("Plotting %d points for %s" % (len(spike_times), self.label)) 
    14261579                subplot.scatter(spike_times, ids, **kwargs) 
    14271580            xlabel = "Time (ms)" 
     
    15961749            time and id. 
    15971750        
    1598        relative is a boolean to say if a relative representation of the spikes times  
    1599        compared to t_start is needed 
    1600        quantized is a boolean to round the spikes_times. 
    1601          
    1602         For exemple:  
    1603             spk.convert("[times, ids]") will return a list of two elements, the  
     1751        Inputs: 
     1752            relative -  a boolean to say if a relative representation of the spikes  
     1753                        times compared to t_start is needed 
     1754            quantized - a boolean to round the spikes_times. 
     1755         
     1756        Examples:  
     1757            >>>spk.convert("[times, ids]") will return a list of two elements, the  
    16041758                first one being the array of all the spikes, the second the array of all the 
    16051759                corresponding ids 
    1606             spk.convert("[(time,id)]") will return a list of tuples (time, id) 
     1760            >>>spk.convert("[(time,id)]") will return a list of tuples (time, id) 
    16071761         
    16081762        See also 
     
    16971851        return len(self.signal) 
    16981852 
     1853    def copy(self): 
     1854        """ 
     1855        Return a copy of the AnalogSignal object 
     1856        """ 
     1857        return AnalogSignal(self.signal, self.dt, self.t_start, self.t_stop) 
     1858 
    16991859    def time_axis(self): 
    17001860        """ 
     
    17191879class AnalogSignalList(object): 
    17201880    """ 
    1721     AnalogSignalList(signals, id_list, dt=None, t_start=None, t_stop=None
     1881    AnalogSignalList(signals, id_list, dt=None, t_start=None, t_stop=None, dims=None
    17221882     
    17231883    Return a AnalogSignalList object which will be a list of AnalogSignal objects. 
     
    17381898    """ 
    17391899    def __init__(self, signals, id_list, dt=None, t_start=None, t_stop=None, dims=None): 
    1740         self.id_list = id_list 
    1741         self.N       = len(id_list) 
    17421900        self.t_start = t_start 
    17431901        self.t_stop  = t_stop 
     
    17591917            self.__calc_startstop() 
    17601918 
     1919    def id_list(self): 
     1920        """  
     1921        Return the list of all the cells ids contained in the 
     1922        SpikeList object 
     1923        """ 
     1924        return numpy.array(self.analog_signals.keys()) 
     1925 
     1926    def copy(self): 
     1927        """ 
     1928        Return a copy of the AnalogSignalList object 
     1929        """ 
     1930        # Maybe not optimal, should be optimized 
     1931        aslist = AnalogSignalList([], [], self.dt, self.t_start, self.t_stop, self.dimensions) 
     1932        for id in self.id_list(): 
     1933            aslist.append(id, self.analog_signals[id]) 
     1934        return aslist 
    17611935 
    17621936    def __calc_startstop(self): 
     
    17681942        if len(self) > 0: 
    17691943            if self.t_start is None: 
    1770                 start_times  = numpy.array([self.analog_signals[idx].t_start for idx in self.id_list]) 
     1944                start_times  = numpy.array([self.analog_signals[idx].t_start for idx in self.id_list()]) 
    17711945                self.t_start = numpy.min(start_times) 
    17721946                logging.debug("Warning, t_start is infered from the data : %f" %self.t_start) 
     
    17741948                    self.analog_signals[id].t_start = self.t_start 
    17751949            if self.t_stop is None: 
    1776                 stop_times  = numpy.array([self.analog_signals[idx].t_stop for idx in self.id_list]) 
     1950                stop_times  = numpy.array([self.analog_signals[idx].t_stop for idx in self.id_list()]) 
    17771951                self.t_stop = numpy.max(stop_times) 
    17781952                logging.debug("Warning, t_stop  is infered from the data : %f" %self.t_stop) 
     
    18251999        return len(self.analog_signals) 
    18262000 
    1827     def __get_id_list(self, sub_list=None): 
     2001    def __sub_id_list(self, sub_list=None): 
    18282002        if sub_list == None: 
    1829             return self.id_list 
     2003            return self.id_list() 
    18302004        if type(sub_list) == int: 
    1831             return numpy.random.permutation(self.id_list)[0:sub_list] 
     2005            return numpy.random.permutation(self.id_list())[0:sub_list] 
    18322006        if type(sub_list) == list: 
    18332007            return sub_list 
     
    18482022        """ 
    18492023        assert isinstance(signal, AnalogSignal), "An AnalogSignalList object can only contain AnalogSignal objects" 
    1850         if id in self.id_list
     2024        if id in self.id_list()
    18512025            raise Exception("Id already present in AnalogSignalList. Use setitem instead()") 
    18522026        else: 
    18532027            self.analog_signals[id] = signal 
    1854             self.id_list.append(id) 
    1855             self.N += 1 
    18562028        self.__calc_startstop() 
    18572029 
     
    18762048        """ 
    18772049        new_AnalogSignalList = AnalogSignalList([], [], self.dt, self.t_start, self.t_stop, self.dimensions) 
    1878         if isinstance(id_list, int): 
    1879             id_list = numpy.random.permutation(self.id_list)[0:id_list] 
     2050        id_list = self.__sub_id_list(id_list) 
    18802051        for id in id_list: 
    18812052            try: 
     
    18972068        """ 
    18982069        new_AnalogSignalList = AnalogSignalList([], [], self.dt, t_start, t_stop, self.dimensions) 
    1899         for id in self.id_list
     2070        for id in self.id_list()
    19002071            new_AnalogSignalList.append(id, self.analog_signals[id].time_slice(t_start, t_stop)) 
    19012072        new_AnalogSignalList.__calc_startstop() 
     
    19422113        """ 
    19432114        subplot   = self.__getdisplay__(display) 
    1944         id_list   = self._AnalogSignalList__get_id_list(id_list) 
     2115        id_list   = self._AnalogSignalList__sub_id_list(id_list) 
    19452116        time_axis = self.time_axis()   
    19462117        if not subplot or not ENABLE_PLOTS: 
     
    19772148        """ 
    19782149        subplot   = self.__getdisplay__(display) 
    1979         id_list   = self._AnalogSignalList__get_id_list(id_list) 
     2150        id_list   = self._AnalogSignalList__sub_id_list(id_list) 
    19802151        time_axis = self.time_axis()   
    19812152        if not subplot or not ENABLE_PLOTS: 
     
    20082179        """ 
    20092180        subplot   = self.__getdisplay__(display) 
    2010         id_list   = self._AnalogSignalList__get_id_list(id_list) 
     2181        id_list   = self._AnalogSignalList__sub_id_list(id_list) 
    20112182        time_axis = self.time_axis()   
    20122183        if not subplot or not ENABLE_PLOTS: 
     
    20392210    Inputs: 
    20402211        filename - the name of the spike file 
    2041         id_list  - the list of the recorded ids. Can be an int (meaning cells in the range (0,..,N)),  
    2042                    or a list.  
     2212        id_list  - the list of the recorded ids. Can be an int (meaning cells in  
     2213                   the range (0,..,N)), or a list.  
    20432214        dims     - if the cells were aranged on a 2/3D grid, a tuple with the dimensions 
    20442215        dt       - the discretization step, in ms 
     
    20462217        t_stop   - end of the simulation, in ms 
    20472218 
    2048     If dims, dt, t_start, t_stop or id_list are None, they will be infered from either the data or from the header. 
    2049     All times are in milliseconds. The format of the file (text, pickle or hdf5) will be inferred automatically 
     2219    If dims, dt, t_start, t_stop or id_list are None, they will be infered from either  
     2220    the data or from the header. 
     2221    All times are in milliseconds.  
     2222    The format of the file (text, pickle or hdf5) will be inferred automatically 
    20502223    """ 
    20512224    spike_loader = io.SpikeListIO(filename) 
     
    20642237    Inputs: 
    20652238        filename - the name of the spike file 
    2066         id_list  - the list of the recorded ids. Can be an int (meaning cells in the range (0,..,N)),  
    2067                    or a list.  
     2239        id_list  - the list of the recorded ids. Can be an int (meaning cells in  
     2240                   the range (0,..,N)), or a list.  
    20682241        dims     - if the cells were aranged on a 2/3D grid, a tuple with the dimensions 
    20692242        dt       - the discretization step, in ms 
     
    20712244        t_stop   - end of the simulation, in ms 
    20722245 
    2073     If dims, dt, t_start, t_stop or id_list are None, they will be infered from either the data or from the header. 
    2074     All times are in milliseconds. The format of the file (text, pickle or hdf5) will be inferred automatically 
     2246    If dims, dt, t_start, t_stop or id_list are None, they will be infered from either  
     2247    the data or from the header. 
     2248    All times are in milliseconds.  
     2249    The format of the file (text, pickle or hdf5) will be inferred automatically 
    20752250    """ 
    20762251    analogsignal_loader = io.AnalogSignalIO(filename) 
     
    20882263    Inputs: 
    20892264        filename - the name of the spike file 
    2090         id_list  - the list of the recorded ids. Can be an int (meaning cells in the range (0,..,N)),  
    2091                    or a list.  
     2265        id_list  - the list of the recorded ids. Can be an int (meaning cells in  
     2266                   the range (0,..,N)), or a list.  
    20922267        dims     - if the cells were aranged on a 2/3D grid, a tuple with the dimensions 
    20932268        dt       - the discretization step, in ms 
     
    20952270        t_stop   - end of the simulation, in ms 
    20962271 
    2097     If dims, dt, t_start, t_stop or id_list are None, they will be infered from either the data or from the header. 
    2098     All times are in milliseconds. The format of the file (text, pickle or hdf5) will be inferred automatically 
     2272    If dims, dt, t_start, t_stop or id_list are None, they will be infered from either  
     2273    the data or from the header. 
     2274    All times are in milliseconds.  
     2275    The format of the file (text, pickle or hdf5) will be inferred automatically 
    20992276    """ 
    21002277    analogsignal_loader = io.AnalogSignalIO(filename) 
     
    21132290    Inputs: 
    21142291        filename - the name of the spike file 
    2115         id_list  - the list of the recorded ids. Can be an int (meaning cells in the range (0,..,N)),  
    2116                    or a list.  
     2292        id_list  - the list of the recorded ids. Can be an int (meaning cells in  
     2293                   the range (0,..,N)), or a list.  
    21172294        dims     - if the cells were aranged on a 2/3D grid, a tuple with the dimensions 
    21182295        dt       - the discretization step, in ms 
     
    21202297        t_stop   - end of the simulation, in ms 
    21212298 
    2122     If dims, dt, t_start, t_stop or id_list are None, they will be infered from either the data or from the header. 
    2123     All times are in milliseconds. The format of the file (text, pickle or hdf5) will be inferred automatically 
     2299    If dims, dt, t_start, t_stop or id_list are None, they will be infered from either  
     2300    the data or from the header. 
     2301    All times are in milliseconds.  
     2302    The format of the file (text, pickle or hdf5) will be inferred automatically 
    21242303    """ 
    21252304    analogsignal_loader = io.AnalogSignalIO(filename)