Skip to content

Commit

Permalink
Merge pull request mne-tools#3007 from Eric89GXL/fix-timing
Browse files Browse the repository at this point in the history
FIX: More tolerant
  • Loading branch information
larsoner committed Mar 12, 2016
2 parents 6fb64f0 + 627536a commit a95428a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion mne/preprocessing/maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,9 @@ def _check_pos(pos, head_frame, raw, st_fixed, sfreq):
t_off = raw.first_samp / raw.info['sfreq']
if not np.array_equal(t, np.unique(t)):
raise ValueError('Time points must unique and in ascending order')
if not _time_mask(t, tmin=t_off, tmax=None, sfreq=sfreq).all():
# We need an extra 1e-3 (1 ms) here because MaxFilter outputs values
# only out to 3 decimal places
if not _time_mask(t, tmin=t_off - 1e-3, tmax=None, sfreq=sfreq).all():
raise ValueError('Head position time points must be greater than '
'first sample offset, but found %0.4f < %0.4f'
% (t[0], t_off))
Expand Down
4 changes: 2 additions & 2 deletions mne/preprocessing/tests/test_maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ def test_movement_compensation():
head_pos_bad[0, 0] = raw.first_samp / raw.info['sfreq'] - 1e-2
assert_raises(ValueError, maxwell_filter, raw, head_pos=head_pos_bad)
# make sure numerical error doesn't screw it up, though
head_pos_bad[0, 0] = raw.first_samp / raw.info['sfreq'] - 1e-4
head_pos_bad[0, 0] = raw.first_samp / raw.info['sfreq'] - 5e-4
raw_sss_tweak = maxwell_filter(raw, head_pos=head_pos_bad,
origin=mf_head_origin)
assert_meg_snr(raw_sss_tweak, raw_sss, 2., 10.)
assert_meg_snr(raw_sss_tweak, raw_sss, 2., 10., chpi_med_tol=11)


@slow_test
Expand Down

0 comments on commit a95428a

Please sign in to comment.