{"action":"created","comment":{"url":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/comments/238375995","pull_request_review_id":180902628,"id":238375995,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODM3NTk5NQ==","diff_hunk":"@@ -0,0 +1,50 @@\n+import numpy as np\n+from ophyd.sim import SynAxis, SynSignal\n+\n+\n+def generate_simulation(motor_column, signal_column, dataframe,\n+                        motor_precision=3, random_state=None):\n+    \"\"\"\n+    Generate a simulation based on a provided DataFrame\n+\n+    Use collected data to simulate the relationship between a single\n+    input and output variable. A ``SynAxis`` object will be returned that can\n+    be set to a specified precision. The value of the dependent variable is\n+    then determined by finding the closest position of the motor we have\n+    recorded and returning the corresponding value. If multiple readings were\n+    taken at this position one is randomly chosen.\n+\n+    Parameters\n+    ----------\n+    motor_column: str\n+        The column of data that will be used as the independent variable. Will\n+        also be the name of the created motor\n+\n+    signal_column: str\n+        The name of the column to be the dependent variable. Will also be the\n+        name of the created signal\n+\n+    dataframe: pandas.DataFrame\n+        Data to use in simulation\n+\n+    motor_precision: int, optional\n+        Limit the accuracy of the simulated motor\n+\n+    random_state: np.random.RandomState, optional\n+        Seed the simulation\n+    \"\"\"\n+    # Create our motor that will serve as the independent variable\n+    motor = SynAxis(name=motor_column, precision=motor_precision)\n+\n+    # Create a function to return a random value from closest motor position\n+    motor_positions = dataframe[motor_column].unique()\n+    sim_data = dict(iter(dataframe.groupby(motor_column)))","path":"jet_tracking/sim.py","position":null,"original_position":41,"commit_id":"b88a80af65740da1b9c42ae213420cdba43fa037","original_commit_id":"fb8c7320c9b62bf3b4361cdd0fb7bbc8539e68d6","user":{"login":"teddyrendahl","id":25753048,"node_id":"MDQ6VXNlcjI1NzUzMDQ4","avatar_url":"https://avatars3.githubusercontent.com/u/25753048?v=4","gravatar_id":"","url":"https://api.github.com/users/teddyrendahl","html_url":"https://github.com/teddyrendahl","followers_url":"https://api.github.com/users/teddyrendahl/followers","following_url":"https://api.github.com/users/teddyrendahl/following{/other_user}","gists_url":"https://api.github.com/users/teddyrendahl/gists{/gist_id}","starred_url":"https://api.github.com/users/teddyrendahl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teddyrendahl/subscriptions","organizations_url":"https://api.github.com/users/teddyrendahl/orgs","repos_url":"https://api.github.com/users/teddyrendahl/repos","events_url":"https://api.github.com/users/teddyrendahl/events{/privacy}","received_events_url":"https://api.github.com/users/teddyrendahl/received_events","type":"User","site_admin":false},"body":"🤓 ","created_at":"2018-12-03T18:04:51Z","updated_at":"2018-12-03T18:04:52Z","html_url":"https://github.com/pcdshub/jet_tracking/pull/12#discussion_r238375995","pull_request_url":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/12","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/comments/238375995"},"html":{"href":"https://github.com/pcdshub/jet_tracking/pull/12#discussion_r238375995"},"pull_request":{"href":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/12"}},"in_reply_to_id":238052704},"pull_request":{"url":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/12","id":235143727,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1MTQzNzI3","html_url":"https://github.com/pcdshub/jet_tracking/pull/12","diff_url":"https://github.com/pcdshub/jet_tracking/pull/12.diff","patch_url":"https://github.com/pcdshub/jet_tracking/pull/12.patch","issue_url":"https://api.github.com/repos/pcdshub/jet_tracking/issues/12","number":12,"state":"open","locked":false,"title":"ENH: Generate Simulation","user":{"login":"teddyrendahl","id":25753048,"node_id":"MDQ6VXNlcjI1NzUzMDQ4","avatar_url":"https://avatars3.githubusercontent.com/u/25753048?v=4","gravatar_id":"","url":"https://api.github.com/users/teddyrendahl","html_url":"https://github.com/teddyrendahl","followers_url":"https://api.github.com/users/teddyrendahl/followers","following_url":"https://api.github.com/users/teddyrendahl/following{/other_user}","gists_url":"https://api.github.com/users/teddyrendahl/gists{/gist_id}","starred_url":"https://api.github.com/users/teddyrendahl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teddyrendahl/subscriptions","organizations_url":"https://api.github.com/users/teddyrendahl/orgs","repos_url":"https://api.github.com/users/teddyrendahl/repos","events_url":"https://api.github.com/users/teddyrendahl/events{/privacy}","received_events_url":"https://api.github.com/users/teddyrendahl/received_events","type":"User","site_admin":false},"body":"Create a simulation from a `DataFrame` of collected data","created_at":"2018-11-30T23:22:23Z","updated_at":"2018-12-03T18:04:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"644d7e27448fac64a6e62551b89fcad8a325aae0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/12/commits","review_comments_url":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/12/comments","review_comment_url":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pcdshub/jet_tracking/issues/12/comments","statuses_url":"https://api.github.com/repos/pcdshub/jet_tracking/statuses/b88a80af65740da1b9c42ae213420cdba43fa037","head":{"label":"teddyrendahl:df_sim","ref":"df_sim","sha":"b88a80af65740da1b9c42ae213420cdba43fa037","user":{"login":"teddyrendahl","id":25753048,"node_id":"MDQ6VXNlcjI1NzUzMDQ4","avatar_url":"https://avatars3.githubusercontent.com/u/25753048?v=4","gravatar_id":"","url":"https://api.github.com/users/teddyrendahl","html_url":"https://github.com/teddyrendahl","followers_url":"https://api.github.com/users/teddyrendahl/followers","following_url":"https://api.github.com/users/teddyrendahl/following{/other_user}","gists_url":"https://api.github.com/users/teddyrendahl/gists{/gist_id}","starred_url":"https://api.github.com/users/teddyrendahl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teddyrendahl/subscriptions","organizations_url":"https://api.github.com/users/teddyrendahl/orgs","repos_url":"https://api.github.com/users/teddyrendahl/repos","events_url":"https://api.github.com/users/teddyrendahl/events{/privacy}","received_events_url":"https://api.github.com/users/teddyrendahl/received_events","type":"User","site_admin":false},"repo":{"id":159242980,"node_id":"MDEwOlJlcG9zaXRvcnkxNTkyNDI5ODA=","name":"jet_tracking","full_name":"teddyrendahl/jet_tracking","private":false,"owner":{"login":"teddyrendahl","id":25753048,"node_id":"MDQ6VXNlcjI1NzUzMDQ4","avatar_url":"https://avatars3.githubusercontent.com/u/25753048?v=4","gravatar_id":"","url":"https://api.github.com/users/teddyrendahl","html_url":"https://github.com/teddyrendahl","followers_url":"https://api.github.com/users/teddyrendahl/followers","following_url":"https://api.github.com/users/teddyrendahl/following{/other_user}","gists_url":"https://api.github.com/users/teddyrendahl/gists{/gist_id}","starred_url":"https://api.github.com/users/teddyrendahl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teddyrendahl/subscriptions","organizations_url":"https://api.github.com/users/teddyrendahl/orgs","repos_url":"https://api.github.com/users/teddyrendahl/repos","events_url":"https://api.github.com/users/teddyrendahl/events{/privacy}","received_events_url":"https://api.github.com/users/teddyrendahl/received_events","type":"User","site_admin":false},"html_url":"https://github.com/teddyrendahl/jet_tracking","description":"CXI liquid jet positioning feedback and tracking","fork":true,"url":"https://api.github.com/repos/teddyrendahl/jet_tracking","forks_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/forks","keys_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/keys{/key_id}","collaborators_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/teams","hooks_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/hooks","issue_events_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/issues/events{/number}","events_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/events","assignees_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/assignees{/user}","branches_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/branches{/branch}","tags_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/tags","blobs_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/git/refs{/sha}","trees_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/git/trees{/sha}","statuses_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/statuses/{sha}","languages_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/languages","stargazers_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/stargazers","contributors_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/contributors","subscribers_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/subscribers","subscription_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/subscription","commits_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/commits{/sha}","git_commits_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/git/commits{/sha}","comments_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/comments{/number}","issue_comment_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/issues/comments{/number}","contents_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/contents/{+path}","compare_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/compare/{base}...{head}","merges_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/merges","archive_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/downloads","issues_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/issues{/number}","pulls_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/pulls{/number}","milestones_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/milestones{/number}","notifications_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/labels{/name}","releases_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/releases{/id}","deployments_url":"https://api.github.com/repos/teddyrendahl/jet_tracking/deployments","created_at":"2018-11-26T22:46:19Z","updated_at":"2018-11-26T22:46:21Z","pushed_at":"2018-12-03T18:04:25Z","git_url":"git://github.com/teddyrendahl/jet_tracking.git","ssh_url":"git@github.com:teddyrendahl/jet_tracking.git","clone_url":"https://github.com/teddyrendahl/jet_tracking.git","svn_url":"https://github.com/teddyrendahl/jet_tracking","homepage":"https://pcdshub.github.io/jet_tracking/","size":21396,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pcdshub:master","ref":"master","sha":"d4e88356c08e3b8a41de6a6dbc48fe4f0ccca07c","user":{"login":"pcdshub","id":31903189,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxOTAzMTg5","avatar_url":"https://avatars1.githubusercontent.com/u/31903189?v=4","gravatar_id":"","url":"https://api.github.com/users/pcdshub","html_url":"https://github.com/pcdshub","followers_url":"https://api.github.com/users/pcdshub/followers","following_url":"https://api.github.com/users/pcdshub/following{/other_user}","gists_url":"https://api.github.com/users/pcdshub/gists{/gist_id}","starred_url":"https://api.github.com/users/pcdshub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcdshub/subscriptions","organizations_url":"https://api.github.com/users/pcdshub/orgs","repos_url":"https://api.github.com/users/pcdshub/repos","events_url":"https://api.github.com/users/pcdshub/events{/privacy}","received_events_url":"https://api.github.com/users/pcdshub/received_events","type":"Organization","site_admin":false},"repo":{"id":147857125,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc4NTcxMjU=","name":"jet_tracking","full_name":"pcdshub/jet_tracking","private":false,"owner":{"login":"pcdshub","id":31903189,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxOTAzMTg5","avatar_url":"https://avatars1.githubusercontent.com/u/31903189?v=4","gravatar_id":"","url":"https://api.github.com/users/pcdshub","html_url":"https://github.com/pcdshub","followers_url":"https://api.github.com/users/pcdshub/followers","following_url":"https://api.github.com/users/pcdshub/following{/other_user}","gists_url":"https://api.github.com/users/pcdshub/gists{/gist_id}","starred_url":"https://api.github.com/users/pcdshub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcdshub/subscriptions","organizations_url":"https://api.github.com/users/pcdshub/orgs","repos_url":"https://api.github.com/users/pcdshub/repos","events_url":"https://api.github.com/users/pcdshub/events{/privacy}","received_events_url":"https://api.github.com/users/pcdshub/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pcdshub/jet_tracking","description":"CXI liquid jet positioning feedback and tracking","fork":false,"url":"https://api.github.com/repos/pcdshub/jet_tracking","forks_url":"https://api.github.com/repos/pcdshub/jet_tracking/forks","keys_url":"https://api.github.com/repos/pcdshub/jet_tracking/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pcdshub/jet_tracking/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pcdshub/jet_tracking/teams","hooks_url":"https://api.github.com/repos/pcdshub/jet_tracking/hooks","issue_events_url":"https://api.github.com/repos/pcdshub/jet_tracking/issues/events{/number}","events_url":"https://api.github.com/repos/pcdshub/jet_tracking/events","assignees_url":"https://api.github.com/repos/pcdshub/jet_tracking/assignees{/user}","branches_url":"https://api.github.com/repos/pcdshub/jet_tracking/branches{/branch}","tags_url":"https://api.github.com/repos/pcdshub/jet_tracking/tags","blobs_url":"https://api.github.com/repos/pcdshub/jet_tracking/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pcdshub/jet_tracking/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pcdshub/jet_tracking/git/refs{/sha}","trees_url":"https://api.github.com/repos/pcdshub/jet_tracking/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pcdshub/jet_tracking/statuses/{sha}","languages_url":"https://api.github.com/repos/pcdshub/jet_tracking/languages","stargazers_url":"https://api.github.com/repos/pcdshub/jet_tracking/stargazers","contributors_url":"https://api.github.com/repos/pcdshub/jet_tracking/contributors","subscribers_url":"https://api.github.com/repos/pcdshub/jet_tracking/subscribers","subscription_url":"https://api.github.com/repos/pcdshub/jet_tracking/subscription","commits_url":"https://api.github.com/repos/pcdshub/jet_tracking/commits{/sha}","git_commits_url":"https://api.github.com/repos/pcdshub/jet_tracking/git/commits{/sha}","comments_url":"https://api.github.com/repos/pcdshub/jet_tracking/comments{/number}","issue_comment_url":"https://api.github.com/repos/pcdshub/jet_tracking/issues/comments{/number}","contents_url":"https://api.github.com/repos/pcdshub/jet_tracking/contents/{+path}","compare_url":"https://api.github.com/repos/pcdshub/jet_tracking/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pcdshub/jet_tracking/merges","archive_url":"https://api.github.com/repos/pcdshub/jet_tracking/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pcdshub/jet_tracking/downloads","issues_url":"https://api.github.com/repos/pcdshub/jet_tracking/issues{/number}","pulls_url":"https://api.github.com/repos/pcdshub/jet_tracking/pulls{/number}","milestones_url":"https://api.github.com/repos/pcdshub/jet_tracking/milestones{/number}","notifications_url":"https://api.github.com/repos/pcdshub/jet_tracking/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pcdshub/jet_tracking/labels{/name}","releases_url":"https://api.github.com/repos/pcdshub/jet_tracking/releases{/id}","deployments_url":"https://api.github.com/repos/pcdshub/jet_tracking/deployments","created_at":"2018-09-07T17:53:25Z","updated_at":"2018-11-30T22:53:56Z","pushed_at":"2018-12-03T18:04:26Z","git_url":"git://github.com/pcdshub/jet_tracking.git","ssh_url":"git@github.com:pcdshub/jet_tracking.git","clone_url":"https://github.com/pcdshub/jet_tracking.git","svn_url":"https://github.com/pcdshub/jet_tracking","homepage":"https://pcdshub.github.io/jet_tracking/","size":21419,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":4,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/12"},"html":{"href":"https://github.com/pcdshub/jet_tracking/pull/12"},"issue":{"href":"https://api.github.com/repos/pcdshub/jet_tracking/issues/12"},"comments":{"href":"https://api.github.com/repos/pcdshub/jet_tracking/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pcdshub/jet_tracking/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/pcdshub/jet_tracking/statuses/b88a80af65740da1b9c42ae213420cdba43fa037"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"teddyrendahl"}}