def source_estimate_quantification(stc1, stc2, metric='rms'):
 known_metrics = ['rms', 'cosine']
 if (metric not in known_metrics):
  raise ValueError('metric must be a str from the known metrics: "rms" or "cosine"')
 _check_stc(stc1, stc2)
 (data1, data2) = (stc1.data, stc2.data)
 if (metric == 'rms'):
  score = np.sqrt(np.mean(((data1 - data2) ** 2)))
 elif (metric == 'cosine'):
  score = (1.0 - (np.dot(data1.flatten(), data2.flatten()) / (norm(data1) * norm(data2))))
 return score

def source_estimate_quantification ( stc1 , stc2 , metric = 'rms' ) : known_metrics = [ 'rms' , 'cosine' ] if ( metric not in known_metrics ) : raise ValueError ( 'metric must be a str from the known metrics: "rms" or "cosine"' ) _check_stc ( stc1 , stc2 ) ( data1 , data2 ) = ( stc1 . data , stc2 . data ) if ( metric == 'rms' ) : score = np . sqrt ( np . mean ( ( ( data1 - data2 ) ** 2 ) ) ) elif ( metric == 'cosine' ) : score = ( 1.0 - ( np . dot ( data1 . flatten ( ) , data2 . flatten ( ) ) / ( norm ( data1 ) * norm ( data2 ) ) ) ) return score
calculate matrix similarities .