{"action":"created","issue":{"url":"https://api.github.com/repos/hyperspy/hyperspy/issues/490","labels_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/490/labels{/name}","comments_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/490/comments","events_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/490/events","html_url":"https://github.com/hyperspy/hyperspy/pull/490","id":65089339,"number":490,"title":"New: set EELSCLEdge onset","user":{"login":"magnunor","id":1690979,"avatar_url":"https://avatars.githubusercontent.com/u/1690979?v=3","gravatar_id":"","url":"https://api.github.com/users/magnunor","html_url":"https://github.com/magnunor","followers_url":"https://api.github.com/users/magnunor/followers","following_url":"https://api.github.com/users/magnunor/following{/other_user}","gists_url":"https://api.github.com/users/magnunor/gists{/gist_id}","starred_url":"https://api.github.com/users/magnunor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magnunor/subscriptions","organizations_url":"https://api.github.com/users/magnunor/orgs","repos_url":"https://api.github.com/users/magnunor/repos","events_url":"https://api.github.com/users/magnunor/events{/privacy}","received_events_url":"https://api.github.com/users/magnunor/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hyperspy/hyperspy/labels/needs%20review","name":"needs review","color":"006b75"},{"url":"https://api.github.com/repos/hyperspy/hyperspy/labels/New","name":"New","color":"f7c6c7"}],"state":"open","locked":false,"assignee":{"login":"magnunor","id":1690979,"avatar_url":"https://avatars.githubusercontent.com/u/1690979?v=3","gravatar_id":"","url":"https://api.github.com/users/magnunor","html_url":"https://github.com/magnunor","followers_url":"https://api.github.com/users/magnunor/followers","following_url":"https://api.github.com/users/magnunor/following{/other_user}","gists_url":"https://api.github.com/users/magnunor/gists{/gist_id}","starred_url":"https://api.github.com/users/magnunor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magnunor/subscriptions","organizations_url":"https://api.github.com/users/magnunor/orgs","repos_url":"https://api.github.com/users/magnunor/repos","events_url":"https://api.github.com/users/magnunor/events{/privacy}","received_events_url":"https://api.github.com/users/magnunor/received_events","type":"User","site_admin":false},"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":52,"closed_issues":20,"state":"open","created_at":"2014-11-06T15:54:23Z","updated_at":"2015-12-03T16:13:17Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-03-29T19:51:09Z","updated_at":"2015-12-03T18:39:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hyperspy/hyperspy/pulls/490","html_url":"https://github.com/hyperspy/hyperspy/pull/490","diff_url":"https://github.com/hyperspy/hyperspy/pull/490.diff","patch_url":"https://github.com/hyperspy/hyperspy/pull/490.patch"},"body":"As discussed in https://github.com/hyperspy/hyperspy/issues/487 there should be some better way to set the onset of EELSCLEdges.\r\n\r\nThis implementation uses the routine described in https://github.com/hyperspy/hyperspy/issues/487 and seems to work nicely for the L-edges for the transition metals like Mn, Fe and Ti.\r\n\r\nRoutine for fitting a Manganese L23-edge, see the image below for the different energy ranges:\r\n\r\n![set_edge_onset](https://cloud.githubusercontent.com/assets/1690979/6887321/e7ff4b28-d65b-11e4-998a-3785bf630565.png)\r\n\r\n```python\r\ns = load(\"some_spectrum.hdf5\")\r\ns.add_elements(['Mn',])\r\ns.set_microscope_parameters(convergence_angle=24., collection_angle=26.)\r\nll = load(\"lowloss.hdf5\")\r\nm = create_model(s, ll=ll)\r\nm.set_coreloss_edge_onset(Mn_L3) # (1) Just before the L3 onset and a little past the peak \r\nm.set_coreloss_edge_onset(Mn_L2) # (2) Just before the L2 onset and a little past the peak\r\nm.set_signal_range() # (3) About 30 eV before the onset to just in front of the onset\r\nm.add_signal_range() # (4) About 3 eV right after the L2, at the lowest point\r\nm.multifit()\r\nm.reset_signal_range\r\n```\r\n\r\nResult: ![set_edge_onset_result](https://cloud.githubusercontent.com/assets/1690979/6887366/63c3618a-d65d-11e4-9656-9601a5ce2a5d.png)\r\n\r\nI can probably automate this even more, is I've done here: https://gist.github.com/magnunor/47c8a8b3b69f4370229e . But I think having a separate function like the one in this PR would be useful.\r\n\r\nWhen using only_current=False with the interactive mode, the process is very slow due to the plot windows updating for every change in position. Is there some way to suppress this?\r\n\r\nTodo:\r\n- [x] documentation\r\n- [x] tests"},"comment":{"url":"https://api.github.com/repos/hyperspy/hyperspy/issues/comments/161742431","html_url":"https://github.com/hyperspy/hyperspy/pull/490#issuecomment-161742431","issue_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/490","id":161742431,"user":{"login":"magnunor","id":1690979,"avatar_url":"https://avatars.githubusercontent.com/u/1690979?v=3","gravatar_id":"","url":"https://api.github.com/users/magnunor","html_url":"https://github.com/magnunor","followers_url":"https://api.github.com/users/magnunor/followers","following_url":"https://api.github.com/users/magnunor/following{/other_user}","gists_url":"https://api.github.com/users/magnunor/gists{/gist_id}","starred_url":"https://api.github.com/users/magnunor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magnunor/subscriptions","organizations_url":"https://api.github.com/users/magnunor/orgs","repos_url":"https://api.github.com/users/magnunor/repos","events_url":"https://api.github.com/users/magnunor/events{/privacy}","received_events_url":"https://api.github.com/users/magnunor/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T18:39:19Z","updated_at":"2015-12-03T18:39:19Z","body":"I merged the current master into the branch, and everything seems to be working nicely.\r\n\r\nShould be ready for review."}}