def _find_peaks(evoked, npeaks):
 from scipy.signal import argrelmax
 gfp = evoked.data.std(axis=0)
 order = (len(evoked.times) // 30)
 if (order < 1):
  order = 1
 peaks = argrelmax(gfp, order=order, axis=0)[0]
 if (len(peaks) > npeaks):
  max_indices = np.argsort(gfp[peaks])[(- npeaks):]
  peaks = np.sort(peaks[max_indices])
 times = evoked.times[peaks]
 if (len(times) == 0):
  times = [evoked.times[gfp.argmax()]]
 return times

def _find_peaks ( evoked , npeaks ) : from scipy . signal import argrelmax gfp = evoked . data . std ( axis = 0 ) order = ( len ( evoked . times ) // 30 ) if ( order < 1 ) : order = 1 peaks = argrelmax ( gfp , order = order , axis = 0 ) [ 0 ] if ( len ( peaks ) > npeaks ) : max_indices = np . argsort ( gfp [ peaks ] ) [ ( - npeaks ) : ] peaks = np . sort ( peaks [ max_indices ] ) times = evoked . times [ peaks ] if ( len ( times ) == 0 ) : times = [ evoked . times [ gfp . argmax ( ) ] ] return times
find peaks from evoked data .