Convert complex to real basis functions. Parameters ---------- sh : array-like Spherical harmonics. Must be from order >=0 even if negative orders are used. order : int Order (usually 'm') of multipolar moment. Returns ------- real_sh : array-lik
(sh, order)
| 889 | |
| 890 | |
| 891 | def _sh_complex_to_real(sh, order): |
| 892 | """Convert complex to real basis functions. |
| 893 | |
| 894 | Parameters |
| 895 | ---------- |
| 896 | sh : array-like |
| 897 | Spherical harmonics. Must be from order >=0 even if negative orders |
| 898 | are used. |
| 899 | order : int |
| 900 | Order (usually 'm') of multipolar moment. |
| 901 | |
| 902 | Returns |
| 903 | ------- |
| 904 | real_sh : array-like |
| 905 | The real version of the spherical harmonics. |
| 906 | |
| 907 | Notes |
| 908 | ----- |
| 909 | This does not include the Condon-Shortely phase. |
| 910 | """ |
| 911 | if order == 0: |
| 912 | return np.real(sh) |
| 913 | else: |
| 914 | return np.sqrt(2.0) * (np.real if order > 0 else np.imag)(sh) |
| 915 | |
| 916 | |
| 917 | def _sh_real_to_complex(shs, order): |