Changeset 337 for trunk/src/signals.py

Show
Ignore:
Timestamp:
11/13/08 15:41:12 (4 years ago)
Author:
emuller
Message:

shotnoise_fromspikes fixed
AnalogSignal?.time_slice was changed to not assume t_start=0.0

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/signals.py

    r321 r337  
    22882288            t_stop  - end of the new SpikeTrain, in ms. 
    22892289        """ 
    2290         signal = self.signal[numpy.floor(t_start/self.dt):numpy.floor(t_stop/self.dt)] 
    2291         return AnalogSignal(signal, self.dt, t_start, t_stop) 
     2290        assert t_start>self.t_start 
     2291        assert t_stop<=self.t_stop 
     2292        assert t_stop>t_start 
     2293 
     2294        t = self.time_axis() 
     2295        i_start = numpy.searchsorted(t,t_start,'right')-1 
     2296        i_stop = numpy.searchsorted(t,t_stop,'right')-1 
     2297 
     2298        signal = self.signal[i_start:i_stop] 
     2299        result = AnalogSignal(signal, self.dt, 0.0, t_stop-t_start) 
     2300        result.time_offset(t_start) 
     2301        return result 
    22922302 
    22932303    def threshold_detection(self, threshold=None, format=None):