def grand_average(all_evoked, interpolate_bads=True):
 if (not all((isinstance(e, Evoked) for e in all_evoked))):
  raise ValueError('Not all the elements in list are evoked data')
 all_evoked = [e.copy() for e in all_evoked]
 if interpolate_bads:
  all_evoked = [(e.interpolate_bads() if (len(e.info['bads']) > 0) else e) for e in all_evoked]
 equalize_channels(all_evoked)
 grand_average = combine_evoked(all_evoked, weights='equal')
 grand_average.nave = len(all_evoked)
 grand_average.comment = ('Grand average (n = %d)' % grand_average.nave)
 return grand_average

def grand_average ( all_evoked , interpolate_bads = True ) : if ( not all ( ( isinstance ( e , Evoked ) for e in all_evoked ) ) ) : raise ValueError ( 'Not all the elements in list are evoked data' ) all_evoked = [ e . copy ( ) for e in all_evoked ] if interpolate_bads : all_evoked = [ ( e . interpolate_bads ( ) if ( len ( e . info [ 'bads' ] ) > 0 ) else e ) for e in all_evoked ] equalize_channels ( all_evoked ) grand_average = combine_evoked ( all_evoked , weights = 'equal' ) grand_average . nave = len ( all_evoked ) grand_average . comment = ( 'Grand average (n = %d)' % grand_average . nave ) return grand_average
make grand average of a list evoked data .