{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/comments/47955980","id":47955980,"diff_hunk":"@@ -1233,3 +1234,164 @@ def _get_activated_line(incident_energy, elemental_line):\n                 continue\n             line_list.append(str(element)+'_'+str(line_name))\n         return line_list\n+\n+\n+def fit_per_line_nnls(row_num, data,\n+                      matv, param, use_snip):\n+    \"\"\"\n+    Fit experiment data for a given row using nnls algorithm.\n+    Parameters\n+    ----------\n+    row_num : int\n+        which row to fit\n+    data : array\n+        selected one row of experiment spectrum\n+    matv : array\n+        matrix for regression analysis\n+    param : dict\n+        fitting parameters\n+    use_snip : bool\n+        use snip algorithm to remove background or not\n+\n+    Returns\n+    -------\n+    array :\n+        fitting values for all the elements at a given row. Background is\n+        calculated as a summed value. Also residual is included.\n+    \"\"\"\n+    logger.info('Row number at {}'.format(row_num))\n+    out = []\n+    bg_sum = 0\n+    for i in range(data.shape[0]):\n+        if use_snip is True:\n+            bg = snip_method(data[i, :],\n+                             param['e_offset']['value'],\n+                             param['e_linear']['value'],\n+                             param['e_quadratic']['value'],\n+                             width=param['non_fitting_values']['background_width'])\n+            y = data[i, :] - bg\n+            bg_sum = np.sum(bg)\n+\n+        else:\n+            y = data[i, :]\n+        result, res = nnls_fit(y, matv, weights=None)\n+\n+        sst = np.sum((y-np.mean(y))**2)\n+        r2 = 1 - res/sst\n+        result = list(result) + [bg_sum, r2]\n+        out.append(result)\n+    return np.array(out)\n+\n+\n+def fit_pixel_multiprocess_nnls(exp_data, matv, param,\n+                                use_snip=False):\n+    \"\"\"\n+    Multiprocess fit of experiment data.\n+    Parameters\n+    ----------\n+    exp_data : array\n+        3D data of experiment spectrum","path":"skxray/core/fitting/xrf_model.py","position":68,"original_position":68,"commit_id":"d4c31e15ecc9b60b9d03a70bf3c85999b5b797be","original_commit_id":"d4c31e15ecc9b60b9d03a70bf3c85999b5b797be","user":{"login":"ericdill","id":6223243,"avatar_url":"https://avatars.githubusercontent.com/u/6223243?v=3","gravatar_id":"","url":"https://api.github.com/users/ericdill","html_url":"https://github.com/ericdill","followers_url":"https://api.github.com/users/ericdill/followers","following_url":"https://api.github.com/users/ericdill/following{/other_user}","gists_url":"https://api.github.com/users/ericdill/gists{/gist_id}","starred_url":"https://api.github.com/users/ericdill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericdill/subscriptions","organizations_url":"https://api.github.com/users/ericdill/orgs","repos_url":"https://api.github.com/users/ericdill/repos","events_url":"https://api.github.com/users/ericdill/events{/privacy}","received_events_url":"https://api.github.com/users/ericdill/received_events","type":"User","site_admin":false},"body":"What are the dimensions supposed to be?","created_at":"2015-12-17T20:21:07Z","updated_at":"2015-12-17T20:21:07Z","html_url":"https://github.com/scikit-beam/scikit-beam/pull/369#discussion_r47955980","pull_request_url":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/369","_links":{"self":{"href":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/comments/47955980"},"html":{"href":"https://github.com/scikit-beam/scikit-beam/pull/369#discussion_r47955980"},"pull_request":{"href":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/369"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/369","id":53317212,"html_url":"https://github.com/scikit-beam/scikit-beam/pull/369","diff_url":"https://github.com/scikit-beam/scikit-beam/pull/369.diff","patch_url":"https://github.com/scikit-beam/scikit-beam/pull/369.patch","issue_url":"https://api.github.com/repos/scikit-beam/scikit-beam/issues/369","number":369,"state":"open","locked":false,"title":"Pixel fit","user":{"login":"licode","id":4765544,"avatar_url":"https://avatars.githubusercontent.com/u/4765544?v=3","gravatar_id":"","url":"https://api.github.com/users/licode","html_url":"https://github.com/licode","followers_url":"https://api.github.com/users/licode/followers","following_url":"https://api.github.com/users/licode/following{/other_user}","gists_url":"https://api.github.com/users/licode/gists{/gist_id}","starred_url":"https://api.github.com/users/licode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/licode/subscriptions","organizations_url":"https://api.github.com/users/licode/orgs","repos_url":"https://api.github.com/users/licode/repos","events_url":"https://api.github.com/users/licode/events{/privacy}","received_events_url":"https://api.github.com/users/licode/received_events","type":"User","site_admin":false},"body":"multiprocessing for pixel fitting.","created_at":"2015-12-10T21:08:39Z","updated_at":"2015-12-17T20:21:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e7c053388a968dc3c3c6e4fce4e7e27a7b09632","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/369/commits","review_comments_url":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/369/comments","review_comment_url":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scikit-beam/scikit-beam/issues/369/comments","statuses_url":"https://api.github.com/repos/scikit-beam/scikit-beam/statuses/d4c31e15ecc9b60b9d03a70bf3c85999b5b797be","head":{"label":"licode:pixel_fit","ref":"pixel_fit","sha":"d4c31e15ecc9b60b9d03a70bf3c85999b5b797be","user":{"login":"licode","id":4765544,"avatar_url":"https://avatars.githubusercontent.com/u/4765544?v=3","gravatar_id":"","url":"https://api.github.com/users/licode","html_url":"https://github.com/licode","followers_url":"https://api.github.com/users/licode/followers","following_url":"https://api.github.com/users/licode/following{/other_user}","gists_url":"https://api.github.com/users/licode/gists{/gist_id}","starred_url":"https://api.github.com/users/licode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/licode/subscriptions","organizations_url":"https://api.github.com/users/licode/orgs","repos_url":"https://api.github.com/users/licode/repos","events_url":"https://api.github.com/users/licode/events{/privacy}","received_events_url":"https://api.github.com/users/licode/received_events","type":"User","site_admin":false},"repo":{"id":21828441,"name":"scikit-xray","full_name":"licode/scikit-xray","owner":{"login":"licode","id":4765544,"avatar_url":"https://avatars.githubusercontent.com/u/4765544?v=3","gravatar_id":"","url":"https://api.github.com/users/licode","html_url":"https://github.com/licode","followers_url":"https://api.github.com/users/licode/followers","following_url":"https://api.github.com/users/licode/following{/other_user}","gists_url":"https://api.github.com/users/licode/gists{/gist_id}","starred_url":"https://api.github.com/users/licode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/licode/subscriptions","organizations_url":"https://api.github.com/users/licode/orgs","repos_url":"https://api.github.com/users/licode/repos","events_url":"https://api.github.com/users/licode/events{/privacy}","received_events_url":"https://api.github.com/users/licode/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/licode/scikit-xray","description":"Core repository for tools at NSLS-II","fork":true,"url":"https://api.github.com/repos/licode/scikit-xray","forks_url":"https://api.github.com/repos/licode/scikit-xray/forks","keys_url":"https://api.github.com/repos/licode/scikit-xray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/licode/scikit-xray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/licode/scikit-xray/teams","hooks_url":"https://api.github.com/repos/licode/scikit-xray/hooks","issue_events_url":"https://api.github.com/repos/licode/scikit-xray/issues/events{/number}","events_url":"https://api.github.com/repos/licode/scikit-xray/events","assignees_url":"https://api.github.com/repos/licode/scikit-xray/assignees{/user}","branches_url":"https://api.github.com/repos/licode/scikit-xray/branches{/branch}","tags_url":"https://api.github.com/repos/licode/scikit-xray/tags","blobs_url":"https://api.github.com/repos/licode/scikit-xray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/licode/scikit-xray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/licode/scikit-xray/git/refs{/sha}","trees_url":"https://api.github.com/repos/licode/scikit-xray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/licode/scikit-xray/statuses/{sha}","languages_url":"https://api.github.com/repos/licode/scikit-xray/languages","stargazers_url":"https://api.github.com/repos/licode/scikit-xray/stargazers","contributors_url":"https://api.github.com/repos/licode/scikit-xray/contributors","subscribers_url":"https://api.github.com/repos/licode/scikit-xray/subscribers","subscription_url":"https://api.github.com/repos/licode/scikit-xray/subscription","commits_url":"https://api.github.com/repos/licode/scikit-xray/commits{/sha}","git_commits_url":"https://api.github.com/repos/licode/scikit-xray/git/commits{/sha}","comments_url":"https://api.github.com/repos/licode/scikit-xray/comments{/number}","issue_comment_url":"https://api.github.com/repos/licode/scikit-xray/issues/comments{/number}","contents_url":"https://api.github.com/repos/licode/scikit-xray/contents/{+path}","compare_url":"https://api.github.com/repos/licode/scikit-xray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/licode/scikit-xray/merges","archive_url":"https://api.github.com/repos/licode/scikit-xray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/licode/scikit-xray/downloads","issues_url":"https://api.github.com/repos/licode/scikit-xray/issues{/number}","pulls_url":"https://api.github.com/repos/licode/scikit-xray/pulls{/number}","milestones_url":"https://api.github.com/repos/licode/scikit-xray/milestones{/number}","notifications_url":"https://api.github.com/repos/licode/scikit-xray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/licode/scikit-xray/labels{/name}","releases_url":"https://api.github.com/repos/licode/scikit-xray/releases{/id}","created_at":"2014-07-14T17:21:50Z","updated_at":"2015-04-17T18:03:24Z","pushed_at":"2015-12-16T16:44:18Z","git_url":"git://github.com/licode/scikit-xray.git","ssh_url":"git@github.com:licode/scikit-xray.git","clone_url":"https://github.com/licode/scikit-xray.git","svn_url":"https://github.com/licode/scikit-xray","homepage":"","size":2126,"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":"scikit-beam:master","ref":"master","sha":"e5faef2d25a7211d85671b631b65223b89189699","user":{"login":"scikit-beam","id":16195776,"avatar_url":"https://avatars.githubusercontent.com/u/16195776?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-beam","html_url":"https://github.com/scikit-beam","followers_url":"https://api.github.com/users/scikit-beam/followers","following_url":"https://api.github.com/users/scikit-beam/following{/other_user}","gists_url":"https://api.github.com/users/scikit-beam/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-beam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-beam/subscriptions","organizations_url":"https://api.github.com/users/scikit-beam/orgs","repos_url":"https://api.github.com/users/scikit-beam/repos","events_url":"https://api.github.com/users/scikit-beam/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-beam/received_events","type":"Organization","site_admin":false},"repo":{"id":21679569,"name":"scikit-beam","full_name":"scikit-beam/scikit-beam","owner":{"login":"scikit-beam","id":16195776,"avatar_url":"https://avatars.githubusercontent.com/u/16195776?v=3","gravatar_id":"","url":"https://api.github.com/users/scikit-beam","html_url":"https://github.com/scikit-beam","followers_url":"https://api.github.com/users/scikit-beam/followers","following_url":"https://api.github.com/users/scikit-beam/following{/other_user}","gists_url":"https://api.github.com/users/scikit-beam/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-beam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-beam/subscriptions","organizations_url":"https://api.github.com/users/scikit-beam/orgs","repos_url":"https://api.github.com/users/scikit-beam/repos","events_url":"https://api.github.com/users/scikit-beam/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-beam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scikit-beam/scikit-beam","description":"Data analysis tools for Electron, Neutron and X-Ray sciences","fork":false,"url":"https://api.github.com/repos/scikit-beam/scikit-beam","forks_url":"https://api.github.com/repos/scikit-beam/scikit-beam/forks","keys_url":"https://api.github.com/repos/scikit-beam/scikit-beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scikit-beam/scikit-beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scikit-beam/scikit-beam/teams","hooks_url":"https://api.github.com/repos/scikit-beam/scikit-beam/hooks","issue_events_url":"https://api.github.com/repos/scikit-beam/scikit-beam/issues/events{/number}","events_url":"https://api.github.com/repos/scikit-beam/scikit-beam/events","assignees_url":"https://api.github.com/repos/scikit-beam/scikit-beam/assignees{/user}","branches_url":"https://api.github.com/repos/scikit-beam/scikit-beam/branches{/branch}","tags_url":"https://api.github.com/repos/scikit-beam/scikit-beam/tags","blobs_url":"https://api.github.com/repos/scikit-beam/scikit-beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scikit-beam/scikit-beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scikit-beam/scikit-beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/scikit-beam/scikit-beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scikit-beam/scikit-beam/statuses/{sha}","languages_url":"https://api.github.com/repos/scikit-beam/scikit-beam/languages","stargazers_url":"https://api.github.com/repos/scikit-beam/scikit-beam/stargazers","contributors_url":"https://api.github.com/repos/scikit-beam/scikit-beam/contributors","subscribers_url":"https://api.github.com/repos/scikit-beam/scikit-beam/subscribers","subscription_url":"https://api.github.com/repos/scikit-beam/scikit-beam/subscription","commits_url":"https://api.github.com/repos/scikit-beam/scikit-beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/scikit-beam/scikit-beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/scikit-beam/scikit-beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/scikit-beam/scikit-beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/scikit-beam/scikit-beam/contents/{+path}","compare_url":"https://api.github.com/repos/scikit-beam/scikit-beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scikit-beam/scikit-beam/merges","archive_url":"https://api.github.com/repos/scikit-beam/scikit-beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scikit-beam/scikit-beam/downloads","issues_url":"https://api.github.com/repos/scikit-beam/scikit-beam/issues{/number}","pulls_url":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls{/number}","milestones_url":"https://api.github.com/repos/scikit-beam/scikit-beam/milestones{/number}","notifications_url":"https://api.github.com/repos/scikit-beam/scikit-beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scikit-beam/scikit-beam/labels{/name}","releases_url":"https://api.github.com/repos/scikit-beam/scikit-beam/releases{/id}","created_at":"2014-07-10T04:44:35Z","updated_at":"2015-12-09T22:22:42Z","pushed_at":"2015-12-16T16:44:18Z","git_url":"git://github.com/scikit-beam/scikit-beam.git","ssh_url":"git@github.com:scikit-beam/scikit-beam.git","clone_url":"https://github.com/scikit-beam/scikit-beam.git","svn_url":"https://github.com/scikit-beam/scikit-beam","homepage":"","size":51849,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":37,"mirror_url":null,"open_issues_count":60,"forks":37,"open_issues":60,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/369"},"html":{"href":"https://github.com/scikit-beam/scikit-beam/pull/369"},"issue":{"href":"https://api.github.com/repos/scikit-beam/scikit-beam/issues/369"},"comments":{"href":"https://api.github.com/repos/scikit-beam/scikit-beam/issues/369/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/369/comments"},"review_comment":{"href":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scikit-beam/scikit-beam/pulls/369/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-beam/scikit-beam/statuses/d4c31e15ecc9b60b9d03a70bf3c85999b5b797be"}}}}