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

Function _bases_real_to_complex

mne/preprocessing/maxwell.py:1983–2004  ·  view source on GitHub ↗

Convert real spherical harmonics to complex.

(real_tot, int_order, ext_order)

Source from the content-addressed store, hash-verified

1981
1982
1983def _bases_real_to_complex(real_tot, int_order, ext_order):
1984 """Convert real spherical harmonics to complex."""
1985 n_in, n_out = _get_n_moments([int_order, ext_order])
1986 real_in = real_tot[:, :n_in]
1987 real_out = real_tot[:, n_in:]
1988 comp_tot = np.empty(real_tot.shape, np.complex128)
1989 comp_in = comp_tot[:, :n_in]
1990 comp_out = comp_tot[:, n_in:]
1991 for real, comp, exp_order in zip(
1992 [real_in, real_out], [comp_in, comp_out], [int_order, ext_order]
1993 ):
1994 for deg in range(1, exp_order + 1):
1995 # only loop over positive orders, figure out neg from pos
1996 for order in range(deg + 1):
1997 idx_pos = _deg_ord_idx(deg, order)
1998 idx_neg = _deg_ord_idx(deg, -order)
1999 this_comp = _sh_real_to_complex(
2000 [real[:, idx_pos], real[:, idx_neg]], order
2001 )
2002 comp[:, idx_pos] = this_comp
2003 comp[:, idx_neg] = _sh_negate(this_comp, order)
2004 return comp_tot
2005
2006
2007def _check_info(info, sss=True, tsss=True, calibration=True, ctc=True):

Callers 1

test_multipolar_basesFunction · 0.90

Calls 4

_get_n_momentsFunction · 0.85
_deg_ord_idxFunction · 0.85
_sh_real_to_complexFunction · 0.85
_sh_negateFunction · 0.85

Tested by 1

test_multipolar_basesFunction · 0.72