| 765 | |
| 766 | |
| 767 | def _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 | |
| 801 | def _time_prefix(fit_time): |