{"action":"created","comment":{"url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/comments/91089028","pull_request_review_id":11598719,"id":91089028,"diff_hunk":"@@ -27,8 +27,10 @@\n import scipy\n import scipy.odr as odr\n from scipy.optimize import (leastsq, least_squares,\n-                            minimize, differential_evolution)\n+                            minimize, differential_evolution, nnls)\n from scipy.linalg import svd\n+from numpy.linalg import lstsq as linear","path":"hyperspy/model.py","position":7,"original_position":7,"commit_id":"09c19481636744d0b74a728dbe8f61b88e02bfb3","original_commit_id":"09c19481636744d0b74a728dbe8f61b88e02bfb3","user":{"login":"tjof2","id":6626247,"avatar_url":"https://avatars.githubusercontent.com/u/6626247?v=3","gravatar_id":"","url":"https://api.github.com/users/tjof2","html_url":"https://github.com/tjof2","followers_url":"https://api.github.com/users/tjof2/followers","following_url":"https://api.github.com/users/tjof2/following{/other_user}","gists_url":"https://api.github.com/users/tjof2/gists{/gist_id}","starred_url":"https://api.github.com/users/tjof2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tjof2/subscriptions","organizations_url":"https://api.github.com/users/tjof2/orgs","repos_url":"https://api.github.com/users/tjof2/repos","events_url":"https://api.github.com/users/tjof2/events{/privacy}","received_events_url":"https://api.github.com/users/tjof2/received_events","type":"User","site_admin":false},"body":"```\r\nls_b = self.free_parameters_boundaries\r\nls_b = ([a if a is not None else -np.inf for a, b in ls_b],\r\n      [b if b is not None else np.inf for a, b in ls_b])\r\n```\r\nand then `bounds = ls_b` as your argument, I think?","created_at":"2016-12-06T14:35:21Z","updated_at":"2016-12-06T14:35:21Z","html_url":"https://github.com/hyperspy/hyperspy/pull/1321#discussion_r91089028","pull_request_url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/1321","_links":{"self":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/comments/91089028"},"html":{"href":"https://github.com/hyperspy/hyperspy/pull/1321#discussion_r91089028"},"pull_request":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/1321"}}},"pull_request":{"url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/1321","id":92361681,"html_url":"https://github.com/hyperspy/hyperspy/pull/1321","diff_url":"https://github.com/hyperspy/hyperspy/pull/1321.diff","patch_url":"https://github.com/hyperspy/hyperspy/pull/1321.patch","issue_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/1321","number":1321,"state":"open","locked":false,"title":"NEW: Linear fitting","user":{"login":"thomasaarholt","id":2721423,"avatar_url":"https://avatars.githubusercontent.com/u/2721423?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasaarholt","html_url":"https://github.com/thomasaarholt","followers_url":"https://api.github.com/users/thomasaarholt/followers","following_url":"https://api.github.com/users/thomasaarholt/following{/other_user}","gists_url":"https://api.github.com/users/thomasaarholt/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasaarholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasaarholt/subscriptions","organizations_url":"https://api.github.com/users/thomasaarholt/orgs","repos_url":"https://api.github.com/users/thomasaarholt/repos","events_url":"https://api.github.com/users/thomasaarholt/events{/privacy}","received_events_url":"https://api.github.com/users/thomasaarholt/received_events","type":"User","site_admin":false},"body":"I've added support for both linear and non-negative linear fitting of components.\r\nExample notebook here: https://nbviewer.jupyter.org/urls/dl.dropbox.com/s/t091ahzuduzrct6/Linear%20Fitting.ipynb\r\n\r\nThe fit from the normal non-linear `leastsq` is a little bit different, and in the notebook case the nonlinear one seems better. There was some discussion online about the tails of the gaussian making the fit unstable, and it being better to fit around the central part of the gaussians. Not sure how to go about doing that.\r\nThere's also a chance that there are better ways of doing this.\r\n\r\nI'd like to get this working, and then talk about ways of having hyperspy be a bit smarter about which fit is chosen by default.\r\n\r\nTo Do:\r\n\r\n- [ ] Create a system for checking if components are linear\r\n- [ ] Optimise function\r\n- [ ] Tests","created_at":"2016-11-04T15:31:41Z","updated_at":"2016-12-06T14:35:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"609fbc87194b367495f1e44ac6bd289f4bd4ac00","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/1321/commits","review_comments_url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/1321/comments","review_comment_url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/1321/comments","statuses_url":"https://api.github.com/repos/hyperspy/hyperspy/statuses/09c19481636744d0b74a728dbe8f61b88e02bfb3","head":{"label":"thomasaarholt:NEW_linear_fitting","ref":"NEW_linear_fitting","sha":"09c19481636744d0b74a728dbe8f61b88e02bfb3","user":{"login":"thomasaarholt","id":2721423,"avatar_url":"https://avatars.githubusercontent.com/u/2721423?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasaarholt","html_url":"https://github.com/thomasaarholt","followers_url":"https://api.github.com/users/thomasaarholt/followers","following_url":"https://api.github.com/users/thomasaarholt/following{/other_user}","gists_url":"https://api.github.com/users/thomasaarholt/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasaarholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasaarholt/subscriptions","organizations_url":"https://api.github.com/users/thomasaarholt/orgs","repos_url":"https://api.github.com/users/thomasaarholt/repos","events_url":"https://api.github.com/users/thomasaarholt/events{/privacy}","received_events_url":"https://api.github.com/users/thomasaarholt/received_events","type":"User","site_admin":false},"repo":{"id":48047774,"name":"hyperspy","full_name":"thomasaarholt/hyperspy","owner":{"login":"thomasaarholt","id":2721423,"avatar_url":"https://avatars.githubusercontent.com/u/2721423?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasaarholt","html_url":"https://github.com/thomasaarholt","followers_url":"https://api.github.com/users/thomasaarholt/followers","following_url":"https://api.github.com/users/thomasaarholt/following{/other_user}","gists_url":"https://api.github.com/users/thomasaarholt/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasaarholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasaarholt/subscriptions","organizations_url":"https://api.github.com/users/thomasaarholt/orgs","repos_url":"https://api.github.com/users/thomasaarholt/repos","events_url":"https://api.github.com/users/thomasaarholt/events{/privacy}","received_events_url":"https://api.github.com/users/thomasaarholt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thomasaarholt/hyperspy","description":"Multidimensional data analysis","fork":true,"url":"https://api.github.com/repos/thomasaarholt/hyperspy","forks_url":"https://api.github.com/repos/thomasaarholt/hyperspy/forks","keys_url":"https://api.github.com/repos/thomasaarholt/hyperspy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thomasaarholt/hyperspy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thomasaarholt/hyperspy/teams","hooks_url":"https://api.github.com/repos/thomasaarholt/hyperspy/hooks","issue_events_url":"https://api.github.com/repos/thomasaarholt/hyperspy/issues/events{/number}","events_url":"https://api.github.com/repos/thomasaarholt/hyperspy/events","assignees_url":"https://api.github.com/repos/thomasaarholt/hyperspy/assignees{/user}","branches_url":"https://api.github.com/repos/thomasaarholt/hyperspy/branches{/branch}","tags_url":"https://api.github.com/repos/thomasaarholt/hyperspy/tags","blobs_url":"https://api.github.com/repos/thomasaarholt/hyperspy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thomasaarholt/hyperspy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thomasaarholt/hyperspy/git/refs{/sha}","trees_url":"https://api.github.com/repos/thomasaarholt/hyperspy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thomasaarholt/hyperspy/statuses/{sha}","languages_url":"https://api.github.com/repos/thomasaarholt/hyperspy/languages","stargazers_url":"https://api.github.com/repos/thomasaarholt/hyperspy/stargazers","contributors_url":"https://api.github.com/repos/thomasaarholt/hyperspy/contributors","subscribers_url":"https://api.github.com/repos/thomasaarholt/hyperspy/subscribers","subscription_url":"https://api.github.com/repos/thomasaarholt/hyperspy/subscription","commits_url":"https://api.github.com/repos/thomasaarholt/hyperspy/commits{/sha}","git_commits_url":"https://api.github.com/repos/thomasaarholt/hyperspy/git/commits{/sha}","comments_url":"https://api.github.com/repos/thomasaarholt/hyperspy/comments{/number}","issue_comment_url":"https://api.github.com/repos/thomasaarholt/hyperspy/issues/comments{/number}","contents_url":"https://api.github.com/repos/thomasaarholt/hyperspy/contents/{+path}","compare_url":"https://api.github.com/repos/thomasaarholt/hyperspy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thomasaarholt/hyperspy/merges","archive_url":"https://api.github.com/repos/thomasaarholt/hyperspy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thomasaarholt/hyperspy/downloads","issues_url":"https://api.github.com/repos/thomasaarholt/hyperspy/issues{/number}","pulls_url":"https://api.github.com/repos/thomasaarholt/hyperspy/pulls{/number}","milestones_url":"https://api.github.com/repos/thomasaarholt/hyperspy/milestones{/number}","notifications_url":"https://api.github.com/repos/thomasaarholt/hyperspy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thomasaarholt/hyperspy/labels{/name}","releases_url":"https://api.github.com/repos/thomasaarholt/hyperspy/releases{/id}","deployments_url":"https://api.github.com/repos/thomasaarholt/hyperspy/deployments","created_at":"2015-12-15T14:25:59Z","updated_at":"2016-04-28T14:53:06Z","pushed_at":"2016-11-30T15:59:53Z","git_url":"git://github.com/thomasaarholt/hyperspy.git","ssh_url":"git@github.com:thomasaarholt/hyperspy.git","clone_url":"https://github.com/thomasaarholt/hyperspy.git","svn_url":"https://github.com/thomasaarholt/hyperspy","homepage":"http://www.hyperspy.org","size":87447,"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":"hyperspy:RELEASE_next_minor","ref":"RELEASE_next_minor","sha":"e130e34f347f236bfaf136add8a1629768468a4c","user":{"login":"hyperspy","id":989756,"avatar_url":"https://avatars.githubusercontent.com/u/989756?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperspy","html_url":"https://github.com/hyperspy","followers_url":"https://api.github.com/users/hyperspy/followers","following_url":"https://api.github.com/users/hyperspy/following{/other_user}","gists_url":"https://api.github.com/users/hyperspy/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperspy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperspy/subscriptions","organizations_url":"https://api.github.com/users/hyperspy/orgs","repos_url":"https://api.github.com/users/hyperspy/repos","events_url":"https://api.github.com/users/hyperspy/events{/privacy}","received_events_url":"https://api.github.com/users/hyperspy/received_events","type":"Organization","site_admin":false},"repo":{"id":2233998,"name":"hyperspy","full_name":"hyperspy/hyperspy","owner":{"login":"hyperspy","id":989756,"avatar_url":"https://avatars.githubusercontent.com/u/989756?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperspy","html_url":"https://github.com/hyperspy","followers_url":"https://api.github.com/users/hyperspy/followers","following_url":"https://api.github.com/users/hyperspy/following{/other_user}","gists_url":"https://api.github.com/users/hyperspy/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperspy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperspy/subscriptions","organizations_url":"https://api.github.com/users/hyperspy/orgs","repos_url":"https://api.github.com/users/hyperspy/repos","events_url":"https://api.github.com/users/hyperspy/events{/privacy}","received_events_url":"https://api.github.com/users/hyperspy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperspy/hyperspy","description":"Multidimensional data analysis","fork":false,"url":"https://api.github.com/repos/hyperspy/hyperspy","forks_url":"https://api.github.com/repos/hyperspy/hyperspy/forks","keys_url":"https://api.github.com/repos/hyperspy/hyperspy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperspy/hyperspy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperspy/hyperspy/teams","hooks_url":"https://api.github.com/repos/hyperspy/hyperspy/hooks","issue_events_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/events{/number}","events_url":"https://api.github.com/repos/hyperspy/hyperspy/events","assignees_url":"https://api.github.com/repos/hyperspy/hyperspy/assignees{/user}","branches_url":"https://api.github.com/repos/hyperspy/hyperspy/branches{/branch}","tags_url":"https://api.github.com/repos/hyperspy/hyperspy/tags","blobs_url":"https://api.github.com/repos/hyperspy/hyperspy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperspy/hyperspy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperspy/hyperspy/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperspy/hyperspy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperspy/hyperspy/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperspy/hyperspy/languages","stargazers_url":"https://api.github.com/repos/hyperspy/hyperspy/stargazers","contributors_url":"https://api.github.com/repos/hyperspy/hyperspy/contributors","subscribers_url":"https://api.github.com/repos/hyperspy/hyperspy/subscribers","subscription_url":"https://api.github.com/repos/hyperspy/hyperspy/subscription","commits_url":"https://api.github.com/repos/hyperspy/hyperspy/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperspy/hyperspy/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperspy/hyperspy/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperspy/hyperspy/contents/{+path}","compare_url":"https://api.github.com/repos/hyperspy/hyperspy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperspy/hyperspy/merges","archive_url":"https://api.github.com/repos/hyperspy/hyperspy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperspy/hyperspy/downloads","issues_url":"https://api.github.com/repos/hyperspy/hyperspy/issues{/number}","pulls_url":"https://api.github.com/repos/hyperspy/hyperspy/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperspy/hyperspy/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperspy/hyperspy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperspy/hyperspy/labels{/name}","releases_url":"https://api.github.com/repos/hyperspy/hyperspy/releases{/id}","deployments_url":"https://api.github.com/repos/hyperspy/hyperspy/deployments","created_at":"2011-08-19T13:14:36Z","updated_at":"2016-10-30T15:39:41Z","pushed_at":"2016-12-06T09:38:27Z","git_url":"git://github.com/hyperspy/hyperspy.git","ssh_url":"git@github.com:hyperspy/hyperspy.git","clone_url":"https://github.com/hyperspy/hyperspy.git","svn_url":"https://github.com/hyperspy/hyperspy","homepage":"http://www.hyperspy.org","size":110221,"stargazers_count":78,"watchers_count":78,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":51,"mirror_url":null,"open_issues_count":169,"forks":51,"open_issues":169,"watchers":78,"default_branch":"RELEASE_next_minor"}},"_links":{"self":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/1321"},"html":{"href":"https://github.com/hyperspy/hyperspy/pull/1321"},"issue":{"href":"https://api.github.com/repos/hyperspy/hyperspy/issues/1321"},"comments":{"href":"https://api.github.com/repos/hyperspy/hyperspy/issues/1321/comments"},"review_comments":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/1321/comments"},"review_comment":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/1321/commits"},"statuses":{"href":"https://api.github.com/repos/hyperspy/hyperspy/statuses/09c19481636744d0b74a728dbe8f61b88e02bfb3"}}}}
{"actor":{"display_login":"tjof2"}}