This is an automated email from the git hooks/post-receive script. yoh pushed a commit to tag 0.4 in repository python-mne.
commit 3acb855e1f81779b1f0331dd77c86e946814fed6 Author: Alexandre Gramfort <[email protected]> Date: Wed Jul 18 16:25:46 2012 +0200 ENH : factorize is_fixed_orient and compute_orient_prior --- mne/forward.py | 10 +++++----- mne/minimum_norm/inverse.py | 13 +++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/mne/forward.py b/mne/forward.py index d934c0a..b66686c 100644 --- a/mne/forward.py +++ b/mne/forward.py @@ -295,7 +295,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False, megfwd = _read_one(fid, megnode) if megfwd is not None: - if megfwd['source_ori'] == FIFF.FIFFV_MNE_FIXED_ORI: + if is_fixed_orient(megfwd): ori = 'fixed' else: ori = 'free' @@ -305,7 +305,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False, eegfwd = _read_one(fid, eegnode) if eegfwd is not None: - if eegfwd['source_ori'] == FIFF.FIFFV_MNE_FIXED_ORI: + if is_fixed_orient(eegfwd): ori = 'fixed' else: ori = 'free' @@ -395,7 +395,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False, fwd['src'] = src # Handle the source locations and orientations - if (fwd['source_ori'] == FIFF.FIFFV_MNE_FIXED_ORI) or force_fixed: + if is_fixed_orient(fwd) or force_fixed: nuse = 0 fwd['source_rr'] = np.zeros((fwd['nsource'], 3)) fwd['source_nn'] = np.zeros((fwd['nsource'], 3)) @@ -407,7 +407,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False, nuse += s['nuse'] # Modify the forward solution for fixed source orientations - if fwd['source_ori'] != FIFF.FIFFV_MNE_FIXED_ORI: + if not is_fixed_orient(fwd): print ' Changing to fixed-orientation forward solution...' fix_rot = _block_diag(fwd['source_nn'].T, 1) fwd['sol']['data'] *= fix_rot @@ -625,7 +625,7 @@ def _fill_measurement_info(info, fwd, sfreq): def _apply_forward(fwd, stc, start=None, stop=None): """ Apply forward model and return data, times, ch_names """ - if fwd['source_ori'] != FIFF.FIFFV_MNE_FIXED_ORI: + if not is_fixed_orient(fwd['source_ori']): raise ValueError('Only fixed-orientation forward operators are ' 'supported.') diff --git a/mne/minimum_norm/inverse.py b/mne/minimum_norm/inverse.py index 7b742ca..88d5bf0 100644 --- a/mne/minimum_norm/inverse.py +++ b/mne/minimum_norm/inverse.py @@ -24,7 +24,8 @@ from ..fiff.cov import read_cov, write_cov from ..fiff.pick import channel_type from ..cov import prepare_noise_cov from ..forward import compute_depth_prior, compute_depth_prior_fixed, \ - read_forward_meas_info, write_forward_meas_info + read_forward_meas_info, write_forward_meas_info, \ + is_fixed_orient, compute_orient_prior from ..source_space import read_source_spaces_from_tree, \ find_source_space_hemi, _get_vertno, \ write_source_spaces @@ -1025,7 +1026,7 @@ def make_inverse_operator(info, forward, noise_cov, loose=0.2, depth=0.8): stc: dict Source time courses """ - is_fixed_ori = (forward['source_ori'] == FIFF.FIFFV_MNE_FIXED_ORI) + is_fixed_ori = is_fixed_orient(forward) if is_fixed_ori and loose is not None: warnings.warn('Ignoring loose parameter with forward operator with ' 'fixed orientation.') @@ -1069,12 +1070,8 @@ def make_inverse_operator(info, forward, noise_cov, loose=0.2, depth=0.8): # apply loose orientations if not is_fixed_ori: - orient_prior = np.ones(n_dipoles, dtype=gain.dtype) - if loose is not None: - print ('Applying loose dipole orientations. Loose value of %s.' - % loose) - orient_prior[np.mod(np.arange(n_dipoles), 3) != 2] *= loose - source_cov *= orient_prior + orient_prior = compute_orient_prior(forward, loose=loose) + source_cov *= orient_prior orient_prior = dict(data=orient_prior, kind=FIFF.FIFFV_MNE_ORIENT_PRIOR_COV, bads=[], diag=True, names=[], eig=None, -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
