def _stc_src_sel(src, stc):
 if isinstance(stc, VolSourceEstimate):
  vertices = [stc.vertices]
 else:
  vertices = stc.vertices
 if (not (len(src) == len(vertices))):
  raise RuntimeError(('Mismatch between number of source spaces (%s) and STC vertices (%s)' % (len(src), len(vertices))))
 src_sels = []
 offset = 0
 for (s, v) in zip(src, vertices):
  src_sel = np.intersect1d(s['vertno'], v)
  src_sel = np.searchsorted(s['vertno'], src_sel)
  src_sels.append((src_sel + offset))
  offset += len(s['vertno'])
 src_sel = np.concatenate(src_sels)
 return src_sel

def _stc_src_sel ( src , stc ) : if isinstance ( stc , VolSourceEstimate ) : vertices = [ stc . vertices ] else : vertices = stc . vertices if ( not ( len ( src ) == len ( vertices ) ) ) : raise RuntimeError ( ( 'Mismatch between number of source spaces (%s) and STC vertices (%s)' % ( len ( src ) , len ( vertices ) ) ) ) src_sels = [ ] offset = 0 for ( s , v ) in zip ( src , vertices ) : src_sel = np . intersect1d ( s [ 'vertno' ] , v ) src_sel = np . searchsorted ( s [ 'vertno' ] , src_sel ) src_sels . append ( ( src_sel + offset ) ) offset += len ( s [ 'vertno' ] ) src_sel = np . concatenate ( src_sels ) return src_sel
select the vertex indices of a source space using a source estimate .