Changeset 492
- Timestamp:
- 08/23/11 20:01:06 (9 months ago)
- Files:
-
- 1 modified
-
trunk/src/signals/analogs.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/signals/analogs.py
r491 r492 258 258 259 259 if len(cutout) <= 0: 260 events = []260 events = numpy.zeros(0) 261 261 else: 262 262 take = numpy.where(numpy.diff(cutout)>1)[0]+1 … … 411 411 assert numpy.iterable(events), "events should be a SpikeTrain object or an iterable object" 412 412 assert (t_min >= 0) and (t_max >= 0), "t_min and t_max should be greater than 0" 413 assert len(events) > 0, "events should not be empty and should contained at least one element" 413 414 # if no events to remove, return self 415 if len(events)==0: 416 yield self 417 return 414 418 415 419 t_last = self.t_start 416 420 for spike in events: 421 # skip spikes which aren't close to the signal interval 422 if spike+t_min<self.t_start or spike-t_min>self.t_stop: 423 continue 424 417 425 t_min_local = numpy.max([t_last, spike-t_min]) 418 426 t_max_local = numpy.min([self.t_stop, spike+t_max]) 419 if t_min_local>t_last: 427 428 if t_last<t_min_local: 420 429 yield self.time_slice(t_last, t_min_local) 430 421 431 t_last = t_max_local 422 432 … … 455 465 456 466 assert signal.dt == self.dt 457 assert signal. duration()==self.duration()467 assert signal.signal.shape==self.signal.shape 458 468 459 469 return mean(self.signal*signal.signal)-mean(self.signal)*(mean(signal.signal))
