@verbose
def _make_ecg(inst, start, stop, verbose=None):
 if (not any(((c in inst) for c in ['mag', 'grad']))):
  raise ValueError('Unable to generate artificial ECG channel')
 for ch in ['mag', 'grad']:
  if (ch in inst):
   break
 logger.info('Reconstructing ECG signal from {0}'.format({'mag': 'Magnetometers', 'grad': 'Gradiometers'}[ch]))
 picks = pick_types(inst.info, meg=ch, eeg=False, ref_meg=False)
 if isinstance(inst, BaseRaw):
  (ecg, times) = inst[picks, start:stop]
 elif isinstance(inst, BaseEpochs):
  ecg = np.hstack(inst.copy().crop(start, stop).get_data())
  times = inst.times
 elif isinstance(inst, Evoked):
  ecg = inst.data
  times = inst.times
 return (ecg.mean(0), times)

@ verbose def _make_ecg ( inst , start , stop , verbose = None ) : if ( not any ( ( ( c in inst ) for c in [ 'mag' , 'grad' ] ) ) ) : raise ValueError ( 'Unable to generate artificial ECG channel' ) for ch in [ 'mag' , 'grad' ] : if ( ch in inst ) : break logger . info ( 'Reconstructing ECG signal from {0}' . format ( { 'mag' : 'Magnetometers' , 'grad' : 'Gradiometers' } [ ch ] ) ) picks = pick_types ( inst . info , meg = ch , eeg = False , ref_meg = False ) if isinstance ( inst , BaseRaw ) : ( ecg , times ) = inst [ picks , start : stop ] elif isinstance ( inst , BaseEpochs ) : ecg = np . hstack ( inst . copy ( ) . crop ( start , stop ) . get_data ( ) ) times = inst . times elif isinstance ( inst , Evoked ) : ecg = inst . data times = inst . times return ( ecg . mean ( 0 ) , times )
create ecg signal from cross channel average .