{"action":"created","comment":{"url":"https://api.github.com/repos/gammapy/gammapy/pulls/comments/66777472","id":66777472,"diff_hunk":"@@ -0,0 +1,71 @@\n+# Licensed under a 3-clause BSD style license - see LICENSE.rst\n+from __future__ import absolute_import, division, print_function, unicode_literals\n+from numpy.testing import assert_allclose\n+from astropy.tests.helper import pytest\n+from astropy.coordinates import SkyCoord\n+import astropy.units as u\n+from ...data import DataStore, ObservationList, ObservationStats, Target\n+from ...utils.testing import requires_data\n+from ...extern.regions.shapes import CircleSkyRegion\n+from ...background import reflected_regions_background_estimate as refl\n+from ...image import ExclusionMask\n+\n+\n+@requires_data('gammapy-extra')\n+def get_obs_list():\n+    data_store = DataStore.from_dir(\n+        '$GAMMAPY_EXTRA/datasets/hess-crab4-hd-hap-prod2/')\n+    run_list = [23523, 23526]\n+    obs_list = ObservationList([data_store.obs(_) for _ in run_list])\n+    return obs_list\n+\n+\n+@requires_data('gammapy-extra')\n+def get_obs(id):\n+    obs_list = get_obs_list()\n+    for run in obs_list:\n+        if run.obs_id == id:\n+            return run\n+\n+\n+def get_target():","path":"gammapy/data/tests/test_observation_stats.py","position":31,"original_position":31,"commit_id":"b406185c775ff20f28880e51f85d04f3755f96ce","original_commit_id":"b406185c775ff20f28880e51f85d04f3755f96ce","user":{"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},"body":"Making this a pytest fixture would be a bit better.\r\nhttps://github.com/jiffyclub/pytest-features#fixtures\r\n\r\nI.e. put this here:\r\n```python\r\n@pytest.fixture\r\ndef target():\r\n    ... same as what you have now ...\r\n```\r\n\r\nand then inject `target` objects into the tests that use it, i.e. below:\r\n```python\r\ndef test_str(target):\r\n```\r\n\r\nAt the moment we're not using fixtures a lot in Gammapy tests, but this is something that we'll gradually clean up ... almost always input test data will be injected into tests via fixtures.","created_at":"2016-06-13T11:37:33Z","updated_at":"2016-06-13T11:37:33Z","html_url":"https://github.com/gammapy/gammapy/pull/569#discussion_r66777472","pull_request_url":"https://api.github.com/repos/gammapy/gammapy/pulls/569","_links":{"self":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/comments/66777472"},"html":{"href":"https://github.com/gammapy/gammapy/pull/569#discussion_r66777472"},"pull_request":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/569"}}},"pull_request":{"url":"https://api.github.com/repos/gammapy/gammapy/pulls/569","id":73218117,"html_url":"https://github.com/gammapy/gammapy/pull/569","diff_url":"https://github.com/gammapy/gammapy/pull/569.diff","patch_url":"https://github.com/gammapy/gammapy/pull/569.patch","issue_url":"https://api.github.com/repos/gammapy/gammapy/issues/569","number":569,"state":"open","locked":false,"title":"Add detection utilities à la BgStats","user":{"login":"jjlk","id":15717586,"avatar_url":"https://avatars.githubusercontent.com/u/15717586?v=3","gravatar_id":"","url":"https://api.github.com/users/jjlk","html_url":"https://github.com/jjlk","followers_url":"https://api.github.com/users/jjlk/followers","following_url":"https://api.github.com/users/jjlk/following{/other_user}","gists_url":"https://api.github.com/users/jjlk/gists{/gist_id}","starred_url":"https://api.github.com/users/jjlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjlk/subscriptions","organizations_url":"https://api.github.com/users/jjlk/orgs","repos_url":"https://api.github.com/users/jjlk/repos","events_url":"https://api.github.com/users/jjlk/events{/privacy}","received_events_url":"https://api.github.com/users/jjlk/received_events","type":"User","site_admin":false},"body":"Hi @cdeil @joleroi , \r\nI added a new class called ObservationStats in order to get statistics from an observation. The test functions are also here.\r\n\r\n\r\nJulien\r\n","created_at":"2016-06-09T13:56:14Z","updated_at":"2016-06-13T11:37:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c04c89d2e8824cafaeace9ed662778fb8c0f5b8","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/7","html_url":"https://github.com/gammapy/gammapy/milestones/0.5","labels_url":"https://api.github.com/repos/gammapy/gammapy/milestones/7/labels","id":1275561,"number":7,"title":"0.5","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":86,"closed_issues":43,"state":"open","created_at":"2015-08-27T09:29:48Z","updated_at":"2016-06-13T11:26:27Z","due_on":"2016-07-06T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/gammapy/gammapy/pulls/569/commits","review_comments_url":"https://api.github.com/repos/gammapy/gammapy/pulls/569/comments","review_comment_url":"https://api.github.com/repos/gammapy/gammapy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gammapy/gammapy/issues/569/comments","statuses_url":"https://api.github.com/repos/gammapy/gammapy/statuses/b406185c775ff20f28880e51f85d04f3755f96ce","head":{"label":"jjlk:bgstats","ref":"bgstats","sha":"b406185c775ff20f28880e51f85d04f3755f96ce","user":{"login":"jjlk","id":15717586,"avatar_url":"https://avatars.githubusercontent.com/u/15717586?v=3","gravatar_id":"","url":"https://api.github.com/users/jjlk","html_url":"https://github.com/jjlk","followers_url":"https://api.github.com/users/jjlk/followers","following_url":"https://api.github.com/users/jjlk/following{/other_user}","gists_url":"https://api.github.com/users/jjlk/gists{/gist_id}","starred_url":"https://api.github.com/users/jjlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjlk/subscriptions","organizations_url":"https://api.github.com/users/jjlk/orgs","repos_url":"https://api.github.com/users/jjlk/repos","events_url":"https://api.github.com/users/jjlk/events{/privacy}","received_events_url":"https://api.github.com/users/jjlk/received_events","type":"User","site_admin":false},"repo":{"id":58368653,"name":"gammapy","full_name":"jjlk/gammapy","owner":{"login":"jjlk","id":15717586,"avatar_url":"https://avatars.githubusercontent.com/u/15717586?v=3","gravatar_id":"","url":"https://api.github.com/users/jjlk","html_url":"https://github.com/jjlk","followers_url":"https://api.github.com/users/jjlk/followers","following_url":"https://api.github.com/users/jjlk/following{/other_user}","gists_url":"https://api.github.com/users/jjlk/gists{/gist_id}","starred_url":"https://api.github.com/users/jjlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjlk/subscriptions","organizations_url":"https://api.github.com/users/jjlk/orgs","repos_url":"https://api.github.com/users/jjlk/repos","events_url":"https://api.github.com/users/jjlk/events{/privacy}","received_events_url":"https://api.github.com/users/jjlk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jjlk/gammapy","description":"A Python package for gamma-ray astronomy","fork":true,"url":"https://api.github.com/repos/jjlk/gammapy","forks_url":"https://api.github.com/repos/jjlk/gammapy/forks","keys_url":"https://api.github.com/repos/jjlk/gammapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jjlk/gammapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jjlk/gammapy/teams","hooks_url":"https://api.github.com/repos/jjlk/gammapy/hooks","issue_events_url":"https://api.github.com/repos/jjlk/gammapy/issues/events{/number}","events_url":"https://api.github.com/repos/jjlk/gammapy/events","assignees_url":"https://api.github.com/repos/jjlk/gammapy/assignees{/user}","branches_url":"https://api.github.com/repos/jjlk/gammapy/branches{/branch}","tags_url":"https://api.github.com/repos/jjlk/gammapy/tags","blobs_url":"https://api.github.com/repos/jjlk/gammapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jjlk/gammapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jjlk/gammapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/jjlk/gammapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jjlk/gammapy/statuses/{sha}","languages_url":"https://api.github.com/repos/jjlk/gammapy/languages","stargazers_url":"https://api.github.com/repos/jjlk/gammapy/stargazers","contributors_url":"https://api.github.com/repos/jjlk/gammapy/contributors","subscribers_url":"https://api.github.com/repos/jjlk/gammapy/subscribers","subscription_url":"https://api.github.com/repos/jjlk/gammapy/subscription","commits_url":"https://api.github.com/repos/jjlk/gammapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/jjlk/gammapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/jjlk/gammapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/jjlk/gammapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/jjlk/gammapy/contents/{+path}","compare_url":"https://api.github.com/repos/jjlk/gammapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jjlk/gammapy/merges","archive_url":"https://api.github.com/repos/jjlk/gammapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jjlk/gammapy/downloads","issues_url":"https://api.github.com/repos/jjlk/gammapy/issues{/number}","pulls_url":"https://api.github.com/repos/jjlk/gammapy/pulls{/number}","milestones_url":"https://api.github.com/repos/jjlk/gammapy/milestones{/number}","notifications_url":"https://api.github.com/repos/jjlk/gammapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jjlk/gammapy/labels{/name}","releases_url":"https://api.github.com/repos/jjlk/gammapy/releases{/id}","deployments_url":"https://api.github.com/repos/jjlk/gammapy/deployments","created_at":"2016-05-09T10:30:58Z","updated_at":"2016-05-09T10:31:00Z","pushed_at":"2016-06-13T10:56:09Z","git_url":"git://github.com/jjlk/gammapy.git","ssh_url":"git@github.com:jjlk/gammapy.git","clone_url":"https://github.com/jjlk/gammapy.git","svn_url":"https://github.com/jjlk/gammapy","homepage":"https://gammapy.readthedocs.org/","size":5837,"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":"c6908662c4d98380b9e32b701864d5daafb1601e","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}","deployments_url":"https://api.github.com/repos/gammapy/gammapy/deployments","created_at":"2013-05-15T07:50:40Z","updated_at":"2016-04-21T13:35:29Z","pushed_at":"2016-06-13T10:56:10Z","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":6515,"stargazers_count":22,"watchers_count":22,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":150,"forks":42,"open_issues":150,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/569"},"html":{"href":"https://github.com/gammapy/gammapy/pull/569"},"issue":{"href":"https://api.github.com/repos/gammapy/gammapy/issues/569"},"comments":{"href":"https://api.github.com/repos/gammapy/gammapy/issues/569/comments"},"review_comments":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/569/comments"},"review_comment":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/569/commits"},"statuses":{"href":"https://api.github.com/repos/gammapy/gammapy/statuses/b406185c775ff20f28880e51f85d04f3755f96ce"}}}}
{"actor":{"display_login":"cdeil"}}