def _topo_to_sphere(pos, eegs):
 (xs, ys) = np.array(pos).T
 sqs = np.max(np.sqrt(((xs[eegs] ** 2) + (ys[eegs] ** 2))))
 xs /= sqs
 ys /= sqs
 xs += (0.5 - np.mean(xs[eegs]))
 ys += (0.5 - np.mean(ys[eegs]))
 xs = ((xs * 2.0) - 1.0)
 ys = ((ys * 2.0) - 1.0)
 rs = np.clip(np.sqrt(((xs ** 2) + (ys ** 2))), 0.0, 1.0)
 alphas = np.arccos(rs)
 zs = np.sin(alphas)
 return np.column_stack([xs, ys, zs])

def _topo_to_sphere ( pos , eegs ) : ( xs , ys ) = np . array ( pos ) . T sqs = np . max ( np . sqrt ( ( ( xs [ eegs ] ** 2 ) + ( ys [ eegs ] ** 2 ) ) ) ) xs /= sqs ys /= sqs xs += ( 0.5 - np . mean ( xs [ eegs ] ) ) ys += ( 0.5 - np . mean ( ys [ eegs ] ) ) xs = ( ( xs * 2.0 ) - 1.0 ) ys = ( ( ys * 2.0 ) - 1.0 ) rs = np . clip ( np . sqrt ( ( ( xs ** 2 ) + ( ys ** 2 ) ) ) , 0.0 , 1.0 ) alphas = np . arccos ( rs ) zs = np . sin ( alphas ) return np . column_stack ( [ xs , ys , zs ] )
convert using old function .