MCPcopy
hub / github.com/mne-tools/mne-python / _sh_complex_to_real

Function _sh_complex_to_real

mne/transforms.py:891–914  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

889
890
891def _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
917def _sh_real_to_complex(shs, order):

Callers 4

_compute_sph_harmFunction · 0.85
_sss_basis_basicFunction · 0.85
_bases_complex_to_realFunction · 0.85

Calls 1

sqrtMethod · 0.80

Tested by 1