{"action":"created","comment":{"url":"https://api.github.com/repos/LABSN/mnefun/pulls/comments/54196919","id":54196919,"diff_hunk":"@@ -829,29 +873,128 @@ def run_sss_positions(fname_in, fname_out, host='kasga', opts='', port=22):\n             fnames_in.append(next_name)\n         else:\n             break\n-    port = str(int(port))\n-    t0 = time()\n-    remote_ins = ['~/' + op.basename(fname) for fname in fnames_in]\n-    remote_out = '~/temp_%s_raw_quat.fif' % t0\n-    remote_hp = '~/temp_%s_hp.txt' % t0\n+\n     print('  Copying file to %s' % host)\n-    cmd = ['scp', '-P' + port] + fnames_in + [host + ':~/']\n+    cmd = ['scp', '-P' + str(port)] + fnames_in + [host + ':~/']\n     run_subprocess(cmd, stdout=None, stderr=None)\n+    t0 = time()\n+    remote_ins = ['~/' + op.basename(f) for f in fnames_in]\n+    if len(remote_ins) > 1:\n+        fnames_out = [op.basename(r)[:-4] + '.tmp' for r in remote_ins]\n+        assert len(fnames_out) == len(fnames_in)\n+    else:\n+        fnames_out = [op.basename(fname_out)[:-4] + '.tmp']\n+    for fi, file_out in enumerate(fnames_out):\n+        remote_out = '~/temp_%s_raw_quat.fif' % t0\n+        remote_hp = '~/temp_%s_hp.txt' % t0\n+\n+        print('  Running maxfilter as %s' % host)\n+        cmd = ['ssh', '-p', str(port), host,\n+               '/neuro/bin/util/maxfilter -f ' + remote_ins[fi] + ' -o ' + remote_out +\n+               ' -headpos -format short -hp ' + remote_hp + ' ' + opts]\n+        run_subprocess(cmd)\n \n-    print('  Running maxfilter on %s' % host)\n-    cmd = ['ssh', '-p', port, host,\n-           'maxfilter -f ' + remote_ins[0] + ' -o ' + remote_out +\n-           ' -headpos -format short -hp ' + remote_hp + ' ' + opts]\n-    run_subprocess(cmd)\n-\n-    print('  Copying result to %s' % fname_out)\n-    cmd = ['scp', '-P' + port, host + ':' + remote_hp, fname_out]\n-    run_subprocess(cmd)\n+        print('  Copying result to %s' % file_out)\n+        cmd = ['scp', '-P' + str(port), host + ':' + remote_hp, op.join(pout, file_out)]\n+        run_subprocess(cmd)\n \n-    print('  Cleaning up %s' % host)\n-    cmd = ['ssh', '-p', port, host, 'rm -f %s %s %s'\n+        print('  Cleaning up %s' % host)\n+        cmd = ['ssh', '-p', str(port), host, 'rm -f %s %s %s'\n            % (' '.join(remote_ins), remote_hp, remote_out)]\n-    run_subprocess(cmd)\n+        run_subprocess(cmd)\n+\n+    # concatenate hp pos file for split raw files if any\n+    pos_data = []\n+    with open(fname_out, 'w') as fo:\n+        for f in fnames_out:\n+            with open(op.join(pout, f)) as infile:\n+                content = infile.readlines()\n+                header = content[0]\n+                qdata = content[1:]\n+                pos_data.append(qdata)\n+                os.remove(op.join(pout, f))\n+        pos_data.insert(0, header)\n+        fo.writelines(''.join(str(j) for j in i) for i in pos_data)\n+\n+\n+def run_sss_localy(p, subjects, run_indices):\n+    \"\"\"Run SSS localy using maxwell filter in python","path":"mnefun/_mnefun.py","position":314,"original_position":314,"commit_id":"958dc6833efe840d738f28cb3c134200ddcefb83","original_commit_id":"958dc6833efe840d738f28cb3c134200ddcefb83","user":{"login":"Eric89GXL","id":2365790,"avatar_url":"https://avatars.githubusercontent.com/u/2365790?v=3","gravatar_id":"","url":"https://api.github.com/users/Eric89GXL","html_url":"https://github.com/Eric89GXL","followers_url":"https://api.github.com/users/Eric89GXL/followers","following_url":"https://api.github.com/users/Eric89GXL/following{/other_user}","gists_url":"https://api.github.com/users/Eric89GXL/gists{/gist_id}","starred_url":"https://api.github.com/users/Eric89GXL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eric89GXL/subscriptions","organizations_url":"https://api.github.com/users/Eric89GXL/orgs","repos_url":"https://api.github.com/users/Eric89GXL/repos","events_url":"https://api.github.com/users/Eric89GXL/events{/privacy}","received_events_url":"https://api.github.com/users/Eric89GXL/received_events","type":"User","site_admin":false},"body":"same here","created_at":"2016-02-26T02:08:57Z","updated_at":"2016-02-26T02:08:57Z","html_url":"https://github.com/LABSN/mnefun/pull/112#discussion_r54196919","pull_request_url":"https://api.github.com/repos/LABSN/mnefun/pulls/112","_links":{"self":{"href":"https://api.github.com/repos/LABSN/mnefun/pulls/comments/54196919"},"html":{"href":"https://github.com/LABSN/mnefun/pull/112#discussion_r54196919"},"pull_request":{"href":"https://api.github.com/repos/LABSN/mnefun/pulls/112"}}},"pull_request":{"url":"https://api.github.com/repos/LABSN/mnefun/pulls/112","id":58214446,"html_url":"https://github.com/LABSN/mnefun/pull/112","diff_url":"https://github.com/LABSN/mnefun/pull/112.diff","patch_url":"https://github.com/LABSN/mnefun/pull/112.patch","issue_url":"https://api.github.com/repos/LABSN/mnefun/issues/112","number":112,"state":"open","locked":false,"title":"Maxwell filtering","user":{"login":"kambysese","id":4381290,"avatar_url":"https://avatars.githubusercontent.com/u/4381290?v=3","gravatar_id":"","url":"https://api.github.com/users/kambysese","html_url":"https://github.com/kambysese","followers_url":"https://api.github.com/users/kambysese/followers","following_url":"https://api.github.com/users/kambysese/following{/other_user}","gists_url":"https://api.github.com/users/kambysese/gists{/gist_id}","starred_url":"https://api.github.com/users/kambysese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kambysese/subscriptions","organizations_url":"https://api.github.com/users/kambysese/orgs","repos_url":"https://api.github.com/users/kambysese/repos","events_url":"https://api.github.com/users/kambysese/events{/privacy}","received_events_url":"https://api.github.com/users/kambysese/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-03T22:52:19Z","updated_at":"2016-02-26T02:08:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"95f4717c8198b04176480faf889eecf4d0759469","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/LABSN/mnefun/pulls/112/commits","review_comments_url":"https://api.github.com/repos/LABSN/mnefun/pulls/112/comments","review_comment_url":"https://api.github.com/repos/LABSN/mnefun/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LABSN/mnefun/issues/112/comments","statuses_url":"https://api.github.com/repos/LABSN/mnefun/statuses/958dc6833efe840d738f28cb3c134200ddcefb83","head":{"label":"kambysese:maxwell-filtering","ref":"maxwell-filtering","sha":"958dc6833efe840d738f28cb3c134200ddcefb83","user":{"login":"kambysese","id":4381290,"avatar_url":"https://avatars.githubusercontent.com/u/4381290?v=3","gravatar_id":"","url":"https://api.github.com/users/kambysese","html_url":"https://github.com/kambysese","followers_url":"https://api.github.com/users/kambysese/followers","following_url":"https://api.github.com/users/kambysese/following{/other_user}","gists_url":"https://api.github.com/users/kambysese/gists{/gist_id}","starred_url":"https://api.github.com/users/kambysese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kambysese/subscriptions","organizations_url":"https://api.github.com/users/kambysese/orgs","repos_url":"https://api.github.com/users/kambysese/repos","events_url":"https://api.github.com/users/kambysese/events{/privacy}","received_events_url":"https://api.github.com/users/kambysese/received_events","type":"User","site_admin":false},"repo":{"id":39974088,"name":"mnefun","full_name":"kambysese/mnefun","owner":{"login":"kambysese","id":4381290,"avatar_url":"https://avatars.githubusercontent.com/u/4381290?v=3","gravatar_id":"","url":"https://api.github.com/users/kambysese","html_url":"https://github.com/kambysese","followers_url":"https://api.github.com/users/kambysese/followers","following_url":"https://api.github.com/users/kambysese/following{/other_user}","gists_url":"https://api.github.com/users/kambysese/gists{/gist_id}","starred_url":"https://api.github.com/users/kambysese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kambysese/subscriptions","organizations_url":"https://api.github.com/users/kambysese/orgs","repos_url":"https://api.github.com/users/kambysese/repos","events_url":"https://api.github.com/users/kambysese/events{/privacy}","received_events_url":"https://api.github.com/users/kambysese/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kambysese/mnefun","description":"Facilitating lab integration with mne-python","fork":true,"url":"https://api.github.com/repos/kambysese/mnefun","forks_url":"https://api.github.com/repos/kambysese/mnefun/forks","keys_url":"https://api.github.com/repos/kambysese/mnefun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kambysese/mnefun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kambysese/mnefun/teams","hooks_url":"https://api.github.com/repos/kambysese/mnefun/hooks","issue_events_url":"https://api.github.com/repos/kambysese/mnefun/issues/events{/number}","events_url":"https://api.github.com/repos/kambysese/mnefun/events","assignees_url":"https://api.github.com/repos/kambysese/mnefun/assignees{/user}","branches_url":"https://api.github.com/repos/kambysese/mnefun/branches{/branch}","tags_url":"https://api.github.com/repos/kambysese/mnefun/tags","blobs_url":"https://api.github.com/repos/kambysese/mnefun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kambysese/mnefun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kambysese/mnefun/git/refs{/sha}","trees_url":"https://api.github.com/repos/kambysese/mnefun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kambysese/mnefun/statuses/{sha}","languages_url":"https://api.github.com/repos/kambysese/mnefun/languages","stargazers_url":"https://api.github.com/repos/kambysese/mnefun/stargazers","contributors_url":"https://api.github.com/repos/kambysese/mnefun/contributors","subscribers_url":"https://api.github.com/repos/kambysese/mnefun/subscribers","subscription_url":"https://api.github.com/repos/kambysese/mnefun/subscription","commits_url":"https://api.github.com/repos/kambysese/mnefun/commits{/sha}","git_commits_url":"https://api.github.com/repos/kambysese/mnefun/git/commits{/sha}","comments_url":"https://api.github.com/repos/kambysese/mnefun/comments{/number}","issue_comment_url":"https://api.github.com/repos/kambysese/mnefun/issues/comments{/number}","contents_url":"https://api.github.com/repos/kambysese/mnefun/contents/{+path}","compare_url":"https://api.github.com/repos/kambysese/mnefun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kambysese/mnefun/merges","archive_url":"https://api.github.com/repos/kambysese/mnefun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kambysese/mnefun/downloads","issues_url":"https://api.github.com/repos/kambysese/mnefun/issues{/number}","pulls_url":"https://api.github.com/repos/kambysese/mnefun/pulls{/number}","milestones_url":"https://api.github.com/repos/kambysese/mnefun/milestones{/number}","notifications_url":"https://api.github.com/repos/kambysese/mnefun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kambysese/mnefun/labels{/name}","releases_url":"https://api.github.com/repos/kambysese/mnefun/releases{/id}","deployments_url":"https://api.github.com/repos/kambysese/mnefun/deployments","created_at":"2015-07-30T21:52:55Z","updated_at":"2016-02-03T23:40:48Z","pushed_at":"2016-02-25T21:40:42Z","git_url":"git://github.com/kambysese/mnefun.git","ssh_url":"git@github.com:kambysese/mnefun.git","clone_url":"https://github.com/kambysese/mnefun.git","svn_url":"https://github.com/kambysese/mnefun","homepage":null,"size":623,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"LABSN:master","ref":"master","sha":"7181449a9a566ff4db9e99628d8cf0e49764ec6c","user":{"login":"LABSN","id":3766097,"avatar_url":"https://avatars.githubusercontent.com/u/3766097?v=3","gravatar_id":"","url":"https://api.github.com/users/LABSN","html_url":"https://github.com/LABSN","followers_url":"https://api.github.com/users/LABSN/followers","following_url":"https://api.github.com/users/LABSN/following{/other_user}","gists_url":"https://api.github.com/users/LABSN/gists{/gist_id}","starred_url":"https://api.github.com/users/LABSN/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LABSN/subscriptions","organizations_url":"https://api.github.com/users/LABSN/orgs","repos_url":"https://api.github.com/users/LABSN/repos","events_url":"https://api.github.com/users/LABSN/events{/privacy}","received_events_url":"https://api.github.com/users/LABSN/received_events","type":"Organization","site_admin":false},"repo":{"id":17719360,"name":"mnefun","full_name":"LABSN/mnefun","owner":{"login":"LABSN","id":3766097,"avatar_url":"https://avatars.githubusercontent.com/u/3766097?v=3","gravatar_id":"","url":"https://api.github.com/users/LABSN","html_url":"https://github.com/LABSN","followers_url":"https://api.github.com/users/LABSN/followers","following_url":"https://api.github.com/users/LABSN/following{/other_user}","gists_url":"https://api.github.com/users/LABSN/gists{/gist_id}","starred_url":"https://api.github.com/users/LABSN/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LABSN/subscriptions","organizations_url":"https://api.github.com/users/LABSN/orgs","repos_url":"https://api.github.com/users/LABSN/repos","events_url":"https://api.github.com/users/LABSN/events{/privacy}","received_events_url":"https://api.github.com/users/LABSN/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LABSN/mnefun","description":"Facilitating lab integration with mne-python","fork":false,"url":"https://api.github.com/repos/LABSN/mnefun","forks_url":"https://api.github.com/repos/LABSN/mnefun/forks","keys_url":"https://api.github.com/repos/LABSN/mnefun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LABSN/mnefun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LABSN/mnefun/teams","hooks_url":"https://api.github.com/repos/LABSN/mnefun/hooks","issue_events_url":"https://api.github.com/repos/LABSN/mnefun/issues/events{/number}","events_url":"https://api.github.com/repos/LABSN/mnefun/events","assignees_url":"https://api.github.com/repos/LABSN/mnefun/assignees{/user}","branches_url":"https://api.github.com/repos/LABSN/mnefun/branches{/branch}","tags_url":"https://api.github.com/repos/LABSN/mnefun/tags","blobs_url":"https://api.github.com/repos/LABSN/mnefun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LABSN/mnefun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LABSN/mnefun/git/refs{/sha}","trees_url":"https://api.github.com/repos/LABSN/mnefun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LABSN/mnefun/statuses/{sha}","languages_url":"https://api.github.com/repos/LABSN/mnefun/languages","stargazers_url":"https://api.github.com/repos/LABSN/mnefun/stargazers","contributors_url":"https://api.github.com/repos/LABSN/mnefun/contributors","subscribers_url":"https://api.github.com/repos/LABSN/mnefun/subscribers","subscription_url":"https://api.github.com/repos/LABSN/mnefun/subscription","commits_url":"https://api.github.com/repos/LABSN/mnefun/commits{/sha}","git_commits_url":"https://api.github.com/repos/LABSN/mnefun/git/commits{/sha}","comments_url":"https://api.github.com/repos/LABSN/mnefun/comments{/number}","issue_comment_url":"https://api.github.com/repos/LABSN/mnefun/issues/comments{/number}","contents_url":"https://api.github.com/repos/LABSN/mnefun/contents/{+path}","compare_url":"https://api.github.com/repos/LABSN/mnefun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LABSN/mnefun/merges","archive_url":"https://api.github.com/repos/LABSN/mnefun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LABSN/mnefun/downloads","issues_url":"https://api.github.com/repos/LABSN/mnefun/issues{/number}","pulls_url":"https://api.github.com/repos/LABSN/mnefun/pulls{/number}","milestones_url":"https://api.github.com/repos/LABSN/mnefun/milestones{/number}","notifications_url":"https://api.github.com/repos/LABSN/mnefun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LABSN/mnefun/labels{/name}","releases_url":"https://api.github.com/repos/LABSN/mnefun/releases{/id}","deployments_url":"https://api.github.com/repos/LABSN/mnefun/deployments","created_at":"2014-03-13T17:20:05Z","updated_at":"2016-01-27T17:02:22Z","pushed_at":"2016-02-25T21:40:43Z","git_url":"git://github.com/LABSN/mnefun.git","ssh_url":"git@github.com:LABSN/mnefun.git","clone_url":"https://github.com/LABSN/mnefun.git","svn_url":"https://github.com/LABSN/mnefun","homepage":null,"size":702,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":4,"forks":5,"open_issues":4,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/LABSN/mnefun/pulls/112"},"html":{"href":"https://github.com/LABSN/mnefun/pull/112"},"issue":{"href":"https://api.github.com/repos/LABSN/mnefun/issues/112"},"comments":{"href":"https://api.github.com/repos/LABSN/mnefun/issues/112/comments"},"review_comments":{"href":"https://api.github.com/repos/LABSN/mnefun/pulls/112/comments"},"review_comment":{"href":"https://api.github.com/repos/LABSN/mnefun/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LABSN/mnefun/pulls/112/commits"},"statuses":{"href":"https://api.github.com/repos/LABSN/mnefun/statuses/958dc6833efe840d738f28cb3c134200ddcefb83"}}}}