def _make_interpolation_matrix(pos_from, pos_to, alpha=1e-05):
 pos_from = pos_from.copy()
 pos_to = pos_to.copy()
 _normalize_vectors(pos_from)
 _normalize_vectors(pos_to)
 cosang_from = pos_from.dot(pos_from.T)
 cosang_to_from = pos_to.dot(pos_from.T)
 G_from = _calc_g(cosang_from)
 G_to_from = _calc_g(cosang_to_from)
 if (alpha is not None):
  G_from.flat[::(len(G_from) + 1)] += alpha
 n_channels = G_from.shape[0]
 C = np.r_[(np.c_[(G_from, np.ones((n_channels, 1)))], np.c_[(np.ones((1, n_channels)), 0)])]
 C_inv = linalg.pinv(C)
 interpolation = np.c_[(G_to_from, np.ones((G_to_from.shape[0], 1)))].dot(C_inv[:, :(-1)])
 return interpolation

def _make_interpolation_matrix ( pos_from , pos_to , alpha = 1e-05 ) : pos_from = pos_from . copy ( ) pos_to = pos_to . copy ( ) _normalize_vectors ( pos_from ) _normalize_vectors ( pos_to ) cosang_from = pos_from . dot ( pos_from . T ) cosang_to_from = pos_to . dot ( pos_from . T ) G_from = _calc_g ( cosang_from ) G_to_from = _calc_g ( cosang_to_from ) if ( alpha is not None ) : G_from . flat [ : : ( len ( G_from ) + 1 ) ] += alpha n_channels = G_from . shape [ 0 ] C = np . r_ [ ( np . c_ [ ( G_from , np . ones ( ( n_channels , 1 ) ) ) ] , np . c_ [ ( np . ones ( ( 1 , n_channels ) ) , 0 ) ] ) ] C_inv = linalg . pinv ( C ) interpolation = np . c_ [ ( G_to_from , np . ones ( ( G_to_from . shape [ 0 ] , 1 ) ) ) ] . dot ( C_inv [ : , : ( - 1 ) ] ) return interpolation
compute interpolation matrix based on spherical splines .