{"action":"created","issue":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/2229","labels_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2229/labels{/name}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2229/comments","events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2229/events","html_url":"https://github.com/mne-tools/mne-python/pull/2229","id":90052915,"number":2229,"title":"allow different channel ordering in fwd['sol'] and fwd['info']","user":{"login":"cjayb","id":5610076,"avatar_url":"https://avatars.githubusercontent.com/u/5610076?v=3","gravatar_id":"","url":"https://api.github.com/users/cjayb","html_url":"https://github.com/cjayb","followers_url":"https://api.github.com/users/cjayb/followers","following_url":"https://api.github.com/users/cjayb/following{/other_user}","gists_url":"https://api.github.com/users/cjayb/gists{/gist_id}","starred_url":"https://api.github.com/users/cjayb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjayb/subscriptions","organizations_url":"https://api.github.com/users/cjayb/orgs","repos_url":"https://api.github.com/users/cjayb/repos","events_url":"https://api.github.com/users/cjayb/events{/privacy}","received_events_url":"https://api.github.com/users/cjayb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-22T09:29:17Z","updated_at":"2015-06-22T14:40:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/2229","html_url":"https://github.com/mne-tools/mne-python/pull/2229","diff_url":"https://github.com/mne-tools/mne-python/pull/2229.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/2229.patch"},"body":"@Eric89GXL Here is the PR for the actual implementation. I've made a gist testing your suggested raw.info-reordering based on sample data:\r\n\r\nhttps://gist.github.com/cjayb/60ce9a543a4665348ad4\r\n\r\nThe new ordering is based on the order I found in Triux raw files (EOG, EEG, MEG, STI), and reproduces the error. Having separate selections for sol and info dicts (@3ebdb09eba52ac7cd37089dc7d448f0b97c0bab8) indeed solves the situation, though I am a little uncertain about `fwd['_orig_sol']` and `fwd['_orig_sol_grad']`?\r\n\r\nI tried to grasp the testing-structure, but feel I need your help to implement my gist as a proper test. Any pointers?\r\n\r\nCloses #2223 "},"comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments/114136118","html_url":"https://github.com/mne-tools/mne-python/pull/2229#issuecomment-114136118","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2229","id":114136118,"user":{"login":"cjayb","id":5610076,"avatar_url":"https://avatars.githubusercontent.com/u/5610076?v=3","gravatar_id":"","url":"https://api.github.com/users/cjayb","html_url":"https://github.com/cjayb","followers_url":"https://api.github.com/users/cjayb/followers","following_url":"https://api.github.com/users/cjayb/following{/other_user}","gists_url":"https://api.github.com/users/cjayb/gists{/gist_id}","starred_url":"https://api.github.com/users/cjayb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjayb/subscriptions","organizations_url":"https://api.github.com/users/cjayb/orgs","repos_url":"https://api.github.com/users/cjayb/repos","events_url":"https://api.github.com/users/cjayb/events{/privacy}","received_events_url":"https://api.github.com/users/cjayb/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T14:40:30Z","updated_at":"2015-06-22T14:40:30Z","body":"On thinking about how to write a test for this, I came across some troubling lines in `_prepare_forward` (`mne/minimum_norm/inverse.py`). Pardon my lack of abilities to comment code outside a commit (possible?), but here's the bit (L1125-):\r\n```\r\ngain = forward['sol']['data']\r\n\r\nfwd_idx = [fwd_ch_names.index(name) for name in ch_names]\r\ngain = gain[fwd_idx]\r\ninfo_idx = [info['ch_names'].index(name) for name in ch_names]\r\nfwd_info = pick_info(info, info_idx)\r\n```\r\nwhere the `fwd_ch_names` list is defined a few lines up (L1090) as\r\n\r\n```\r\nfwd_ch_names = [c['ch_name'] for c in forward['info']['chs']]\r\n```\r\n\r\nI'm guessing `forward['sol']['data']` will be ordered as `forward['sol']['row_names']`, so here also the fact that the row names are not the same as `forward['info']['ch_names']` will cause meltdown, no?\r\n\r\nPerhaps I'm approaching this from the wrong angle (treating a symptom instead of the cause): should the correspondence between row_names and ch_names be enforced at the fwd-generation stage?"}}