Skip to content

Commit

Permalink
FIX: Check
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Nov 16, 2024
1 parent 64f391c commit 4cdf90c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mne/preprocessing/_fine_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ def compute_fine_calibration(
ext_order = _ensure_int(ext_order, "ext_order")
origin = _check_origin(origin, raw.info, "meg", disp=True)
_check_option("raw.info['bads']", raw.info["bads"], ([],))
_validate_type(err_limit, "numeric", "err_limit")
_validate_type(angle_limit, "numeric", "angle_limit")
for key, val in dict(err_limit=err_limit, angle_limit=angle_limit).items():
if val < 0:
raise ValueError(f"{key} must be greater than or equal to 0, got {val}")
# Fine cal should not include ref channels
picks = pick_types(raw.info, meg=True, ref_meg=False)
if raw.info["dev_head_t"] is not None:
Expand Down
4 changes: 4 additions & 0 deletions mne/preprocessing/tests/test_fine_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def test_compute_fine_cal(kind):
cl3 = [-0.3, -0.1]
raw = read_raw_fif(erm)
want_cal = read_fine_calibration(cal)
with pytest.raises(ValueError, match="err_limit.*greater.*0"):
compute_fine_calibration(raw, err_limit=-1)
with pytest.raises(ValueError, match="angle_limit.*greater.*0"):
compute_fine_calibration(raw, angle_limit=-1)
got_cal, counts = compute_fine_calibration(
raw,
cross_talk=ctc,
Expand Down

0 comments on commit 4cdf90c

Please sign in to comment.