{"action":"created","comment":{"url":"https://api.github.com/repos/astropy/astropy/pulls/comments/33954403","id":33954403,"diff_hunk":"@@ -484,3 +484,59 @@ def combine_labels(left, right):\n \n     return left + right\n \n+\n+def render_models2sky(model_list, image):\n+    \"\"\"\n+    Evaluates a list of 2D models on an 2D image array. Limits the evaluation to the\n+    bounding box limits if present. \n+    \"\"\"\n+    #from .. nddata.utils import add_array\n+\n+    # Get position param names if not input.\n+    # Try known variants, throw an error if not reconized.\n+    # Better way to do this?\n+    # Deal with this later, considering only Gaussian2D for now.\n+    # for pos_key in ('mean', 'pos', '0'):\n+    #     try:\n+    #         x_pos = model.parameters[model.param_names.index('x_' + pos_key)]\n+    #         y_pos = model.parameters[model.param_names.index('y_' + pos_key)]\n+    #         break\n+    #     except:\n+    #         pass\n+\n+    # try:\n+    #     x_pos, y_pos\n+    # except:\n+    #     raise InputParameterError, 'position keywords not found.'\n+    \n+    image = image.copy()\n+    im_shape = image.shape\n+\n+\n+    for model in model_list:\n+\n+        try:\n+\n+            bbox = model.bbox\n+            assert bbox is not None\n+\n+            bbox = (max([0, bbox[0]]), min([im_shape[1]-1, bbox[1]]) + 1,\n+                               max([0, bbox[2]]), min([im_shape[0]-1, bbox[3]]) + 1)\n+\n+            x, y = np.meshgrid(np.arange(bbox[0],bbox[1]).astype(int),","path":"astropy/modeling/utils.py","position":61,"original_position":61,"commit_id":"7eb82387ca3285f7a847c71f8199cb752618094d","original_commit_id":"7eb82387ca3285f7a847c71f8199cb752618094d","user":{"login":"embray","id":676149,"avatar_url":"https://avatars.githubusercontent.com/u/676149?v=3","gravatar_id":"","url":"https://api.github.com/users/embray","html_url":"https://github.com/embray","followers_url":"https://api.github.com/users/embray/followers","following_url":"https://api.github.com/users/embray/following{/other_user}","gists_url":"https://api.github.com/users/embray/gists{/gist_id}","starred_url":"https://api.github.com/users/embray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/embray/subscriptions","organizations_url":"https://api.github.com/users/embray/orgs","repos_url":"https://api.github.com/users/embray/repos","events_url":"https://api.github.com/users/embray/events{/privacy}","received_events_url":"https://api.github.com/users/embray/received_events","type":"User","site_admin":false},"body":"I stand corrected--it looks like evaluating the model on the arrays returned by ogrid does not work.  But I feel like it should.  I'll open an issue to explore that.","created_at":"2015-07-06T16:40:13Z","updated_at":"2015-07-06T16:40:13Z","html_url":"https://github.com/astropy/astropy/pull/3909#discussion_r33954403","pull_request_url":"https://api.github.com/repos/astropy/astropy/pulls/3909","_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/33954403"},"html":{"href":"https://github.com/astropy/astropy/pull/3909#discussion_r33954403"},"pull_request":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3909"}}},"pull_request":{"url":"https://api.github.com/repos/astropy/astropy/pulls/3909","id":39056593,"html_url":"https://github.com/astropy/astropy/pull/3909","diff_url":"https://github.com/astropy/astropy/pull/3909.diff","patch_url":"https://github.com/astropy/astropy/pull/3909.patch","issue_url":"https://api.github.com/repos/astropy/astropy/issues/3909","number":3909,"state":"open","locked":false,"title":"WIP: Implement `bbox` model property and `render_model2sky` function ","user":{"login":"patti","id":4968596,"avatar_url":"https://avatars.githubusercontent.com/u/4968596?v=3","gravatar_id":"","url":"https://api.github.com/users/patti","html_url":"https://github.com/patti","followers_url":"https://api.github.com/users/patti/followers","following_url":"https://api.github.com/users/patti/following{/other_user}","gists_url":"https://api.github.com/users/patti/gists{/gist_id}","starred_url":"https://api.github.com/users/patti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patti/subscriptions","organizations_url":"https://api.github.com/users/patti/orgs","repos_url":"https://api.github.com/users/patti/repos","events_url":"https://api.github.com/users/patti/events{/privacy}","received_events_url":"https://api.github.com/users/patti/received_events","type":"User","site_admin":false},"body":"A first go implementing a bounding box property for functional models. Refer to the Gaussian1D and Gaussian2D models as the others haven't been updated yet.\r\n\r\nSee a notebook demo [here](https://github.com/patti/model_rasterz/blob/master/benchmarks/Bounding-boxes.ipynb)\r\n\r\n\r\n\r\nTo Do:\r\n- Write tests\r\n- Edit doc strings\r\n- Write high level docs TBD\r\n- Incorporate extract_array and add_array\r\n- Implement for other models\r\n","created_at":"2015-07-02T07:54:18Z","updated_at":"2015-07-06T16:40:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"560d250b7211339c9b188c35e6be0c3ebdc70aa6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/astropy/astropy/pulls/3909/commits","review_comments_url":"https://api.github.com/repos/astropy/astropy/pulls/3909/comments","review_comment_url":"https://api.github.com/repos/astropy/astropy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/3909/comments","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/7eb82387ca3285f7a847c71f8199cb752618094d","head":{"label":"patti:boundingboxes","ref":"boundingboxes","sha":"7eb82387ca3285f7a847c71f8199cb752618094d","user":{"login":"patti","id":4968596,"avatar_url":"https://avatars.githubusercontent.com/u/4968596?v=3","gravatar_id":"","url":"https://api.github.com/users/patti","html_url":"https://github.com/patti","followers_url":"https://api.github.com/users/patti/followers","following_url":"https://api.github.com/users/patti/following{/other_user}","gists_url":"https://api.github.com/users/patti/gists{/gist_id}","starred_url":"https://api.github.com/users/patti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patti/subscriptions","organizations_url":"https://api.github.com/users/patti/orgs","repos_url":"https://api.github.com/users/patti/repos","events_url":"https://api.github.com/users/patti/events{/privacy}","received_events_url":"https://api.github.com/users/patti/received_events","type":"User","site_admin":false},"repo":{"id":32838725,"name":"astropy","full_name":"patti/astropy","owner":{"login":"patti","id":4968596,"avatar_url":"https://avatars.githubusercontent.com/u/4968596?v=3","gravatar_id":"","url":"https://api.github.com/users/patti","html_url":"https://github.com/patti","followers_url":"https://api.github.com/users/patti/followers","following_url":"https://api.github.com/users/patti/following{/other_user}","gists_url":"https://api.github.com/users/patti/gists{/gist_id}","starred_url":"https://api.github.com/users/patti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patti/subscriptions","organizations_url":"https://api.github.com/users/patti/orgs","repos_url":"https://api.github.com/users/patti/repos","events_url":"https://api.github.com/users/patti/events{/privacy}","received_events_url":"https://api.github.com/users/patti/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/patti/astropy","description":"Repository for the Astropy core package","fork":true,"url":"https://api.github.com/repos/patti/astropy","forks_url":"https://api.github.com/repos/patti/astropy/forks","keys_url":"https://api.github.com/repos/patti/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/patti/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/patti/astropy/teams","hooks_url":"https://api.github.com/repos/patti/astropy/hooks","issue_events_url":"https://api.github.com/repos/patti/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/patti/astropy/events","assignees_url":"https://api.github.com/repos/patti/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/patti/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/patti/astropy/tags","blobs_url":"https://api.github.com/repos/patti/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/patti/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/patti/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/patti/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/patti/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/patti/astropy/languages","stargazers_url":"https://api.github.com/repos/patti/astropy/stargazers","contributors_url":"https://api.github.com/repos/patti/astropy/contributors","subscribers_url":"https://api.github.com/repos/patti/astropy/subscribers","subscription_url":"https://api.github.com/repos/patti/astropy/subscription","commits_url":"https://api.github.com/repos/patti/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/patti/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/patti/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/patti/astropy/issues/comments{/number}","contents_url":"https://api.github.com/repos/patti/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/patti/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/patti/astropy/merges","archive_url":"https://api.github.com/repos/patti/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/patti/astropy/downloads","issues_url":"https://api.github.com/repos/patti/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/patti/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/patti/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/patti/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/patti/astropy/labels{/name}","releases_url":"https://api.github.com/repos/patti/astropy/releases{/id}","created_at":"2015-03-25T02:49:38Z","updated_at":"2015-03-25T02:49:43Z","pushed_at":"2015-07-04T00:49:53Z","git_url":"git://github.com/patti/astropy.git","ssh_url":"git@github.com:patti/astropy.git","clone_url":"https://github.com/patti/astropy.git","svn_url":"https://github.com/patti/astropy","homepage":"www.astropy.org","size":37428,"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":"astropy:master","ref":"master","sha":"700d6476835d5ad80d34a40906eed0c2a37009d0","user":{"login":"astropy","id":847984,"avatar_url":"https://avatars.githubusercontent.com/u/847984?v=3","gravatar_id":"","url":"https://api.github.com/users/astropy","html_url":"https://github.com/astropy","followers_url":"https://api.github.com/users/astropy/followers","following_url":"https://api.github.com/users/astropy/following{/other_user}","gists_url":"https://api.github.com/users/astropy/gists{/gist_id}","starred_url":"https://api.github.com/users/astropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astropy/subscriptions","organizations_url":"https://api.github.com/users/astropy/orgs","repos_url":"https://api.github.com/users/astropy/repos","events_url":"https://api.github.com/users/astropy/events{/privacy}","received_events_url":"https://api.github.com/users/astropy/received_events","type":"Organization","site_admin":false},"repo":{"id":2081289,"name":"astropy","full_name":"astropy/astropy","owner":{"login":"astropy","id":847984,"avatar_url":"https://avatars.githubusercontent.com/u/847984?v=3","gravatar_id":"","url":"https://api.github.com/users/astropy","html_url":"https://github.com/astropy","followers_url":"https://api.github.com/users/astropy/followers","following_url":"https://api.github.com/users/astropy/following{/other_user}","gists_url":"https://api.github.com/users/astropy/gists{/gist_id}","starred_url":"https://api.github.com/users/astropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astropy/subscriptions","organizations_url":"https://api.github.com/users/astropy/orgs","repos_url":"https://api.github.com/users/astropy/repos","events_url":"https://api.github.com/users/astropy/events{/privacy}","received_events_url":"https://api.github.com/users/astropy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/astropy/astropy","description":"Repository for the Astropy core package","fork":false,"url":"https://api.github.com/repos/astropy/astropy","forks_url":"https://api.github.com/repos/astropy/astropy/forks","keys_url":"https://api.github.com/repos/astropy/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/astropy/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/astropy/astropy/teams","hooks_url":"https://api.github.com/repos/astropy/astropy/hooks","issue_events_url":"https://api.github.com/repos/astropy/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/astropy/astropy/events","assignees_url":"https://api.github.com/repos/astropy/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/astropy/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/astropy/astropy/tags","blobs_url":"https://api.github.com/repos/astropy/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/astropy/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/astropy/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/astropy/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/astropy/astropy/languages","stargazers_url":"https://api.github.com/repos/astropy/astropy/stargazers","contributors_url":"https://api.github.com/repos/astropy/astropy/contributors","subscribers_url":"https://api.github.com/repos/astropy/astropy/subscribers","subscription_url":"https://api.github.com/repos/astropy/astropy/subscription","commits_url":"https://api.github.com/repos/astropy/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/astropy/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/astropy/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/astropy/astropy/issues/comments{/number}","contents_url":"https://api.github.com/repos/astropy/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/astropy/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/astropy/astropy/merges","archive_url":"https://api.github.com/repos/astropy/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/astropy/astropy/downloads","issues_url":"https://api.github.com/repos/astropy/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/astropy/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/astropy/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/astropy/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/astropy/astropy/labels{/name}","releases_url":"https://api.github.com/repos/astropy/astropy/releases{/id}","created_at":"2011-07-21T01:33:49Z","updated_at":"2015-07-06T13:38:37Z","pushed_at":"2015-07-06T15:35:26Z","git_url":"git://github.com/astropy/astropy.git","ssh_url":"git@github.com:astropy/astropy.git","clone_url":"https://github.com/astropy/astropy.git","svn_url":"https://github.com/astropy/astropy","homepage":"www.astropy.org","size":64875,"stargazers_count":598,"watchers_count":598,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":405,"mirror_url":null,"open_issues_count":562,"forks":405,"open_issues":562,"watchers":598,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3909"},"html":{"href":"https://github.com/astropy/astropy/pull/3909"},"issue":{"href":"https://api.github.com/repos/astropy/astropy/issues/3909"},"comments":{"href":"https://api.github.com/repos/astropy/astropy/issues/3909/comments"},"review_comments":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3909/comments"},"review_comment":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3909/commits"},"statuses":{"href":"https://api.github.com/repos/astropy/astropy/statuses/7eb82387ca3285f7a847c71f8199cb752618094d"}}}}