def _compute_sph_harm(order, az, pol):
 sph_harm = _get_sph_harm()
 out = np.empty((len(az), (_get_n_moments(order) + 1)))
 for degree in range((order + 1)):
  for order_ in range((degree + 1)):
   sph = sph_harm(order_, degree, az, pol)
   out[:, _deg_ord_idx(degree, order_)] = _sh_complex_to_real(sph, order_)
   if (order_ > 0):
    out[:, _deg_ord_idx(degree, (- order_))] = _sh_complex_to_real(_sh_negate(sph, order_), (- order_))
 return out

def _compute_sph_harm ( order , az , pol ) : sph_harm = _get_sph_harm ( ) out = np . empty ( ( len ( az ) , ( _get_n_moments ( order ) + 1 ) ) ) for degree in range ( ( order + 1 ) ) : for order_ in range ( ( degree + 1 ) ) : sph = sph_harm ( order_ , degree , az , pol ) out [ : , _deg_ord_idx ( degree , order_ ) ] = _sh_complex_to_real ( sph , order_ ) if ( order_ > 0 ) : out [ : , _deg_ord_idx ( degree , ( - order_ ) ) ] = _sh_complex_to_real ( _sh_negate ( sph , order_ ) , ( - order_ ) ) return out
compute complex spherical harmonics of spherical coordinates .