{"action":"created","comment":{"url":"https://api.github.com/repos/gammapy/gammapy/pulls/comments/35032107","id":35032107,"diff_hunk":"@@ -416,3 +415,28 @@ A lot of code that's not gamma-ray specific belongs in other packages\n (e.g. `Scipy`_, `Astropy`_, other Astropy-affiliated packages, `Sherpa`_).\n We currently have quite a bit of code that should be moved \"upstream\" or already has been,\n but the Gammapy code hasn't been adapted yet.\n+\n+Assert convention\n+-----------------\n+\n+When performing tests, the preferred numerical assert method is\n+`numpy.testing.assert_allclose`. Use\n+\n+``from numpy.testing import assert_allclose``\n+\n+at the top of the file and then just use ``assert_allclose`` for\n+the tests. This makes the lines shorter, i.e. there is more space\n+for the arguments.\n+\n+``assert_allclose`` covers all use cases for numerical asserts, so\n+it should be used consistently everywhere instead of using the\n+dozens of other available asserts from pytest or numpy in various\n+places.\n+\n+More details in `numpy.testing.assert_allclose`.","path":"docs/development/index.rst","position":30,"original_position":30,"commit_id":"e908a921e765cf749142f8187cc324baa7513146","original_commit_id":"e908a921e765cf749142f8187cc324baa7513146","user":{"login":"mapazarr","id":11326731,"avatar_url":"https://avatars.githubusercontent.com/u/11326731?v=3","gravatar_id":"","url":"https://api.github.com/users/mapazarr","html_url":"https://github.com/mapazarr","followers_url":"https://api.github.com/users/mapazarr/followers","following_url":"https://api.github.com/users/mapazarr/following{/other_user}","gists_url":"https://api.github.com/users/mapazarr/gists{/gist_id}","starred_url":"https://api.github.com/users/mapazarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapazarr/subscriptions","organizations_url":"https://api.github.com/users/mapazarr/orgs","repos_url":"https://api.github.com/users/mapazarr/repos","events_url":"https://api.github.com/users/mapazarr/events{/privacy}","received_events_url":"https://api.github.com/users/mapazarr/received_events","type":"User","site_admin":false},"body":"OK. Done. About the `~gammapy.utils.testing.assert_quantity` method. Please consider issue #306. Maybe we can discuss/address this on a separate PR?","created_at":"2015-07-20T19:14:43Z","updated_at":"2015-07-20T19:14:43Z","html_url":"https://github.com/gammapy/gammapy/pull/299#discussion_r35032107","pull_request_url":"https://api.github.com/repos/gammapy/gammapy/pulls/299","_links":{"self":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/comments/35032107"},"html":{"href":"https://github.com/gammapy/gammapy/pull/299#discussion_r35032107"},"pull_request":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/299"}}},"pull_request":{"url":"https://api.github.com/repos/gammapy/gammapy/pulls/299","id":39741190,"html_url":"https://github.com/gammapy/gammapy/pull/299","diff_url":"https://github.com/gammapy/gammapy/pull/299.diff","patch_url":"https://github.com/gammapy/gammapy/pull/299.patch","issue_url":"https://api.github.com/repos/gammapy/gammapy/issues/299","number":299,"state":"open","locked":false,"title":"Add cube background model class","user":{"login":"mapazarr","id":11326731,"avatar_url":"https://avatars.githubusercontent.com/u/11326731?v=3","gravatar_id":"","url":"https://api.github.com/users/mapazarr","html_url":"https://github.com/mapazarr","followers_url":"https://api.github.com/users/mapazarr/followers","following_url":"https://api.github.com/users/mapazarr/following{/other_user}","gists_url":"https://api.github.com/users/mapazarr/gists{/gist_id}","starred_url":"https://api.github.com/users/mapazarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapazarr/subscriptions","organizations_url":"https://api.github.com/users/mapazarr/orgs","repos_url":"https://api.github.com/users/mapazarr/repos","events_url":"https://api.github.com/users/mapazarr/events{/privacy}","received_events_url":"https://api.github.com/users/mapazarr/received_events","type":"User","site_admin":false},"body":"This PR is a continuation of PR #292.\r\nTask list:\r\n\r\n - [x] the write method (and a test for it)\r\n - [x] porting the test file to `~gammapy-extra`\r\n - [x] make the test that use external files work\r\n - [x] implement `read_image` and `write_image` with a `WCS` object and a HDU table for the energy bin edges; tests\r\n - [x] separate the plot functions into `do_one_plot` and `do_many_plots` functions\r\n - [x] clean the code and autopep it\r\n - [x] the sphinx doc; add link to `examples/plot_background_model.py`; add examples of many plots (mosaic of images, stack of spectra)\r\n - [x] code review and final revision of inline comments\r\n\r\nFurther methods like histograming of event lists or interpolation and smoothing of the model will come on a later PR.\r\n\r\nSorry for the mess, I renamed the branch, which automatically closes the pull request. I thought the PR would be transparent to the rename.","created_at":"2015-07-11T06:22:12Z","updated_at":"2015-07-20T19:14:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73a1818272edda2de72d2349f7fea1b096f7d529","assignee":{"login":"cdeil","id":852409,"avatar_url":"https://avatars.githubusercontent.com/u/852409?v=3","gravatar_id":"","url":"https://api.github.com/users/cdeil","html_url":"https://github.com/cdeil","followers_url":"https://api.github.com/users/cdeil/followers","following_url":"https://api.github.com/users/cdeil/following{/other_user}","gists_url":"https://api.github.com/users/cdeil/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeil/subscriptions","organizations_url":"https://api.github.com/users/cdeil/orgs","repos_url":"https://api.github.com/users/cdeil/repos","events_url":"https://api.github.com/users/cdeil/events{/privacy}","received_events_url":"https://api.github.com/users/cdeil/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/gammapy/gammapy/milestones/2","html_url":"https://github.com/gammapy/gammapy/milestones/0.3","labels_url":"https://api.github.com/repos/gammapy/gammapy/milestones/2/labels","id":377787,"number":2,"title":"0.3","description":"","creator":{"login":"cdeil","id":852409,"avatar_url":"https://avatars.githubusercontent.com/u/852409?v=3","gravatar_id":"","url":"https://api.github.com/users/cdeil","html_url":"https://github.com/cdeil","followers_url":"https://api.github.com/users/cdeil/followers","following_url":"https://api.github.com/users/cdeil/following{/other_user}","gists_url":"https://api.github.com/users/cdeil/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeil/subscriptions","organizations_url":"https://api.github.com/users/cdeil/orgs","repos_url":"https://api.github.com/users/cdeil/repos","events_url":"https://api.github.com/users/cdeil/events{/privacy}","received_events_url":"https://api.github.com/users/cdeil/received_events","type":"User","site_admin":false},"open_issues":32,"closed_issues":26,"state":"open","created_at":"2013-07-14T16:38:18Z","updated_at":"2015-07-16T07:35:18Z","due_on":"2015-07-27T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/gammapy/gammapy/pulls/299/commits","review_comments_url":"https://api.github.com/repos/gammapy/gammapy/pulls/299/comments","review_comment_url":"https://api.github.com/repos/gammapy/gammapy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gammapy/gammapy/issues/299/comments","statuses_url":"https://api.github.com/repos/gammapy/gammapy/statuses/e908a921e765cf749142f8187cc324baa7513146","head":{"label":"mapazarr:cube-bg-container-class","ref":"cube-bg-container-class","sha":"e908a921e765cf749142f8187cc324baa7513146","user":{"login":"mapazarr","id":11326731,"avatar_url":"https://avatars.githubusercontent.com/u/11326731?v=3","gravatar_id":"","url":"https://api.github.com/users/mapazarr","html_url":"https://github.com/mapazarr","followers_url":"https://api.github.com/users/mapazarr/followers","following_url":"https://api.github.com/users/mapazarr/following{/other_user}","gists_url":"https://api.github.com/users/mapazarr/gists{/gist_id}","starred_url":"https://api.github.com/users/mapazarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapazarr/subscriptions","organizations_url":"https://api.github.com/users/mapazarr/orgs","repos_url":"https://api.github.com/users/mapazarr/repos","events_url":"https://api.github.com/users/mapazarr/events{/privacy}","received_events_url":"https://api.github.com/users/mapazarr/received_events","type":"User","site_admin":false},"repo":{"id":32351501,"name":"gammapy","full_name":"mapazarr/gammapy","owner":{"login":"mapazarr","id":11326731,"avatar_url":"https://avatars.githubusercontent.com/u/11326731?v=3","gravatar_id":"","url":"https://api.github.com/users/mapazarr","html_url":"https://github.com/mapazarr","followers_url":"https://api.github.com/users/mapazarr/followers","following_url":"https://api.github.com/users/mapazarr/following{/other_user}","gists_url":"https://api.github.com/users/mapazarr/gists{/gist_id}","starred_url":"https://api.github.com/users/mapazarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapazarr/subscriptions","organizations_url":"https://api.github.com/users/mapazarr/orgs","repos_url":"https://api.github.com/users/mapazarr/repos","events_url":"https://api.github.com/users/mapazarr/events{/privacy}","received_events_url":"https://api.github.com/users/mapazarr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mapazarr/gammapy","description":"A Python package for gamma-ray astronomy","fork":true,"url":"https://api.github.com/repos/mapazarr/gammapy","forks_url":"https://api.github.com/repos/mapazarr/gammapy/forks","keys_url":"https://api.github.com/repos/mapazarr/gammapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapazarr/gammapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapazarr/gammapy/teams","hooks_url":"https://api.github.com/repos/mapazarr/gammapy/hooks","issue_events_url":"https://api.github.com/repos/mapazarr/gammapy/issues/events{/number}","events_url":"https://api.github.com/repos/mapazarr/gammapy/events","assignees_url":"https://api.github.com/repos/mapazarr/gammapy/assignees{/user}","branches_url":"https://api.github.com/repos/mapazarr/gammapy/branches{/branch}","tags_url":"https://api.github.com/repos/mapazarr/gammapy/tags","blobs_url":"https://api.github.com/repos/mapazarr/gammapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapazarr/gammapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapazarr/gammapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapazarr/gammapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapazarr/gammapy/statuses/{sha}","languages_url":"https://api.github.com/repos/mapazarr/gammapy/languages","stargazers_url":"https://api.github.com/repos/mapazarr/gammapy/stargazers","contributors_url":"https://api.github.com/repos/mapazarr/gammapy/contributors","subscribers_url":"https://api.github.com/repos/mapazarr/gammapy/subscribers","subscription_url":"https://api.github.com/repos/mapazarr/gammapy/subscription","commits_url":"https://api.github.com/repos/mapazarr/gammapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapazarr/gammapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapazarr/gammapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapazarr/gammapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapazarr/gammapy/contents/{+path}","compare_url":"https://api.github.com/repos/mapazarr/gammapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapazarr/gammapy/merges","archive_url":"https://api.github.com/repos/mapazarr/gammapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapazarr/gammapy/downloads","issues_url":"https://api.github.com/repos/mapazarr/gammapy/issues{/number}","pulls_url":"https://api.github.com/repos/mapazarr/gammapy/pulls{/number}","milestones_url":"https://api.github.com/repos/mapazarr/gammapy/milestones{/number}","notifications_url":"https://api.github.com/repos/mapazarr/gammapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapazarr/gammapy/labels{/name}","releases_url":"https://api.github.com/repos/mapazarr/gammapy/releases{/id}","created_at":"2015-03-16T20:36:43Z","updated_at":"2015-04-09T23:35:39Z","pushed_at":"2015-07-20T07:08:26Z","git_url":"git://github.com/mapazarr/gammapy.git","ssh_url":"git@github.com:mapazarr/gammapy.git","clone_url":"https://github.com/mapazarr/gammapy.git","svn_url":"https://github.com/mapazarr/gammapy","homepage":"https://gammapy.readthedocs.org/","size":3182,"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":"gammapy:master","ref":"master","sha":"8117644e466456a572ca09cd5650ba0167f77982","user":{"login":"gammapy","id":852764,"avatar_url":"https://avatars.githubusercontent.com/u/852764?v=3","gravatar_id":"","url":"https://api.github.com/users/gammapy","html_url":"https://github.com/gammapy","followers_url":"https://api.github.com/users/gammapy/followers","following_url":"https://api.github.com/users/gammapy/following{/other_user}","gists_url":"https://api.github.com/users/gammapy/gists{/gist_id}","starred_url":"https://api.github.com/users/gammapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gammapy/subscriptions","organizations_url":"https://api.github.com/users/gammapy/orgs","repos_url":"https://api.github.com/users/gammapy/repos","events_url":"https://api.github.com/users/gammapy/events{/privacy}","received_events_url":"https://api.github.com/users/gammapy/received_events","type":"Organization","site_admin":false},"repo":{"id":10073640,"name":"gammapy","full_name":"gammapy/gammapy","owner":{"login":"gammapy","id":852764,"avatar_url":"https://avatars.githubusercontent.com/u/852764?v=3","gravatar_id":"","url":"https://api.github.com/users/gammapy","html_url":"https://github.com/gammapy","followers_url":"https://api.github.com/users/gammapy/followers","following_url":"https://api.github.com/users/gammapy/following{/other_user}","gists_url":"https://api.github.com/users/gammapy/gists{/gist_id}","starred_url":"https://api.github.com/users/gammapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gammapy/subscriptions","organizations_url":"https://api.github.com/users/gammapy/orgs","repos_url":"https://api.github.com/users/gammapy/repos","events_url":"https://api.github.com/users/gammapy/events{/privacy}","received_events_url":"https://api.github.com/users/gammapy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gammapy/gammapy","description":"A Python package for gamma-ray astronomy","fork":false,"url":"https://api.github.com/repos/gammapy/gammapy","forks_url":"https://api.github.com/repos/gammapy/gammapy/forks","keys_url":"https://api.github.com/repos/gammapy/gammapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gammapy/gammapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gammapy/gammapy/teams","hooks_url":"https://api.github.com/repos/gammapy/gammapy/hooks","issue_events_url":"https://api.github.com/repos/gammapy/gammapy/issues/events{/number}","events_url":"https://api.github.com/repos/gammapy/gammapy/events","assignees_url":"https://api.github.com/repos/gammapy/gammapy/assignees{/user}","branches_url":"https://api.github.com/repos/gammapy/gammapy/branches{/branch}","tags_url":"https://api.github.com/repos/gammapy/gammapy/tags","blobs_url":"https://api.github.com/repos/gammapy/gammapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gammapy/gammapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gammapy/gammapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/gammapy/gammapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gammapy/gammapy/statuses/{sha}","languages_url":"https://api.github.com/repos/gammapy/gammapy/languages","stargazers_url":"https://api.github.com/repos/gammapy/gammapy/stargazers","contributors_url":"https://api.github.com/repos/gammapy/gammapy/contributors","subscribers_url":"https://api.github.com/repos/gammapy/gammapy/subscribers","subscription_url":"https://api.github.com/repos/gammapy/gammapy/subscription","commits_url":"https://api.github.com/repos/gammapy/gammapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/gammapy/gammapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/gammapy/gammapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/gammapy/gammapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/gammapy/gammapy/contents/{+path}","compare_url":"https://api.github.com/repos/gammapy/gammapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gammapy/gammapy/merges","archive_url":"https://api.github.com/repos/gammapy/gammapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gammapy/gammapy/downloads","issues_url":"https://api.github.com/repos/gammapy/gammapy/issues{/number}","pulls_url":"https://api.github.com/repos/gammapy/gammapy/pulls{/number}","milestones_url":"https://api.github.com/repos/gammapy/gammapy/milestones{/number}","notifications_url":"https://api.github.com/repos/gammapy/gammapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gammapy/gammapy/labels{/name}","releases_url":"https://api.github.com/repos/gammapy/gammapy/releases{/id}","created_at":"2013-05-15T07:50:40Z","updated_at":"2015-06-06T13:39:51Z","pushed_at":"2015-07-20T07:08:26Z","git_url":"git://github.com/gammapy/gammapy.git","ssh_url":"git@github.com:gammapy/gammapy.git","clone_url":"https://github.com/gammapy/gammapy.git","svn_url":"https://github.com/gammapy/gammapy","homepage":"https://gammapy.readthedocs.org/","size":5553,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":107,"forks":20,"open_issues":107,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/299"},"html":{"href":"https://github.com/gammapy/gammapy/pull/299"},"issue":{"href":"https://api.github.com/repos/gammapy/gammapy/issues/299"},"comments":{"href":"https://api.github.com/repos/gammapy/gammapy/issues/299/comments"},"review_comments":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/299/comments"},"review_comment":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/299/commits"},"statuses":{"href":"https://api.github.com/repos/gammapy/gammapy/statuses/e908a921e765cf749142f8187cc324baa7513146"}}}}