Skip to content

Commit

Permalink
FIX MneExperiment: src other than ico-4
Browse files Browse the repository at this point in the history
Was not included in path
  • Loading branch information
christianbrodbeck committed Mar 9, 2017
1 parent b253ea6 commit 663ac68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion eelbrain/_experiment/mne_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,10 +1062,13 @@ def __init__(self, root=None, find_subjects=True, **state):
# slave fields
self._register_field('mrisubject', depends_on=('mri', 'subject'),
slave_handler=self._update_mrisubject)
self._register_field('src-name', depends_on=('src',),
slave_handler=self._update_src_name)

# compounds
self._register_compound('sns_kind', ('modality', 'raw'))
self._register_compound('src_kind', ('sns_kind', 'cov', 'mri', 'inv'))
self._register_compound('src_kind', ('sns_kind', 'cov', 'mri',
'src-name', 'inv'))
self._register_compound('evoked_kind', ('rej', 'equalize_evoked_count'))
self._register_compound('eeg_kind', ('sns_kind', 'reference'))

Expand Down Expand Up @@ -5784,6 +5787,10 @@ def _update_session(self, fields):
if isinstance(epoch, (PrimaryEpoch, SecondaryEpoch)):
return epoch.session

def _update_src_name(self, fields):
"Becuase 'ico-4' is treated in filenames as ''"
return '' if fields['src'] == 'ico-4' else fields['src']

def _eval_parc(self, parc):
if parc in self._parcs:
if isinstance(self._parcs[parc], SeededParcellation):
Expand Down
4 changes: 4 additions & 0 deletions eelbrain/_experiment/tests/test_mne_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def test_mne_experiment_templates():
eq_(e.get('src_kind'), '0-40 noreg fixed-3-dSPM')
e.set(raw='1-40')
eq_(e.get('src_kind'), '1-40 noreg fixed-3-dSPM')
e.set(src='ico-5')
eq_(e.get('src_kind'), '1-40 noreg ico-5 fixed-3-dSPM')
e.set(src='ico-4')
eq_(e.get('src_kind'), '1-40 noreg fixed-3-dSPM')

# find terminal field names
eq_(e.find_keys('raw-file'), {'root', 'subject', 'session'})
Expand Down

0 comments on commit 663ac68

Please sign in to comment.