{"action":"created","comment":{"url":"https://api.github.com/repos/astropy/astropy/pulls/comments/44709470","id":44709470,"diff_hunk":"@@ -13,137 +14,145 @@ image from a large survey catalog, each source should only be evaluated over the\n pixels to which it contributes a significant amount of flux. This task can\n otherwise be computationally prohibitive on an average CPU.\n \n-The `astropy.modeling.render_model` function can be used to evaluate a model on\n-an input array, or coordinates, limiting the evaluation to the ``bounding_box``\n-region if it is set. This function will also produce postage stamp images of the\n-model if no other input array is passed. To instead extract postage\n-stamps from the data array itself, see :ref:`cutout_images`.\n+The :func:`Model.render <astropy.modeling.Model.render>` method can be used to\n+evaluate a model on an output array, or input coordinate arrays, limiting the\n+evaluation to the `bounding_box <astropy.modeling.Model.bounding_box>` region if\n+it is set. This function will also produce postage stamp images of the model if\n+no other input array is passed. To instead extract postage stamps from the data\n+array itself, see :ref:`cutout_images`.\n \n Using the Bounding Box\n -----------------------\n \n-For basic usage, see `astropy.modeling.Model.bounding_box`.\n-By default no bounding box is set (``bounding_box`` is `None`), except for\n-individual model subclasses that have a ``bounding_box_default`` function\n-defined. ``bounding_box_default`` returns the minimum rectangular region\n-symmetric about the position that fully contains the model if the model has a\n-finite extent. If a model does not have a finite extent, the choice for the\n-``bounding_box_default`` limits is noted in the docstring. For example, see\n-`astropy.modeling.functional_models.Gaussian2D.bounding_box_default`.\n+For basic usage, see `Model.bounding_box\n+<astropy.modeling.Model.bounding_box>`.  By default no\n+`~astropy.modeling.Model.bounding_box` is set, except on model subclasses where\n+a ``bounding_box`` property or method is explicity defined. The default is then\n+the minimum rectangular region symmetric about the position that fully contains\n+the model. If the model does not have a finite extent, the containment criteria\n+are noted in the documentation. For example, see ``Gaussian2D.bounding_box``.\n \n-The default function can also be set to any callable. This is particularly\n-useful for fitting ``custom_model`` or ``CompoundModel`` instances.\n+`Model.bounding_box <astropy.modeling.Model.bounding_box>` can be set by the\n+user to any callable. This is particularly useful for fitting models created\n+with `~astropy.modeling.custom_model` or as a compound model::\n \n     >>> from astropy.modeling import custom_model\n     >>> def ellipsoid(x, y, z, x0=0, y0=0, z0=0, a=2, b=3, c=4, amp=1):\n-    ...     rsq = ((x-x0)/a) ** 2 + ((y-y0)/b) ** 2 + ((z-z0)/c) ** 2\n+    ...     rsq = ((x - x0) / a) ** 2 + ((y - y0) / b) ** 2 + ((z - z0) / c) ** 2\n     ...     val = (rsq < 1) * amp\n     ...     return val\n     ...\n-    >>> def ellipsoid_bb(self):\n-    ...     return ((self.z0 - self.c, self.z0 + self.c),\n-    ...             (self.y0 - self.b, self.y0 + self.b),\n-    ...             (self.x0 - self.a, self.x0 + self.a))\n+    >>> class Ellipsoid3D(custom_model(ellipsoid)):\n+    ...     # A 3D ellipsoid model\n+    ...     @property\n+    ...     def bounding_box(self):\n+    ...         return ((self.z0 - self.c, self.z0 + self.c),\n+    ...                 (self.y0 - self.b, self.y0 + self.b),\n+    ...                 (self.x0 - self.a, self.x0 + self.a))\n     ...\n-    >>> Ellipsoid3D = custom_model(ellipsoid)\n-    >>> Ellipsoid3D.bounding_box_default = ellipsoid_bb\n     >>> model = Ellipsoid3D()\n-    >>> model.bounding_box = 'auto'\n     >>> model.bounding_box\n     ((-4.0, 4.0), (-3.0, 3.0), (-2.0, 2.0))\n \n-Efficient evaluation with ``render_model``\n-------------------------------------------\n+.. warning::\n \n-When a model is evaluated over a range much larger than the model itself, it may\n-be prudent to use `astropy.modeling.render_model` if efficiency is a concern.\n-The ``render_model`` function can be used to evaluate a model on an array of the\n-same dimensions. If no array is given, ``render_model`` will return a \"postage\n-stamp\" array corresponding to the bounding box region. However, if\n-``bounding_box`` is `None` an image or coordinates must be passed.\n+    Note: Currently when creating a new compound model by combining multiple","path":"docs/modeling/bounding-boxes.rst","position":87,"original_position":87,"commit_id":"6bf60b3308217cedae00acaa84c4e781e409f36d","original_commit_id":"6bf60b3308217cedae00acaa84c4e781e409f36d","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":":+1: ","created_at":"2015-11-12T20:24:02Z","updated_at":"2015-11-12T20:24:02Z","html_url":"https://github.com/astropy/astropy/pull/4264#discussion_r44709470","pull_request_url":"https://api.github.com/repos/astropy/astropy/pulls/4264","_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/44709470"},"html":{"href":"https://github.com/astropy/astropy/pull/4264#discussion_r44709470"},"pull_request":{"href":"https://api.github.com/repos/astropy/astropy/pulls/4264"}}},"pull_request":{"url":"https://api.github.com/repos/astropy/astropy/pulls/4264","id":48506520,"html_url":"https://github.com/astropy/astropy/pull/4264","diff_url":"https://github.com/astropy/astropy/pull/4264.diff","patch_url":"https://github.com/astropy/astropy/pull/4264.patch","issue_url":"https://api.github.com/repos/astropy/astropy/issues/4264","number":4264,"state":"closed","locked":false,"title":"Updates to bounding box interface and cleanup","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":"This is the update to #4040--it includes all the fixes from #4040, but also includes my updates to the bounding box interface.\r\n\r\nThe purpose of these updates, as explained in the commit message of 779ef3e5bb14d9711dc24ae26578bfd7c22d618b, is to make the interface for `bounding_box` fairly consistent with the interface for `Model.inverse`.  To that end the `bounding_box_default` method is eliminated, and model classes that define a bounding box can do so as a class-level attribute, method, or property simply called `bounding_box`, which is then wrapped by the Model metaclass to incorporate the default getter/setter behavior for the `Model.bounding_box` property.  This is similar to how `Model.inverse` works.\r\n\r\nOne downside to this that I just noticed while testing the documentation is that if a `Model` subclass has a `bounding_box` with its own docstring, that docstring usually gets thrown away.  We definitely don't want that, so I am going to open a separate issue to fix that later.","created_at":"2015-10-22T20:12:24Z","updated_at":"2015-11-12T20:24:02Z","closed_at":"2015-11-09T13:43:55Z","merged_at":"2015-11-09T13:43:55Z","merge_commit_sha":"e9ca92f27bc00bd807f60565801b4ef12bd2bc06","assignee":null,"milestone":{"url":"https://api.github.com/repos/astropy/astropy/milestones/20","html_url":"https://github.com/astropy/astropy/milestones/v1.1.0","labels_url":"https://api.github.com/repos/astropy/astropy/milestones/20/labels","id":907426,"number":20,"title":"v1.1.0","description":"","creator":{"login":"eteq","id":346587,"avatar_url":"https://avatars.githubusercontent.com/u/346587?v=3","gravatar_id":"","url":"https://api.github.com/users/eteq","html_url":"https://github.com/eteq","followers_url":"https://api.github.com/users/eteq/followers","following_url":"https://api.github.com/users/eteq/following{/other_user}","gists_url":"https://api.github.com/users/eteq/gists{/gist_id}","starred_url":"https://api.github.com/users/eteq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eteq/subscriptions","organizations_url":"https://api.github.com/users/eteq/orgs","repos_url":"https://api.github.com/users/eteq/repos","events_url":"https://api.github.com/users/eteq/events{/privacy}","received_events_url":"https://api.github.com/users/eteq/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":187,"state":"open","created_at":"2014-12-17T20:05:23Z","updated_at":"2015-11-12T20:22:14Z","due_on":"2015-07-23T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/astropy/astropy/pulls/4264/commits","review_comments_url":"https://api.github.com/repos/astropy/astropy/pulls/4264/comments","review_comment_url":"https://api.github.com/repos/astropy/astropy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/4264/comments","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/6bf60b3308217cedae00acaa84c4e781e409f36d","head":{"label":"embray:modeling/bbox2","ref":"modeling/bbox2","sha":"6bf60b3308217cedae00acaa84c4e781e409f36d","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},"repo":{"id":2223452,"name":"astropy","full_name":"embray/astropy","owner":{"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},"private":false,"html_url":"https://github.com/embray/astropy","description":"My fork of the main Astropy repository (astropy/astropy)","fork":true,"url":"https://api.github.com/repos/embray/astropy","forks_url":"https://api.github.com/repos/embray/astropy/forks","keys_url":"https://api.github.com/repos/embray/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/embray/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/embray/astropy/teams","hooks_url":"https://api.github.com/repos/embray/astropy/hooks","issue_events_url":"https://api.github.com/repos/embray/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/embray/astropy/events","assignees_url":"https://api.github.com/repos/embray/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/embray/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/embray/astropy/tags","blobs_url":"https://api.github.com/repos/embray/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/embray/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/embray/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/embray/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/embray/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/embray/astropy/languages","stargazers_url":"https://api.github.com/repos/embray/astropy/stargazers","contributors_url":"https://api.github.com/repos/embray/astropy/contributors","subscribers_url":"https://api.github.com/repos/embray/astropy/subscribers","subscription_url":"https://api.github.com/repos/embray/astropy/subscription","commits_url":"https://api.github.com/repos/embray/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/embray/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/embray/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/embray/astropy/issues/comments{/number}","contents_url":"https://api.github.com/repos/embray/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/embray/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/embray/astropy/merges","archive_url":"https://api.github.com/repos/embray/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/embray/astropy/downloads","issues_url":"https://api.github.com/repos/embray/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/embray/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/embray/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/embray/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/embray/astropy/labels{/name}","releases_url":"https://api.github.com/repos/embray/astropy/releases{/id}","created_at":"2011-08-17T18:24:15Z","updated_at":"2015-03-28T23:20:13Z","pushed_at":"2015-11-12T20:23:34Z","git_url":"git://github.com/embray/astropy.git","ssh_url":"git@github.com:embray/astropy.git","clone_url":"https://github.com/embray/astropy.git","svn_url":"https://github.com/embray/astropy","homepage":"astropy.org","size":54132,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"astropy:master","ref":"master","sha":"5af98d9cfd0d60a6904ffb76ffd7a57edd20f7ab","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-11-10T23:54:50Z","pushed_at":"2015-11-12T20:13:37Z","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":70569,"stargazers_count":702,"watchers_count":702,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":449,"mirror_url":null,"open_issues_count":613,"forks":449,"open_issues":613,"watchers":702,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/4264"},"html":{"href":"https://github.com/astropy/astropy/pull/4264"},"issue":{"href":"https://api.github.com/repos/astropy/astropy/issues/4264"},"comments":{"href":"https://api.github.com/repos/astropy/astropy/issues/4264/comments"},"review_comments":{"href":"https://api.github.com/repos/astropy/astropy/pulls/4264/comments"},"review_comment":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/astropy/astropy/pulls/4264/commits"},"statuses":{"href":"https://api.github.com/repos/astropy/astropy/statuses/6bf60b3308217cedae00acaa84c4e781e409f36d"}}}}