def _interpolate_bads_meg(inst, mode='accurate', verbose=None):
 picks_meg = pick_types(inst.info, meg=True, eeg=False, exclude=[])
 picks_good = pick_types(inst.info, meg=True, eeg=False, exclude='bads')
 meg_ch_names = [inst.info['ch_names'][p] for p in picks_meg]
 bads_meg = [ch for ch in inst.info['bads'] if (ch in meg_ch_names)]
 if (len(bads_meg) == 0):
  picks_bad = []
 else:
  picks_bad = pick_channels(inst.info['ch_names'], bads_meg, exclude=[])
 if ((len(picks_meg) == 0) or (len(picks_bad) == 0)):
  return
 info_from = pick_info(inst.info, picks_good)
 info_to = pick_info(inst.info, picks_bad)
 mapping = _map_meg_channels(info_from, info_to, mode=mode)
 _do_interp_dots(inst, mapping, picks_good, picks_bad)

def _interpolate_bads_meg ( inst , mode = 'accurate' , verbose = None ) : picks_meg = pick_types ( inst . info , meg = True , eeg = False , exclude = [ ] ) picks_good = pick_types ( inst . info , meg = True , eeg = False , exclude = 'bads' ) meg_ch_names = [ inst . info [ 'ch_names' ] [ p ] for p in picks_meg ] bads_meg = [ ch for ch in inst . info [ 'bads' ] if ( ch in meg_ch_names ) ] if ( len ( bads_meg ) == 0 ) : picks_bad = [ ] else : picks_bad = pick_channels ( inst . info [ 'ch_names' ] , bads_meg , exclude = [ ] ) if ( ( len ( picks_meg ) == 0 ) or ( len ( picks_bad ) == 0 ) ) : return info_from = pick_info ( inst . info , picks_good ) info_to = pick_info ( inst . info , picks_bad ) mapping = _map_meg_channels ( info_from , info_to , mode = mode ) _do_interp_dots ( inst , mapping , picks_good , picks_bad )
interpolate bad channels from data in good channels .