def _merge_grad_data(data, method='rms'):
 data = data.reshape(((len(data) // 2), 2, (-1)))
 if (method == 'mean'):
  data = np.mean(data, axis=1)
 elif (method == 'rms'):
  data = np.sqrt((np.sum((data ** 2), axis=1) / 2))
 else:
  raise ValueError(('method must be "rms" or "mean, got %s.' % method))
 return data

def _merge_grad_data ( data , method = 'rms' ) : data = data . reshape ( ( ( len ( data ) // 2 ) , 2 , ( - 1 ) ) ) if ( method == 'mean' ) : data = np . mean ( data , axis = 1 ) elif ( method == 'rms' ) : data = np . sqrt ( ( np . sum ( ( data ** 2 ) , axis = 1 ) / 2 ) ) else : raise ValueError ( ( 'method must be "rms" or "mean, got %s.' % method ) ) return data
merge data from channel pairs using the rms or mean .