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

Function _sh_real_to_complex

mne/transforms.py:917–935  ·  view source on GitHub ↗

Convert real spherical harmonic pair to complex. Parameters ---------- shs : ndarray, shape (2, ...) The real spherical harmonics at ``[order, -order]``. order : int Order (usually 'm') of multipolar moment. Returns ------- sh : array-like, shape (...)

(shs, order)

Source from the content-addressed store, hash-verified

915
916
917def _sh_real_to_complex(shs, order):
918 """Convert real spherical harmonic pair to complex.
919
920 Parameters
921 ----------
922 shs : ndarray, shape (2, ...)
923 The real spherical harmonics at ``[order, -order]``.
924 order : int
925 Order (usually 'm') of multipolar moment.
926
927 Returns
928 -------
929 sh : array-like, shape (...)
930 The complex version of the spherical harmonics.
931 """
932 if order == 0:
933 return shs[0]
934 else:
935 return (shs[0] + 1j * np.sign(order) * shs[1]) / np.sqrt(2.0)
936
937
938def _compute_sph_harm(order, az, pol):

Callers 2

_bases_real_to_complexFunction · 0.85

Calls 1

sqrtMethod · 0.80

Tested by 1