{"action":"created","comment":{"url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/comments/48043512","id":48043512,"diff_hunk":"@@ -243,6 +275,74 @@ def take_off_angle(tilt_stage,\n                                   + math.sin(a) * math.sin(c)))\n \n \n+def xray_lines_model(elements,\n+                     beam_energy=200,\n+                     weight_percents=None,\n+                     energy_resolution_MnKa=130,\n+                     energy_axis={'name': 'E', 'scale': 0.01, 'units': 'keV',\n+                                  'offset': -0.1, 'size': 1024}\n+                     ):\n+    \"\"\"\n+    Generate a model of X-ray lines using a Gaussian distribution for each peak.\n+\n+    The area under a main peak (alpha) is equal to 1 and weighted by the\n+    composition.\n+\n+    Parameters\n+    ----------\n+    elements : list of strings\n+        A list of chemical element symbols.\n+    beam_energy: float\n+        The energy of the beam in keV.\n+    weight_percents: list of float\n+        The composition in weight percent.\n+    energy_resolution_MnKa: float\n+        The energy resolution of the detector in eV\n+    energy_axis: dic\n+        The dictionary for the energy axis. It must contains 'size' and the\n+        units must be 'eV' of 'keV'.\n+\n+    Example\n+    -------\n+    >>> s = utils_eds.simulate_model(['Cu', 'Fe'], beam_energy=30)\n+    >>> s.plot()\n+    \"\"\"\n+    from hyperspy._signals.eds_tem import EDSTEMSpectrum\n+    from hyperspy.model import components\n+    s = EDSTEMSpectrum(np.zeros(energy_axis['size']), axes=[energy_axis])\n+    s.set_microscope_parameters(\n+        beam_energy=beam_energy,\n+        energy_resolution_MnKa=energy_resolution_MnKa)\n+    s.add_elements(elements)\n+    counts_rate = 1.\n+    live_time = 1.","path":"hyperspy/misc/eds/utils.py","position":167,"original_position":166,"commit_id":"4b91966c709239de3c3e3b177e88aebd71c975c5","original_commit_id":"c29ba200d35248c4b89a36dceb6d817587f76da0","user":{"login":"vidartf","id":510760,"avatar_url":"https://avatars.githubusercontent.com/u/510760?v=3","gravatar_id":"","url":"https://api.github.com/users/vidartf","html_url":"https://github.com/vidartf","followers_url":"https://api.github.com/users/vidartf/followers","following_url":"https://api.github.com/users/vidartf/following{/other_user}","gists_url":"https://api.github.com/users/vidartf/gists{/gist_id}","starred_url":"https://api.github.com/users/vidartf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vidartf/subscriptions","organizations_url":"https://api.github.com/users/vidartf/orgs","repos_url":"https://api.github.com/users/vidartf/repos","events_url":"https://api.github.com/users/vidartf/events{/privacy}","received_events_url":"https://api.github.com/users/vidartf/received_events","type":"User","site_admin":false},"body":"I'm not sure what `counts_rate` is supposed to be. Maybe `mp.Detector.EDS.real_time` ?","created_at":"2015-12-18T16:38:38Z","updated_at":"2015-12-18T16:38:38Z","html_url":"https://github.com/hyperspy/hyperspy/pull/786#discussion_r48043512","pull_request_url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/786","_links":{"self":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/comments/48043512"},"html":{"href":"https://github.com/hyperspy/hyperspy/pull/786#discussion_r48043512"},"pull_request":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/786"}}},"pull_request":{"url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/786","id":53166966,"html_url":"https://github.com/hyperspy/hyperspy/pull/786","diff_url":"https://github.com/hyperspy/hyperspy/pull/786.diff","patch_url":"https://github.com/hyperspy/hyperspy/pull/786.patch","issue_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/786","number":786,"state":"open","locked":false,"title":"NEW: EDSModel","user":{"login":"dnjohnstone","id":10629656,"avatar_url":"https://avatars.githubusercontent.com/u/10629656?v=3","gravatar_id":"","url":"https://api.github.com/users/dnjohnstone","html_url":"https://github.com/dnjohnstone","followers_url":"https://api.github.com/users/dnjohnstone/followers","following_url":"https://api.github.com/users/dnjohnstone/following{/other_user}","gists_url":"https://api.github.com/users/dnjohnstone/gists{/gist_id}","starred_url":"https://api.github.com/users/dnjohnstone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnjohnstone/subscriptions","organizations_url":"https://api.github.com/users/dnjohnstone/orgs","repos_url":"https://api.github.com/users/dnjohnstone/repos","events_url":"https://api.github.com/users/dnjohnstone/events{/privacy}","received_events_url":"https://api.github.com/users/dnjohnstone/received_events","type":"User","site_admin":false},"body":"Deprecates #473 and is written to be implemented after #536  so although it looks ridiculously big it won't be very big at all when someone gets round to reviewing #536.\r\n\r\nOtherwise I think this should be ready for review.","created_at":"2015-12-09T19:36:53Z","updated_at":"2015-12-18T16:38:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b6dee276655d6288f8e251ddca377f0b8572685","assignee":null,"milestone":{"url":"https://api.github.com/repos/hyperspy/hyperspy/milestones/8","html_url":"https://github.com/hyperspy/hyperspy/milestones/0.9","labels_url":"https://api.github.com/repos/hyperspy/hyperspy/milestones/8/labels","id":856137,"number":8,"title":"0.9","description":"","creator":{"login":"francisco-dlp","id":989719,"avatar_url":"https://avatars.githubusercontent.com/u/989719?v=3","gravatar_id":"","url":"https://api.github.com/users/francisco-dlp","html_url":"https://github.com/francisco-dlp","followers_url":"https://api.github.com/users/francisco-dlp/followers","following_url":"https://api.github.com/users/francisco-dlp/following{/other_user}","gists_url":"https://api.github.com/users/francisco-dlp/gists{/gist_id}","starred_url":"https://api.github.com/users/francisco-dlp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francisco-dlp/subscriptions","organizations_url":"https://api.github.com/users/francisco-dlp/orgs","repos_url":"https://api.github.com/users/francisco-dlp/repos","events_url":"https://api.github.com/users/francisco-dlp/events{/privacy}","received_events_url":"https://api.github.com/users/francisco-dlp/received_events","type":"User","site_admin":false},"open_issues":56,"closed_issues":28,"state":"open","created_at":"2014-11-06T15:54:23Z","updated_at":"2015-12-18T12:18:59Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/786/commits","review_comments_url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/786/comments","review_comment_url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/786/comments","statuses_url":"https://api.github.com/repos/hyperspy/hyperspy/statuses/4b91966c709239de3c3e3b177e88aebd71c975c5","head":{"label":"dnjohnstone:NEW_eds_model","ref":"NEW_eds_model","sha":"4b91966c709239de3c3e3b177e88aebd71c975c5","user":{"login":"dnjohnstone","id":10629656,"avatar_url":"https://avatars.githubusercontent.com/u/10629656?v=3","gravatar_id":"","url":"https://api.github.com/users/dnjohnstone","html_url":"https://github.com/dnjohnstone","followers_url":"https://api.github.com/users/dnjohnstone/followers","following_url":"https://api.github.com/users/dnjohnstone/following{/other_user}","gists_url":"https://api.github.com/users/dnjohnstone/gists{/gist_id}","starred_url":"https://api.github.com/users/dnjohnstone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnjohnstone/subscriptions","organizations_url":"https://api.github.com/users/dnjohnstone/orgs","repos_url":"https://api.github.com/users/dnjohnstone/repos","events_url":"https://api.github.com/users/dnjohnstone/events{/privacy}","received_events_url":"https://api.github.com/users/dnjohnstone/received_events","type":"User","site_admin":false},"repo":{"id":29680132,"name":"hyperspy","full_name":"dnjohnstone/hyperspy","owner":{"login":"dnjohnstone","id":10629656,"avatar_url":"https://avatars.githubusercontent.com/u/10629656?v=3","gravatar_id":"","url":"https://api.github.com/users/dnjohnstone","html_url":"https://github.com/dnjohnstone","followers_url":"https://api.github.com/users/dnjohnstone/followers","following_url":"https://api.github.com/users/dnjohnstone/following{/other_user}","gists_url":"https://api.github.com/users/dnjohnstone/gists{/gist_id}","starred_url":"https://api.github.com/users/dnjohnstone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnjohnstone/subscriptions","organizations_url":"https://api.github.com/users/dnjohnstone/orgs","repos_url":"https://api.github.com/users/dnjohnstone/repos","events_url":"https://api.github.com/users/dnjohnstone/events{/privacy}","received_events_url":"https://api.github.com/users/dnjohnstone/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dnjohnstone/hyperspy","description":"Multidimensional data analysis","fork":true,"url":"https://api.github.com/repos/dnjohnstone/hyperspy","forks_url":"https://api.github.com/repos/dnjohnstone/hyperspy/forks","keys_url":"https://api.github.com/repos/dnjohnstone/hyperspy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dnjohnstone/hyperspy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dnjohnstone/hyperspy/teams","hooks_url":"https://api.github.com/repos/dnjohnstone/hyperspy/hooks","issue_events_url":"https://api.github.com/repos/dnjohnstone/hyperspy/issues/events{/number}","events_url":"https://api.github.com/repos/dnjohnstone/hyperspy/events","assignees_url":"https://api.github.com/repos/dnjohnstone/hyperspy/assignees{/user}","branches_url":"https://api.github.com/repos/dnjohnstone/hyperspy/branches{/branch}","tags_url":"https://api.github.com/repos/dnjohnstone/hyperspy/tags","blobs_url":"https://api.github.com/repos/dnjohnstone/hyperspy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dnjohnstone/hyperspy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dnjohnstone/hyperspy/git/refs{/sha}","trees_url":"https://api.github.com/repos/dnjohnstone/hyperspy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dnjohnstone/hyperspy/statuses/{sha}","languages_url":"https://api.github.com/repos/dnjohnstone/hyperspy/languages","stargazers_url":"https://api.github.com/repos/dnjohnstone/hyperspy/stargazers","contributors_url":"https://api.github.com/repos/dnjohnstone/hyperspy/contributors","subscribers_url":"https://api.github.com/repos/dnjohnstone/hyperspy/subscribers","subscription_url":"https://api.github.com/repos/dnjohnstone/hyperspy/subscription","commits_url":"https://api.github.com/repos/dnjohnstone/hyperspy/commits{/sha}","git_commits_url":"https://api.github.com/repos/dnjohnstone/hyperspy/git/commits{/sha}","comments_url":"https://api.github.com/repos/dnjohnstone/hyperspy/comments{/number}","issue_comment_url":"https://api.github.com/repos/dnjohnstone/hyperspy/issues/comments{/number}","contents_url":"https://api.github.com/repos/dnjohnstone/hyperspy/contents/{+path}","compare_url":"https://api.github.com/repos/dnjohnstone/hyperspy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dnjohnstone/hyperspy/merges","archive_url":"https://api.github.com/repos/dnjohnstone/hyperspy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dnjohnstone/hyperspy/downloads","issues_url":"https://api.github.com/repos/dnjohnstone/hyperspy/issues{/number}","pulls_url":"https://api.github.com/repos/dnjohnstone/hyperspy/pulls{/number}","milestones_url":"https://api.github.com/repos/dnjohnstone/hyperspy/milestones{/number}","notifications_url":"https://api.github.com/repos/dnjohnstone/hyperspy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dnjohnstone/hyperspy/labels{/name}","releases_url":"https://api.github.com/repos/dnjohnstone/hyperspy/releases{/id}","created_at":"2015-01-22T13:34:00Z","updated_at":"2015-05-06T09:06:39Z","pushed_at":"2015-12-18T16:30:43Z","git_url":"git://github.com/dnjohnstone/hyperspy.git","ssh_url":"git@github.com:dnjohnstone/hyperspy.git","clone_url":"https://github.com/dnjohnstone/hyperspy.git","svn_url":"https://github.com/dnjohnstone/hyperspy","homepage":"http://www.hyperspy.org","size":71747,"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:master","ref":"master","sha":"b511be9691489123280d193f7ee0307188cf07d7","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}","created_at":"2011-08-19T13:14:36Z","updated_at":"2015-12-15T14:25:54Z","pushed_at":"2015-12-18T16:37:13Z","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":75790,"stargazers_count":51,"watchers_count":51,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":139,"forks":37,"open_issues":139,"watchers":51,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/786"},"html":{"href":"https://github.com/hyperspy/hyperspy/pull/786"},"issue":{"href":"https://api.github.com/repos/hyperspy/hyperspy/issues/786"},"comments":{"href":"https://api.github.com/repos/hyperspy/hyperspy/issues/786/comments"},"review_comments":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/786/comments"},"review_comment":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hyperspy/hyperspy/pulls/786/commits"},"statuses":{"href":"https://api.github.com/repos/hyperspy/hyperspy/statuses/4b91966c709239de3c3e3b177e88aebd71c975c5"}}}}