{"action":"created","comment":{"url":"https://api.github.com/repos/nilearn/nilearn/pulls/comments/30036343","id":30036343,"diff_hunk":"@@ -452,8 +453,22 @@ def clean(signals, detrend=True, standardize=True, confounds=None,\n \n         confounds = _ensure_float(confounds)\n         confounds = _standardize(confounds, normalize=True, detrend=detrend)\n-        Q = linalg.qr(confounds, mode='economic')[0]\n-        signals -= np.dot(Q, np.dot(Q.T, signals))\n+\n+        if (LooseVersion(scipy.__version__) > LooseVersion('0.9.0')):\n+            # Pivoting in qr decomposition was added in scipy 0.10\n+            Q, R, _ = linalg.qr(confounds, mode='economic', pivoting=True)\n+            Q = Q[:, np.abs(np.diag(R)) > np.finfo(np.float).eps * 100.]\n+            signals -= Q.dot(Q.T).dot(signals)\n+        else:\n+            Q, R = linalg.qr(confounds, mode='economic')\n+            non_null_diag = np.abs(np.diag(R)) > np.finfo(np.float).eps * 100.\n+            if np.all(non_null_diag):\n+                signals -= Q.dot(Q.T).dot(signals)\n+            elif np.any(non_null_diag):\n+                R = R[:, non_null_diag]\n+                confounds = confounds[:, non_null_diag]\n+                inv = scipy.linalg.inv(np.dot(R.T, R))\n+                signals -= confounds.dot(inv).dot(confounds.T).dot(signals)","path":"nilearn/signal.py","position":41,"original_position":45,"commit_id":"2df12d7a2d295d14288d825f25977cd353db9c3e","original_commit_id":"fa5a3f70f7ddbaf9b0418a62e3dbb1efe47eeb70","user":{"login":"GaelVaroquaux","id":208217,"avatar_url":"https://avatars.githubusercontent.com/u/208217?v=3","gravatar_id":"","url":"https://api.github.com/users/GaelVaroquaux","html_url":"https://github.com/GaelVaroquaux","followers_url":"https://api.github.com/users/GaelVaroquaux/followers","following_url":"https://api.github.com/users/GaelVaroquaux/following{/other_user}","gists_url":"https://api.github.com/users/GaelVaroquaux/gists{/gist_id}","starred_url":"https://api.github.com/users/GaelVaroquaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GaelVaroquaux/subscriptions","organizations_url":"https://api.github.com/users/GaelVaroquaux/orgs","repos_url":"https://api.github.com/users/GaelVaroquaux/repos","events_url":"https://api.github.com/users/GaelVaroquaux/events{/privacy}","received_events_url":"https://api.github.com/users/GaelVaroquaux/received_events","type":"User","site_admin":false},"body":"How about we cut our losses here and stop discussing minute details to\nfocus on the big picture: the problem is solved, and we want to release\n0.1.3 to get bug fixes out to our users.\n\nYou may perfectly be right. I would welcome a PR with corresponding\ntimings showing that it is possible to simplify the code with the same\nnumerical stability and speed. But in the mean time, I really want to get\n0.1.3 out.\n","created_at":"2015-05-11T13:14:08Z","updated_at":"2015-05-11T13:14:08Z","html_url":"https://github.com/nilearn/nilearn/pull/580#discussion_r30036343","pull_request_url":"https://api.github.com/repos/nilearn/nilearn/pulls/580","_links":{"self":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/comments/30036343"},"html":{"href":"https://github.com/nilearn/nilearn/pull/580#discussion_r30036343"},"pull_request":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/580"}}},"pull_request":{"url":"https://api.github.com/repos/nilearn/nilearn/pulls/580","id":35116624,"html_url":"https://github.com/nilearn/nilearn/pull/580","diff_url":"https://github.com/nilearn/nilearn/pull/580.diff","patch_url":"https://github.com/nilearn/nilearn/pull/580.patch","issue_url":"https://api.github.com/repos/nilearn/nilearn/issues/580","number":580,"state":"open","locked":false,"title":"[MRG+1] Pr 563 rebased: Deal with non-full rank confounds","user":{"login":"GaelVaroquaux","id":208217,"avatar_url":"https://avatars.githubusercontent.com/u/208217?v=3","gravatar_id":"","url":"https://api.github.com/users/GaelVaroquaux","html_url":"https://github.com/GaelVaroquaux","followers_url":"https://api.github.com/users/GaelVaroquaux/followers","following_url":"https://api.github.com/users/GaelVaroquaux/following{/other_user}","gists_url":"https://api.github.com/users/GaelVaroquaux/gists{/gist_id}","starred_url":"https://api.github.com/users/GaelVaroquaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GaelVaroquaux/subscriptions","organizations_url":"https://api.github.com/users/GaelVaroquaux/orgs","repos_url":"https://api.github.com/users/GaelVaroquaux/repos","events_url":"https://api.github.com/users/GaelVaroquaux/events{/privacy}","received_events_url":"https://api.github.com/users/GaelVaroquaux/received_events","type":"User","site_admin":false},"body":"Rebased version of https://github.com/nilearn/nilearn/pull/563 by @salma1601 \r\n\r\nFixes #561","created_at":"2015-05-11T10:56:26Z","updated_at":"2015-05-11T13:14:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4e6b60f0018d7371b94649c812c7e4464f7164c2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nilearn/nilearn/pulls/580/commits","review_comments_url":"https://api.github.com/repos/nilearn/nilearn/pulls/580/comments","review_comment_url":"https://api.github.com/repos/nilearn/nilearn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nilearn/nilearn/issues/580/comments","statuses_url":"https://api.github.com/repos/nilearn/nilearn/statuses/2df12d7a2d295d14288d825f25977cd353db9c3e","head":{"label":"GaelVaroquaux:pr_563_rebase","ref":"pr_563_rebase","sha":"2df12d7a2d295d14288d825f25977cd353db9c3e","user":{"login":"GaelVaroquaux","id":208217,"avatar_url":"https://avatars.githubusercontent.com/u/208217?v=3","gravatar_id":"","url":"https://api.github.com/users/GaelVaroquaux","html_url":"https://github.com/GaelVaroquaux","followers_url":"https://api.github.com/users/GaelVaroquaux/followers","following_url":"https://api.github.com/users/GaelVaroquaux/following{/other_user}","gists_url":"https://api.github.com/users/GaelVaroquaux/gists{/gist_id}","starred_url":"https://api.github.com/users/GaelVaroquaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GaelVaroquaux/subscriptions","organizations_url":"https://api.github.com/users/GaelVaroquaux/orgs","repos_url":"https://api.github.com/users/GaelVaroquaux/repos","events_url":"https://api.github.com/users/GaelVaroquaux/events{/privacy}","received_events_url":"https://api.github.com/users/GaelVaroquaux/received_events","type":"User","site_admin":false},"repo":{"id":2084934,"name":"nilearn","full_name":"GaelVaroquaux/nilearn","owner":{"login":"GaelVaroquaux","id":208217,"avatar_url":"https://avatars.githubusercontent.com/u/208217?v=3","gravatar_id":"","url":"https://api.github.com/users/GaelVaroquaux","html_url":"https://github.com/GaelVaroquaux","followers_url":"https://api.github.com/users/GaelVaroquaux/followers","following_url":"https://api.github.com/users/GaelVaroquaux/following{/other_user}","gists_url":"https://api.github.com/users/GaelVaroquaux/gists{/gist_id}","starred_url":"https://api.github.com/users/GaelVaroquaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GaelVaroquaux/subscriptions","organizations_url":"https://api.github.com/users/GaelVaroquaux/orgs","repos_url":"https://api.github.com/users/GaelVaroquaux/repos","events_url":"https://api.github.com/users/GaelVaroquaux/events{/privacy}","received_events_url":"https://api.github.com/users/GaelVaroquaux/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GaelVaroquaux/nilearn","description":"NeuroImaging with the Scikit-learn: fMRI inverse inference tutorial","fork":true,"url":"https://api.github.com/repos/GaelVaroquaux/nilearn","forks_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/forks","keys_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/teams","hooks_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/hooks","issue_events_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/issues/events{/number}","events_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/events","assignees_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/assignees{/user}","branches_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/branches{/branch}","tags_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/tags","blobs_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/git/refs{/sha}","trees_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/statuses/{sha}","languages_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/languages","stargazers_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/stargazers","contributors_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/contributors","subscribers_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/subscribers","subscription_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/subscription","commits_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/commits{/sha}","git_commits_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/git/commits{/sha}","comments_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/comments{/number}","issue_comment_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/issues/comments{/number}","contents_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/contents/{+path}","compare_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/merges","archive_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/downloads","issues_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/issues{/number}","pulls_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/pulls{/number}","milestones_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/milestones{/number}","notifications_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/labels{/name}","releases_url":"https://api.github.com/repos/GaelVaroquaux/nilearn/releases{/id}","created_at":"2011-07-21T18:19:33Z","updated_at":"2015-04-24T15:37:47Z","pushed_at":"2015-05-11T13:08:10Z","git_url":"git://github.com/GaelVaroquaux/nilearn.git","ssh_url":"git@github.com:GaelVaroquaux/nilearn.git","clone_url":"https://github.com/GaelVaroquaux/nilearn.git","svn_url":"https://github.com/GaelVaroquaux/nilearn","homepage":"http://nisl.github.com/","size":7931,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"nilearn:master","ref":"master","sha":"efbbc260962cf5766e07ad8b13c7b93b5121fa04","user":{"login":"nilearn","id":4646912,"avatar_url":"https://avatars.githubusercontent.com/u/4646912?v=3","gravatar_id":"","url":"https://api.github.com/users/nilearn","html_url":"https://github.com/nilearn","followers_url":"https://api.github.com/users/nilearn/followers","following_url":"https://api.github.com/users/nilearn/following{/other_user}","gists_url":"https://api.github.com/users/nilearn/gists{/gist_id}","starred_url":"https://api.github.com/users/nilearn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilearn/subscriptions","organizations_url":"https://api.github.com/users/nilearn/orgs","repos_url":"https://api.github.com/users/nilearn/repos","events_url":"https://api.github.com/users/nilearn/events{/privacy}","received_events_url":"https://api.github.com/users/nilearn/received_events","type":"Organization","site_admin":false},"repo":{"id":1235740,"name":"nilearn","full_name":"nilearn/nilearn","owner":{"login":"nilearn","id":4646912,"avatar_url":"https://avatars.githubusercontent.com/u/4646912?v=3","gravatar_id":"","url":"https://api.github.com/users/nilearn","html_url":"https://github.com/nilearn","followers_url":"https://api.github.com/users/nilearn/followers","following_url":"https://api.github.com/users/nilearn/following{/other_user}","gists_url":"https://api.github.com/users/nilearn/gists{/gist_id}","starred_url":"https://api.github.com/users/nilearn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilearn/subscriptions","organizations_url":"https://api.github.com/users/nilearn/orgs","repos_url":"https://api.github.com/users/nilearn/repos","events_url":"https://api.github.com/users/nilearn/events{/privacy}","received_events_url":"https://api.github.com/users/nilearn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nilearn/nilearn","description":"Machine learning for NeuroImaging in Python","fork":false,"url":"https://api.github.com/repos/nilearn/nilearn","forks_url":"https://api.github.com/repos/nilearn/nilearn/forks","keys_url":"https://api.github.com/repos/nilearn/nilearn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nilearn/nilearn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nilearn/nilearn/teams","hooks_url":"https://api.github.com/repos/nilearn/nilearn/hooks","issue_events_url":"https://api.github.com/repos/nilearn/nilearn/issues/events{/number}","events_url":"https://api.github.com/repos/nilearn/nilearn/events","assignees_url":"https://api.github.com/repos/nilearn/nilearn/assignees{/user}","branches_url":"https://api.github.com/repos/nilearn/nilearn/branches{/branch}","tags_url":"https://api.github.com/repos/nilearn/nilearn/tags","blobs_url":"https://api.github.com/repos/nilearn/nilearn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nilearn/nilearn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nilearn/nilearn/git/refs{/sha}","trees_url":"https://api.github.com/repos/nilearn/nilearn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nilearn/nilearn/statuses/{sha}","languages_url":"https://api.github.com/repos/nilearn/nilearn/languages","stargazers_url":"https://api.github.com/repos/nilearn/nilearn/stargazers","contributors_url":"https://api.github.com/repos/nilearn/nilearn/contributors","subscribers_url":"https://api.github.com/repos/nilearn/nilearn/subscribers","subscription_url":"https://api.github.com/repos/nilearn/nilearn/subscription","commits_url":"https://api.github.com/repos/nilearn/nilearn/commits{/sha}","git_commits_url":"https://api.github.com/repos/nilearn/nilearn/git/commits{/sha}","comments_url":"https://api.github.com/repos/nilearn/nilearn/comments{/number}","issue_comment_url":"https://api.github.com/repos/nilearn/nilearn/issues/comments{/number}","contents_url":"https://api.github.com/repos/nilearn/nilearn/contents/{+path}","compare_url":"https://api.github.com/repos/nilearn/nilearn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nilearn/nilearn/merges","archive_url":"https://api.github.com/repos/nilearn/nilearn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nilearn/nilearn/downloads","issues_url":"https://api.github.com/repos/nilearn/nilearn/issues{/number}","pulls_url":"https://api.github.com/repos/nilearn/nilearn/pulls{/number}","milestones_url":"https://api.github.com/repos/nilearn/nilearn/milestones{/number}","notifications_url":"https://api.github.com/repos/nilearn/nilearn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nilearn/nilearn/labels{/name}","releases_url":"https://api.github.com/repos/nilearn/nilearn/releases{/id}","created_at":"2011-01-09T19:02:23Z","updated_at":"2015-05-07T11:41:10Z","pushed_at":"2015-05-11T13:08:11Z","git_url":"git://github.com/nilearn/nilearn.git","ssh_url":"git@github.com:nilearn/nilearn.git","clone_url":"https://github.com/nilearn/nilearn.git","svn_url":"https://github.com/nilearn/nilearn","homepage":"http://nilearn.github.io","size":13589,"stargazers_count":80,"watchers_count":80,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":63,"forks":61,"open_issues":63,"watchers":80,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/580"},"html":{"href":"https://github.com/nilearn/nilearn/pull/580"},"issue":{"href":"https://api.github.com/repos/nilearn/nilearn/issues/580"},"comments":{"href":"https://api.github.com/repos/nilearn/nilearn/issues/580/comments"},"review_comments":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/580/comments"},"review_comment":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/580/commits"},"statuses":{"href":"https://api.github.com/repos/nilearn/nilearn/statuses/2df12d7a2d295d14288d825f25977cd353db9c3e"}}}}