{"action":"created","issue":{"url":"https://api.github.com/repos/sardana-org/sardana/issues/880","repository_url":"https://api.github.com/repos/sardana-org/sardana","labels_url":"https://api.github.com/repos/sardana-org/sardana/issues/880/labels{/name}","comments_url":"https://api.github.com/repos/sardana-org/sardana/issues/880/comments","events_url":"https://api.github.com/repos/sardana-org/sardana/issues/880/events","html_url":"https://github.com/sardana-org/sardana/pull/880","id":344624876,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzOTc3MTU0","number":880,"title":"[WIP] implement scanstats macro","user":{"login":"dschick","id":13797420,"node_id":"MDQ6VXNlcjEzNzk3NDIw","avatar_url":"https://avatars1.githubusercontent.com/u/13797420?v=4","gravatar_id":"","url":"https://api.github.com/users/dschick","html_url":"https://github.com/dschick","followers_url":"https://api.github.com/users/dschick/followers","following_url":"https://api.github.com/users/dschick/following{/other_user}","gists_url":"https://api.github.com/users/dschick/gists{/gist_id}","starred_url":"https://api.github.com/users/dschick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dschick/subscriptions","organizations_url":"https://api.github.com/users/dschick/orgs","repos_url":"https://api.github.com/users/dschick/repos","events_url":"https://api.github.com/users/dschick/events{/privacy}","received_events_url":"https://api.github.com/users/dschick/received_events","type":"User","site_admin":false},"labels":[{"id":483643669,"node_id":"MDU6TGFiZWw0ODM2NDM2Njk=","url":"https://api.github.com/repos/sardana-org/sardana/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-07-25T22:07:51Z","updated_at":"2018-08-02T14:20:05Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/sardana-org/sardana/pulls/880","html_url":"https://github.com/sardana-org/sardana/pull/880","diff_url":"https://github.com/sardana-org/sardana/pull/880.diff","patch_url":"https://github.com/sardana-org/sardana/pull/880.patch"},"body":"this is an inital implementation for calculating statistics of a scan.\r\nThe macro `scanstats` has to be hooked to the post-scan hook place.\r\nThe macro then has access to its parent data, movable and the counters from the measurement group.\r\nRight now it simply mimics SPEC's behaviour of calculating simple statistics only for the first plotted counter - this can be easily expanded to all counters, see also discussion in #290 .\r\n\r\nPlease review this PR especially for the way I access the counters and motors. I guess this can be done more elegant , e.g. with the new measurement group API?\r\n\r\nI decided to memorize the results of the calculation in the env for now. I also save the motor for which the stats were calculated, but I guess the last used motor might be also accessible in another way from within another macro?\r\n\r\nOne pretty nice thing which SPEC is able to, is to calculate the `CEN `from a peak or an edge automagically. Does anybody knows how this works?\r\n\r\nWith the `motor`, `PEAK`, and `CEN `in the environment, one can know write further macros like `pic `and `cen `which actually just move the last scanned motor to the `PEAK `or `CEN `value of the counter.\r\nIdeally the `pic `and `cen `macros would be able to draw a line into the Trend window, at the position where they moved the motor to.\r\nIf the last option is possible, one could add even a `where `macro which just plots the current position of the last scanned motor into the Trend plot."},"comment":{"url":"https://api.github.com/repos/sardana-org/sardana/issues/comments/409943219","html_url":"https://github.com/sardana-org/sardana/pull/880#issuecomment-409943219","issue_url":"https://api.github.com/repos/sardana-org/sardana/issues/880","id":409943219,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTk0MzIxOQ==","user":{"login":"reszelaz","id":6735649,"node_id":"MDQ6VXNlcjY3MzU2NDk=","avatar_url":"https://avatars1.githubusercontent.com/u/6735649?v=4","gravatar_id":"","url":"https://api.github.com/users/reszelaz","html_url":"https://github.com/reszelaz","followers_url":"https://api.github.com/users/reszelaz/followers","following_url":"https://api.github.com/users/reszelaz/following{/other_user}","gists_url":"https://api.github.com/users/reszelaz/gists{/gist_id}","starred_url":"https://api.github.com/users/reszelaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reszelaz/subscriptions","organizations_url":"https://api.github.com/users/reszelaz/orgs","repos_url":"https://api.github.com/users/reszelaz/repos","events_url":"https://api.github.com/users/reszelaz/events{/privacy}","received_events_url":"https://api.github.com/users/reszelaz/received_events","type":"User","site_admin":false},"created_at":"2018-08-02T14:20:05Z","updated_at":"2018-08-02T14:20:05Z","author_association":"COLLABORATOR","body":"Thanks for this PR and sorry for the delay in answer! I have tried it and it worked smootly.\r\n\r\n> I decided to memorize the results of the calculation in the env for now. I also save the motor for which the stats were calculated, but I guess the last used motor might be also accessible in another way from within another macro?\r\n\r\nI think there is no way to do it now.\r\n\r\n> One pretty nice thing which SPEC is able to, is to calculate the CENfrom a peak or an edge automagically. Does anybody knows how this works?\r\n\r\nUnfortunatelly I don't know. For this question and in general as reference I post a link to the similar [Solaris macros](https://github.com/synchrotron-solaris/lib-solaris-facility-macros/blob/develop/facility_lastscan.py). Maybe there you will find an answer. If you have questions about them just ask and @daneos will help for sure/\r\n\r\n> So I agree that it might be more usefull to calculate the stats on all enabled counters in the scanstats macro and save the results in a dict in the env.\r\n\r\nIt make sense. Sorry, one stupid question, do you think it may be time consuming in some scenarios?\r\n\r\nI will try to collect links to Alba's similar macros and post them here as well."}}
{"actor":{"display_login":"reszelaz"}}