def _sh_complex_to_real(sh, order):
 if (order == 0):
  return np.real(sh)
 else:
  return (np.sqrt(2.0) * (np.real if (order > 0) else np.imag)(sh))

def _sh_complex_to_real ( sh , order ) : if ( order == 0 ) : return np . real ( sh ) else : return ( np . sqrt ( 2.0 ) * ( np . real if ( order > 0 ) else np . imag ) ( sh ) )
helper function to convert complex to real basis functions .