@verbose
def set_eeg_reference(inst, ref_channels=None, copy=True, verbose=None):
 if (ref_channels is None):
  if _has_eeg_average_ref_proj(inst.info['projs']):
   warn('An average reference projection was already added. The data has been left untouched.')
   return (inst, None)
  else:
   custom_ref_applied = inst.info['custom_ref_applied']
   try:
    inst.info['custom_ref_applied'] = False
    inst.add_proj(make_eeg_average_ref_proj(inst.info, activate=False))
   except:
    inst.info['custom_ref_applied'] = custom_ref_applied
    raise
   return (inst, None)
 else:
  logger.info('Applying a custom EEG reference.')
  inst = (inst.copy() if copy else inst)
  return _apply_reference(inst, ref_channels)

@ verbose def set_eeg_reference ( inst , ref_channels = None , copy = True , verbose = None ) : if ( ref_channels is None ) : if _has_eeg_average_ref_proj ( inst . info [ 'projs' ] ) : warn ( 'An average reference projection was already added. The data has been left untouched.' ) return ( inst , None ) else : custom_ref_applied = inst . info [ 'custom_ref_applied' ] try : inst . info [ 'custom_ref_applied' ] = False inst . add_proj ( make_eeg_average_ref_proj ( inst . info , activate = False ) ) except : inst . info [ 'custom_ref_applied' ] = custom_ref_applied raise return ( inst , None ) else : logger . info ( 'Applying a custom EEG reference.' ) inst = ( inst . copy ( ) if copy else inst ) return _apply_reference ( inst , ref_channels )
rereference eeg channels to new reference channel(s) .