Skip to content

Commit 9833005

Browse files
committed
change bad condition error to ignore in mSSS calc
1 parent b1acbb5 commit 9833005

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

mne/preprocessing/fit_spheres_to_mri.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,34 @@
1313

1414

1515
def fit_spheres_to_mri(subjects_dir, subject, bem, trans, n_spheres):
16+
"""Fits two spheres to MRI using BEM, such that spheres fit while brain but
17+
do not encroach on sensors. For use with Milti-SSS Maxwell Filtering
18+
19+
Parameters
20+
----------
21+
subjects dir: str
22+
director to Freesurfer subjects
23+
subject: str
24+
Subject ID
25+
bem: bem.ConductorModel
26+
istance of bem.ConductorModel, must be three shell conductivity profiles
27+
trans: str
28+
path to trans file, mri_dev_t information
29+
n_spheres: int
30+
number of spheres to fit, recommended 2
31+
32+
Returns
33+
-------
34+
centers: np.ndarray
35+
2D array containing the two centers in cartesian coordinates
36+
37+
Notes
38+
-----
39+
40+
* Must have vedo and nibabel installed
41+
* Must have run mne watershed BEM using freesurfer segmentation
42+
"""
43+
1644
mindist = 2e-3
1745
assert bem[0]["id"] == FIFF.FIFFV_BEM_SURF_ID_HEAD
1846
assert bem[2]["id"] == FIFF.FIFFV_BEM_SURF_ID_BRAIN

mne/preprocessing/maxwell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ def _run_mSSS(raw, origin):
849849
S_in = []
850850
for i in range(len(origin)):
851851
[S_i, _, _, moments_i] = compute_maxwell_basis(
852-
raw.info, origin=origin[i], regularize=None
852+
raw.info, origin=origin[i], regularize=None, bad_condition="ignore"
853853
)
854854
S_in.append(S_i[:, :moments_i])
855855

0 commit comments

Comments
 (0)