def pick_channels(ch_names, include, exclude=[]):
 if (len(np.unique(ch_names)) != len(ch_names)):
  raise RuntimeError('ch_names is not a unique list, picking is unsafe')
 _check_excludes_includes(include)
 _check_excludes_includes(exclude)
 if (not isinstance(include, set)):
  include = set(include)
 if (not isinstance(exclude, set)):
  exclude = set(exclude)
 sel = []
 for (k, name) in enumerate(ch_names):
  if (((len(include) == 0) or (name in include)) and (name not in exclude)):
   sel.append(k)
 return np.array(sel, int)

def pick_channels ( ch_names , include , exclude = [ ] ) : if ( len ( np . unique ( ch_names ) ) != len ( ch_names ) ) : raise RuntimeError ( 'ch_names is not a unique list, picking is unsafe' ) _check_excludes_includes ( include ) _check_excludes_includes ( exclude ) if ( not isinstance ( include , set ) ) : include = set ( include ) if ( not isinstance ( exclude , set ) ) : exclude = set ( exclude ) sel = [ ] for ( k , name ) in enumerate ( ch_names ) : if ( ( ( len ( include ) == 0 ) or ( name in include ) ) and ( name not in exclude ) ) : sel . append ( k ) return np . array ( sel , int )
pick channels by names .