Changeset 200

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

Continue the reorganization. Will make regular commit to ensure everything is correct. Add a system to simplify the plots, and write explicit documentation

Files:

Legend:

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

    r199 r200  
    99try : 
    1010    import pylab 
     11    ENABLE_PLOTS = True 
    1112except ImportError: 
     13    ENABLE_PLOTS = False 
    1214    print "Warning: pylab not detected, plots will be disabled" 
    1315 
     
    1719class SpikeTrain(object): 
    1820    """ 
     21    SpikeTrain(spikes_times, dt=None, t_start=None, t_stop=None) 
    1922    This class defines a spike train as a list of times events. 
    2023 
    2124    Event times are given in a list (sparse representation) in milliseconds. 
    2225 
    23     >>> s1 = SpikeTrain([0.0, 0.1, 0.2, 0.5]) 
    24     >>> s2 = SpikeTrain([0, 1, 2, 5], dt=0.1) 
    25     >>> assert all(s1.spike_times == s2.spike_times) 
    26     >>> s1.isi() 
    27     array([ 0.1,  0.1,  0.3]) 
    28     >>> s1.mean_rate() 
    29     8.0 
    30     >>> s1.cv_isi() 
    31     0.565685424949 
     26    Inputs: 
     27        spike_times - a list/numpy array of spike times (in milliseconds) 
     28        t_start     - beginning of the SpikeTrain (if not, this is infered) 
     29        t_stop      - end of the SpikeTrain (if not, this is infered) 
     30        dt          - time precision of the spike events 
     31 
     32    Examples: 
     33        >>> s1 = SpikeTrain([0.0, 0.1, 0.2, 0.5]) 
     34        >>> s2 = SpikeTrain([0, 1, 2, 5], dt=0.1) 
     35        >>> assert all(s1.spike_times == s2.spike_times) 
     36        >>> s1.isi() 
     37        array([ 0.1,  0.1,  0.3]) 
     38        >>> s1.mean_rate() 
     39        8.0 
     40        >>> s1.cv_isi() 
     41        0.565685424949 
    3242    """ 
    3343 
     
    3747    def __init__(self, spike_times, dt=None, t_start=None, t_stop=None): 
    3848        """ 
    39         `spike_times` is a list/numpy array of spike times (in milliseconds) 
    40  
    41         TODO: We proposed initially that : 
    42         If `dt`is specified, the time values should be ints, 
    43         and will be multiplied by `dt`, otherwise time values should be floats. 
    44         Markus suggested that the internal representation should be integer and that analysis methods also. 
    45  
    46         If `t_start` and `t_stop` are not specified, they are inferred from the data. 
    47  
    48         the format adopted for the representation is relative=False, quantized=False 
     49        Constructor of the SpikeTrain object 
     50         
     51        See also 
     52            SpikeTrain 
    4953 
    5054        """ 
     
    7074            self.spike_times = numpy.extract((self.spike_times <= self.t_stop), self.spike_times) 
    7175 
     76        # We sort the spike_times. May be slower, but is necessary by the way for quite a  
     77        # lot of methods... 
     78        self.spike_times = numpy.sort(self.spike_times) 
    7279        # Here we deal with the t_start and t_stop values if the SpikeTrain 
    7380        # is empty, with only one element or several elements, if we 
     
    111118        return len(self.spike_times) 
    112119     
    113     def __getslice(self, i, j): 
     120    def __getslice__(self, i, j): 
     121        """ 
     122        Return a sublist of the spike_times vector of the SpikeTrain 
     123        """ 
    114124        return self.spike_times[i:j] 
    115125     
    116126    def __getdisplay__(self,display): 
     127        """ 
     128        Return a pylab object with a plot() function to draw the plots. 
     129         
     130        Inputs: 
     131            display - if True, a new figure is created. Otherwise, if display is a 
     132                      subplot object, this object is returned. 
     133        """ 
    117134        if display is False: 
    118135            return None 
     
    124141     
    125142    def __labels__(self, subplot, xlabel, ylabel): 
     143        """ 
     144        Function to put some labels on a plot 
     145         
     146        Inputs: 
     147            subplot - the targeted plot 
     148            xlabel  - a string for the x label 
     149            ylabel  - a string for the y label 
     150        """ 
    126151        if hasattr(subplot, 'xlabel'): 
    127             subplot.xlabel(xlabel, size="large"
    128             subplot.ylabel(ylabel, size="large"
    129         else: 
    130             subplot.set_xlabel(xlabel, size="large"
    131             subplot.set_ylabel(ylabel, size="large"
     152            subplot.xlabel(xlabel
     153            subplot.ylabel(ylabel
     154        else: 
     155            subplot.set_xlabel(xlabel
     156            subplot.set_ylabel(ylabel
    132157 
    133158    def duration(self): 
     159        """ 
     160        Return the duration of the SpikeTrain 
     161        """ 
    134162        return self.t_stop - self.t_start 
    135163 
    136164    def format(self, relative=False, quantized=False): 
    137165        """ 
    138         a function to format a spike train from one format to another. 
    139         outputs a numpy array 
    140  
     166        Return an array with a new representation of the spike times 
     167         
     168        Inputs: 
     169            relative  - if True, spike times are expressed in a relative 
     170                       time compared to the previsous one 
     171            quantized - a value to divide spike times with before rounding 
     172             
     173        Examples: 
     174            >>> st.spikes_times=[0, 2.1, 3.1, 4.4] 
     175            >>> st.format(relative=True) 
     176            >>> [0, 2.1, 1, 1.3] 
     177            >>> st.format(quantized=2) 
     178            >>> [0, 1, 2, 2] 
    141179        """ 
    142180        spike_times = self.spike_times.copy() 
    143         spike_times.sort() 
    144181 
    145182        if relative and len(spike_times) > 0: 
     
    160197     
    161198    def isi(self): 
    162         # TODO this needs some thinking to know how to handle the border, in particular the 
    163         # first spike and t_start 
     199        """ 
     200        Return an array with the inter-spike intervals of the SpikeTrain 
     201         
     202        Examples: 
     203            >>> st.spikes_times=[0, 2.1, 3.1, 4.4] 
     204            >>> st.isi() 
     205            >>> [2.1, 1., 1.3] 
     206         
     207        See also 
     208            cv_isi 
     209        """ 
    164210        return numpy.diff(self.spike_times) 
    165211 
     
    167213    def mean_rate(self, t_start=None, t_stop=None): 
    168214        """  
    169         Mean firing rate between t_start and t_stop in Hz 
    170         By default, if t_start and t_stop are not defined, we used those of the SpikeTrain object 
     215        Return the mean firing rate between t_start and t_stop, in Hz 
     216         
     217        Inputs: 
     218            t_start - in ms. If not defined, the one of the SpikeTrain object is used 
     219            t_stop  - in ms. If not defined, the one of the SpikeTrain object is used 
    171220        """ 
    172221        if (t_start == None) & (t_stop == None): 
     
    183232    def cv_isi(self): 
    184233        """ 
     234        Return the coefficient of variation of the isis. 
     235         
    185236        cv_isi is the ratio between the standard deviation and the mean of the ISI 
    186  
    187237          The irregularity of individual spike trains is measured by the squared 
    188238        coefficient of variation of the corresponding inter-spike interval (ISI) 
     
    194244         
    195245        See also 
    196             SpikeList.cv_isi 
     246            isi 
    197247 
    198248        """ 
    199249        isi = self.isi() 
    200         #TODO return an exception if mean.isi= 0 
    201250        if len(isi) > 0: 
    202251            return numpy.std(isi)/numpy.mean(isi) 
     
    209258         
    210259        See also 
    211             SpikeList.fano_factor 
     260            isi, cv_isi 
    212261        """ 
    213262        isi = self.isi() 
     
    218267            raise Exception("No spikes in the SpikeTrain !") 
    219268 
    220     def time_axis(self, time_bin): 
     269    def time_axis(self, time_bin=10): 
    221270        """ 
    222271        Return a time axis between t_start and t_stop according to a time_bin 
     272         
     273        Inputs: 
     274            time_bin - the bin width 
     275             
     276        Examples: 
     277            >>> st = SpikeTrain(range(100),0.1,0,100) 
     278            >>> st.time_axis(10) 
     279            >>> [ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90] 
     280         
     281        See also 
     282            time_histogram 
     283 
    223284        """ 
    224285        return numpy.arange(self.t_start, self.t_stop, time_bin) 
    225286 
    226287 
    227     def raster_plot(self, t_start=None, t_stop=None, color='b', display=True): 
     288    def raster_plot(self, t_start=None, t_stop=None, display=True, kwargs={}): 
    228289        """ 
    229290        Generate a raster plot with the SpikeTrain in a subwindow of interest, 
    230         defined by t_start and t_stop. Those are not the global t_start and t_stop 
    231         of the SpikeTrain objects. If not defined, we use the one of the SpikeTrain 
    232         object 
    233          
    234         - color is a string color like in pylab plots 'k','r' 
    235         - display can be either a boolean (to ensure backward compatibilities) or a figure 
    236         object with a plot() method. 
     291        defined by t_start and t_stop.  
     292         
     293        Inputs: 
     294            t_start - in ms. If not defined, the one of the SpikeTrain object is used 
     295            t_stop  - in ms. If not defined, the one of the SpikeTrain object is used 
     296            display - if True, a new figure is created. Could also be a subplot 
     297            kwargs  - dictionary contening extra parameters that will be sent to the plot  
     298                      function 
     299         
     300        Examples: 
     301            >>> z = subplot(221) 
     302            >>> st.raster_plot(display=z, kwargs={'color':'r'}) 
    237303         
    238304        See also 
    239305            SpikeList.raster_plot 
    240306        """ 
    241         if t_start is None: 
    242             t_start = self.t_start 
    243         if t_stop is None: 
    244             t_stop = self.t_stop 
     307        if t_start is None: t_start = self.t_start 
     308        if t_stop is None:  t_stop = self.t_stop 
    245309        spikes = numpy.extract((self.spike_times >= t_start) & (self.spike_times <= t_stop), self.spike_times) 
    246310        subplot = self.__getdisplay__(display) 
    247         if not subplot
     311        if not subplot or not ENABLE_PLOTS
    248312            return spikes 
    249313        else: 
     
    252316                ylabel = "Neurons #" 
    253317                self.__labels__(subplot, xlabel, ylabel) 
    254                 subplot.scatter(spikes,numpy.ones(len(spikes)), c=color) 
    255                  
    256  
    257  
    258     # Method to sort a SpikeTrain 
    259     def sort_by_time(self): 
    260         """ 
    261         Sort the spike times according to the time axis 
    262         """ 
    263         self.spike_time = sort(self.spike_time) 
    264  
    265     def subSpikeTrain(self, t_start, t_stop): 
     318                subplot.scatter(spikes,numpy.ones(len(spikes)),**kwargs) 
     319                pylab.draw() 
     320 
     321 
     322    def time_slice(self, t_start, t_stop): 
    266323        """  
    267         Return a spike train sliced between t_start and t_stop 
    268         t_start and t_stop may either be single values or sequences of start 
    269         and stop times. 
    270         """ 
    271         if hasattr(t_start, '__len__'): 
    272             assert len(t_start) == len(t_stop) 
    273             mask = False 
    274             for t0,t1 in zip(t_start, t_stop): 
    275                 mask = mask | (self.spike_times >= t0) & (self.spike_times <= t1) 
    276             t_start = t_start[0] 
    277             t_stop = t_stop[-1] 
    278         else: 
    279             mask = (self.spike_times >= t_start) & (self.spike_times <= t_stop) 
    280         idx = numpy.where(mask)[0] 
    281         spikes = self.spike_times[idx] 
     324        Return a new SpikeTrain obtained by slicing between t_start and t_stop 
     325         
     326        Inputs: 
     327            t_start - begining of the new SpikeTrain, in ms. 
     328            t_stop  - end of the new SpikeTrain, in ms. 
     329 
     330        """ 
     331        spikes = numpy.extract((self.spike_times >= t_start) & (self.spike_times <= t_stop), self.spike_times) 
    282332        return SpikeTrain(spikes, self.dt, t_start, t_stop) 
    283333 
    284     def time_histogram(self, time_bin , normalized=True): 
     334 
     335    def time_histogram(self, time_bin=10, normalized=True): 
    285336        """ 
    286337        Bin the spikes with the specified bin width. The first and last bins 
    287338        are calculated from `self.t_start` and `self.t_stop`. 
    288         If `normalized` is True, the bin values are scaled so as to represent 
    289         firing rates in spikes/second, otherwise it's the number of spikes per bin. 
    290         """ 
    291         if hasattr(time_bin, '__len__'): 
    292             bins = time_bin 
    293         else: 
    294             bins = self.time_axis(time_bin) 
    295          
    296         (hist, lower_edges ) = numpy.histogram(self.spike_times, bins) 
     339         
     340        Inputs: 
     341            time_bin   - the bin width for gathering spikes_times 
     342            normalized - if True, the bin values are scaled to represent firing rates 
     343                         in spikes/second, otherwise otherwise it's the number of spikes  
     344                         per bin. 
     345         
     346        Examples: 
     347            >>> st=SpikeTrain(range(0,100,5),0.1,0,100) 
     348            >>> st.time_histogram(10) 
     349            >>> [200, 200, 200, 200, 200, 200, 200, 200, 200, 200] 
     350            >>> st.time_histogram(10, normalized=False) 
     351            >>> [2, 2, 2, 2, 2, 2, 2, 2, 2, 2] 
     352         
     353        See also 
     354            time_axis 
     355        """ 
     356        bins = self.time_axis(time_bin) 
     357        hist, lower_edges = numpy.histogram(self.spike_times, bins) 
    297358        if normalized and isinstance(time_bin, int): # what about normalization if time_bin is a sequence? 
    298359            hist *= 1000.0/time_bin 
     
    301362    def relative_times(self): 
    302363        """ 
    303         Rescale spike times to make them relative to t_start. 
    304         t_start becomes 0.""" 
     364        Rescale the spike times to make them relative to t_start. 
     365         
     366        Note that the SpikeTrain object itself is modified, t_start  
     367        is substracted to spike_times, t_start and t_stop 
     368        """ 
    305369        if self.t_start != 0: 
    306370            self.spike_times -= self.t_start 
     
    391455        self.spike_times.sort() 
    392456        self.t_start = min(self.t_start, spiketrain.t_start) 
    393         self.t_stop = max(self.t_stop, spiketrain.t_stop) 
     457        self.t_stop = max(self.t_stop, spiketrain.t_stop) 
    394458         
    395459 
     
    423487    ## Constructor and key methods to manipulate the SpikeList objects   ## 
    424488    ####################################################################### 
    425     def __init__(self, spikes, id_list, dt=None, t_start=None, t_stop=None, label=''): 
    426         """ 
    427         `spikes` is a list/tuple of (id,t) tuples (id in id_list) 
    428         `id_list` is the list of ids of all recorded cells (needed for silent cells) 
     489    def __init__(self, spikes, id_list, dt=None, t_start=None, t_stop=None, dims=None, label=''): 
     490        """ 
     491        Constructor of the SpikeList object 
     492 
     493        spikes is a list of (id,t) tuples (id in id_list) 
     494        id_list is the list of ids of all recorded cells (needed for silent cells) 
    429495        If `dt` is specified, the time values should be ints, 
    430496        and will be multiplied by `dt`, otherwise time values should be floats. 
    431         If `t_start` and `t_stop` are not specified, they are inferred from the data. 
     497        t_start and t_stop are defined in ms. If they are not specified, they  
     498            are inferred from the data. 
    432499 
    433500        dt, t_start and t_stop are shared for all SpikeTrains in the SpikeList 
     501         
     502        See also 
     503            loadSpikeList 
    434504 
    435505        """ 
     
    439509        self.dt      = dt 
    440510        self.label   = label 
     511        self.dimensions = None 
     512        self.N       = len(id_list) 
    441513        self.spiketrains = {} 
    442514 
     
    454526            self.__calc_startstop() 
    455527 
    456  
    457     def N(self): 
    458         return len(self.id_list) 
    459  
    460528    def __calc_startstop(self): 
    461529        """ 
     
    468536                start_times = numpy.array([self.spiketrains[idx].t_start for idx in self.id_list]) 
    469537                self.t_start = numpy.min(start_times) 
    470                 print "Warning, t_start is infered from the data : %f" %self.t_start 
     538                logging.debug("Warning, t_start is infered from the data : %f" %self.t_start) 
    471539                for id in self.spiketrains.keys(): 
    472540                    self.spiketrains[id].t_start = self.t_start 
     
    474542                stop_times = numpy.array([self.spiketrains[idx].t_stop for idx in self.id_list]) 
    475543                self.t_stop  = numpy.max(stop_times) 
    476                 print "Warning, t_stop  is infered from the data : %f" %self.t_stop 
     544                logging.debug("Warning, t_stop  is infered from the data : %f" %self.t_stop) 
    477545                for id in self.spiketrains.keys(): 
    478546                    self.spiketrains[id].t_stop = self.t_stop 
     
    510578    def __labels__(self, subplot, xlabel, ylabel): 
    511579        if hasattr(subplot, 'xlabel'): 
    512             subplot.xlabel(xlabel, size="large"
    513             subplot.ylabel(ylabel, size="large"
    514         else: 
    515             subplot.set_xlabel(xlabel, size="large"
    516             subplot.set_ylabel(ylabel, size="large"
     580            subplot.xlabel(xlabel
     581            subplot.ylabel(ylabel
     582        else: 
     583            subplot.set_xlabel(xlabel
     584            subplot.set_ylabel(ylabel
    517585 
    518586    def append(self, id, spktrain): 
     
    530598            self.id_list.append(id) 
    531599        self.t_start = min(self.t_start, spktrain.t_start) or spktrain.t_start # in case self.t_start is None 
    532         self.t_stop = max(self.t_stop, spktrain.t_stop) 
     600        self.t_stop = max(self.t_stop, spktrain.t_stop) 
    533601 
    534602    def get_time_parameters(self): 
     
    578646                 
    579647     
    580     def idsubSpikeList(self, id_list): 
     648    def id_slice(self, id_list): 
    581649        """ 
    582650        Generate a new SpikeList truncated from a particular sublist of cells. The 
     
    599667        return new_SpkList 
    600668 
    601     def timesubSpikeList(self, t_start, t_stop): 
     669    def time_slice(self, t_start, t_stop): 
    602670        """ 
    603671        Generate a new SpikeList truncated from particular time boundaries 
     
    608676        new_SpkList = SpikeList([], [], self.dt, t_start, t_stop) 
    609677        for id in self.id_list: 
    610             new_SpkList.append(id, self.spiketrains[id].subSpikeTrain(t_start, t_stop)) 
     678            new_SpkList.append(id, self.spiketrains[id].time_slice(t_start, t_stop)) 
    611679        new_SpkList.__calc_startstop() 
    612680        return new_SpkList 
     
    647715        values, xaxis = numpy.histogram(isis, bins=bins, normed=True) 
    648716        subplot       = self.__getdisplay__(display) 
    649         if not subplot
     717        if not subplot or not ENABLE_PLOTS
    650718            return values, xaxis 
    651719        else: 
     
    688756        values, xaxis = numpy.histogram(cvs, bins=bins, normed=True) 
    689757        subplot       = self.__getdisplay__(display) 
    690         if not subplot
     758        if not subplot or not ENABLE_PLOTS
    691759            return values, xaxis 
    692760        else: 
     
    742810        rates   = self.mean_rates() 
    743811        subplot = self.__getdisplay__(display) 
    744         if not subplot
     812        if not subplot or not ENABLE_PLOTS
    745813            return rates 
    746814        else: 
     
    767835        else: 
    768836            nbins = numpy.ceil((self.t_stop-self.t_start)/float(time_bin)) 
    769         spike_hist = numpy.zeros((self.N(), nbins), float) 
     837        spike_hist = numpy.zeros((self.N, nbins), float) 
    770838        logging.debug("nbins = %d" % nbins) 
    771839        subplot = self.__getdisplay__(display) 
     
    778846                print self.spiketrains[id].t_start, self.spiketrains[id].t_stop 
    779847                raise 
    780         if not subplot
     848        if not subplot or not ENABLE_PLOTS
    781849            return spike_hist 
    782850        else: 
     
    784852            xlabel = "Time (ms)" 
    785853            self.__labels__(subplot, xlabel, ylabel) 
    786             subplot.plot(self.time_axis(time_bin),sum(spike_hist)/self.N(),**kwargs) 
     854            subplot.plot(self.time_axis(time_bin),sum(spike_hist)/self.N,**kwargs) 
    787855            pylab.draw() 
    788856             
     
    840908 
    841909     
    842     def activity_map(self, dims, t_start=None, t_stop=None, bounds=None, display=False): 
     910    def activity_map(self, dims, t_start=None, t_stop=None, display=False, kwargs={}): 
    843911        """ 
    844912        Generate a 2D map of the activity averaged between t_start and t_stop. 
     
    857925        """ 
    858926        subplot = self.__getdisplay__(display) 
     927         
     928        if t_start == None: t_start = self.t_start 
     929        if t_stop  == None: t_stop  = self.t_stop 
     930        spklist = self.time_slice(t_start, t_stop) 
     931         
    859932        if isinstance(dims, tuple) or isinstance(dims, list): 
    860933            activity_map = numpy.zeros(dims,float) 
    861             rates        = self.mean_rates() 
    862             for id in self.id_list: 
    863                 position = self.id2position(id, dims) 
     934            rates        = spklist.mean_rates() 
     935            for id in spklist.id_list: 
     936                position = spklist.id2position(id, dims) 
    864937                activity_map[position] = rates[id] 
    865             if not subplot
     938            if not subplot or not ENABLE_PLOTS
    866939                return activity_map 
    867940            else: 
    868                 subplot.imshow(activity_map, interpolation='bicubic'
     941                subplot.imshow(activity_map, **kwargs
    869942                subplot.colorbar() 
    870                 subplot.show() 
    871                 if bounds is not None: 
    872                     subplot.clim(bounds) 
     943                pylab.draw() 
    873944        elif isinstance(dims, numpy.ndarray): 
    874             if not len(self.id_list) == len(dims[0]): 
     945            if not len(spklist.id_list) == len(dims[0]): 
    875946                raise Exception("Error, the number of positions does not match the number of cells in the SpikeList") 
    876             rates = self.mean_rates() 
    877             if not subplot
     947            rates = spklist.mean_rates() 
     948            if not subplot or not ENABLE_PLOTS
    878949                return rates 
    879950            else: 
    880951                x = dims[0,:] 
    881952                y = dims[1,:] 
    882                 subplot.scatter(x,y,c=rates
     953                subplot.scatter(x,y,c=rates, **kwargs
    883954                subplot.colorbar() 
    884                 if bounds is not None: 
    885                     subplot.clim(bounds) 
     955 
    886956 
    887957    def pairwise_correlations(self, pairs, time_bin=1., display=False): 
     
    895965            raise Exception("Pairs should have the same number of elements") 
    896966        nb_pairs = len(pairs[0]) 
    897         spk1 = self.idsubSpikeList(pairs[0]) 
    898         spk2 = self.idsubSpikeList(pairs[1]) 
     967        spk1 = self.id_slice(pairs[0]) 
     968        spk2 = self.id_slice(pairs[1]) 
    899969        hist_1 = spk1.spike_histogram(time_bin) 
    900970        hist_2 = spk2.spike_histogram(time_bin) 
     
    929999        """ 
    9301000        firing_rate = self.firing_rate(time_bin) 
    931         return numpy.var(sum(firing_rate)/self.N()
     1001        return numpy.var(sum(firing_rate)/self.N
    9321002 
    9331003    def mean_rate_covariance(self, SpkList, time_bin): 
     
    9421012            raise Exception("Error, both SpikeLists should share common t_start, t_stop and dt") 
    9431013        frate_1 = self.firing_rate(time_bin) 
    944         frate_1 = sum(frate_1)/self.N() 
     1014        frate_1 = sum(frate_1)/self.N 
    9451015        frate_2 = SpkList.firing_rate(time_bin) 
    946         frate_2 = sum(frate_2)/SpkList.N() 
     1016        frate_2 = sum(frate_2)/SpkList.N 
    9471017        N = len(frate_1) 
    9481018        cov = sum(frate_1*frate_2)/N-sum(frate_1)*sum(frate_2)/(N*N) 
     
    9601030        if id_list == None:  
    9611031            id_list = self.id_list 
    962             spk = self.idsubSpikeList(id_list) 
     1032            spk = self.id_slice(id_list) 
    9631033        elif id_list != self.id_list: 
    964             spk = self.idsubSpikeList(id_list) 
     1034            spk = self.id_slice(id_list) 
    9651035            id_list = spk.id_list 
    9661036        else: 
    967             spk = self.idsubSpikeList(id_list) 
     1037            spk = self.id_slice(id_list) 
    9681038 
    9691039        if t_start is None: t_start = self.t_start 
     
    10061076        files = [] 
    10071077        while (time < self.t_stop): 
    1008             subSpkList = self.timesubSpikeList(time, time + time_bin) 
     1078            subSpkList = self.time_slice(time, time + time_bin) 
    10091079            activity_map = subSpkList.activity_map(dims, bounds, display=True) 
    10101080            caption = time+time_bin/2