def _calc_g(cosang, stiffness=4, num_lterms=50):
 factors = [(((2 * n) + 1) / ((((n ** stiffness) * ((n + 1) ** stiffness)) * 4) * np.pi)) for n in range(1, (num_lterms + 1))]
 return legval(cosang, ([0] + factors))

def _calc_g ( cosang , stiffness = 4 , num_lterms = 50 ) : factors = [ ( ( ( 2 * n ) + 1 ) / ( ( ( ( n ** stiffness ) * ( ( n + 1 ) ** stiffness ) ) * 4 ) * np . pi ) ) for n in range ( 1 , ( num_lterms + 1 ) ) ] return legval ( cosang , ( [ 0 ] + factors ) )
calculate spherical spline g function between points on a sphere .