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

Function _setup_ext_proj

mne/chpi.py:767–798  ·  view source on GitHub ↗
(info, ext_order)

Source from the content-addressed store, hash-verified

765
766
767def _setup_ext_proj(info, ext_order):
768 meg_picks = pick_types(info, meg=True, eeg=False, exclude="bads")
769 info = pick_info(_simplify_info(info), meg_picks) # makes a copy
770 _, _, _, _, mag_or_fine = _get_mf_picks_fix_mags(
771 info, int_order=0, ext_order=ext_order, ignore_ref=True, verbose="error"
772 )
773 mf_coils = _prep_mf_coils(info, verbose="error")
774 ext = _sss_basis(
775 dict(origin=(0.0, 0.0, 0.0), int_order=0, ext_order=ext_order), mf_coils
776 ).T
777 out_removes = _regularize_out(0, 1, mag_or_fine, [])
778 ext = ext[~np.isin(np.arange(len(ext)), out_removes)]
779 ext = orth(ext.T).T
780 assert ext.shape[1] == len(meg_picks)
781 proj = Projection(
782 kind=FIFF.FIFFV_PROJ_ITEM_HOMOG_FIELD,
783 desc="SSS",
784 active=False,
785 data=dict(
786 data=ext, ncol=info["nchan"], col_names=info["ch_names"], nrow=len(ext)
787 ),
788 )
789 with info._unlock():
790 info["projs"] = [proj]
791 proj_op, _ = setup_proj(
792 info, add_eeg_ref=False, activate=False, verbose=_verbose_safe_false()
793 )
794 # Can be None if ext_order = 0
795 if proj_op is None:
796 proj_op = np.eye(len(meg_picks))
797 assert proj_op.shape == (len(meg_picks),) * 2
798 return proj, proj_op, meg_picks
799
800
801def _time_prefix(fit_time):

Callers 2

test_initial_fit_redoFunction · 0.90

Calls 11

pick_typesFunction · 0.85
pick_infoFunction · 0.85
_simplify_infoFunction · 0.85
_get_mf_picks_fix_magsFunction · 0.85
_prep_mf_coilsFunction · 0.85
_sss_basisFunction · 0.85
_regularize_outFunction · 0.85
ProjectionClass · 0.85
setup_projFunction · 0.85
_verbose_safe_falseFunction · 0.85
_unlockMethod · 0.80

Tested by 1

test_initial_fit_redoFunction · 0.72