{"action":"created","comment":{"url":"https://api.github.com/repos/gammapy/gammapy/pulls/comments/53569451","id":53569451,"diff_hunk":"@@ -132,6 +137,106 @@ def make_test_array(empty=True):\n     return multi_array\n \n \n+def make_test_array_fillobs(excluded_sources=None, fov_radius=Angle(2.5, \"deg\")):\n+    dir = str(gammapy_extra.dir) + '/datasets/hess-crab4-hd-hap-prod2'\n+    data_store = DataStore.from_dir(dir)\n+    obs_table = data_store.obs_table\n+    multi_array = make_test_array()\n+    multi_array.fill_obs(obs_table, data_store)\n+    return multi_array\n+\n+\n+def make_test_array_oneobs(excluded_sources=None, fov_radius=Angle(2.5, \"deg\")):\n+    dir = str(gammapy_extra.dir) + '/datasets/hess-crab4-hd-hap-prod2'\n+    data_store = DataStore.from_dir(dir)\n+    obs_table = data_store.obs_table\n+    multi_array = make_test_array()\n+    multi_array.fill_obs([obs_table[0]], data_store, excluded_sources, fov_radius)\n+    return multi_array, data_store, obs_table[0]\n+\n+\n+def make_excluded_sources():\n+    centers = SkyCoord([1, 0], [2, 1], unit='deg')\n+    radius = Angle('0.3 deg')\n+    sources = SkyCircleRegion(pos=centers, radius=radius)\n+    catalog = Table()\n+    catalog[\"RA\"] = sources.pos.data.lon\n+    catalog[\"DEC\"] = sources.pos.data.lat\n+    catalog[\"Radius\"] = sources.radius\n+    return catalog\n+\n+\n+def make_source_nextCrab():\n+    center = SkyCoord([84, 89], [23, 20], unit='deg', frame='icrs')\n+    radius = Angle('0.3 deg')\n+    sources = SkyCircleRegion(pos=center, radius=radius)\n+    catalog = Table()\n+    catalog[\"RA\"] = sources.pos.data.lon\n+    catalog[\"DEC\"] = sources.pos.data.lat\n+    catalog[\"Radius\"] = sources.radius\n+    return catalog\n+\n+\n+def test_compute_pie_fraction():\n+    excluded_sources = make_excluded_sources()\n+    pointing_position = SkyCoord(0.5, 0.5, unit='deg')\n+    # Test that if the sources are out of the fov, it gives a pie_fraction equal to zero\n+    pie_fraction = compute_pie_fraction(excluded_sources, pointing_position, Angle(0.3, \"deg\"))\n+    assert_allclose(pie_fraction, 0)\n+\n+    # I have to use an other object excluded_region because the previous one was\n+    # already sorted in the compute_pie_fraction\n+    excluded_sources2 = make_excluded_sources()\n+    source_closest = SkyCoord(excluded_sources2[\"RA\"][1], excluded_sources2[\"DEC\"][1], unit=\"deg\")\n+    separation = pointing_position.separation(source_closest).value\n+    pie_fraction = compute_pie_fraction(excluded_sources, pointing_position, Angle(5, \"deg\"))\n+    pie_fraction_expected = (2 * np.arctan(excluded_sources2[\"Radius\"][1] / separation) / (2 * np.pi))\n+    assert_allclose(pie_fraction, pie_fraction_expected)\n+\n+\n+def test_select_events_outside_pie():","path":"gammapy/background/tests/test_models.py","position":84,"original_position":84,"commit_id":"8f4c1b8542f9dde5ba55fb880a62e5f1f7bb1fda","original_commit_id":"ffc0a29cf2bd2dc0d779ea5e93bd6f9525753731","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":"> Should I move the fits image and the source.reg file in gammapy-extra?\r\n\r\nI don't understand yet ... you're not accessing the image and region file from the test, right?\r\nSo is this image just a check you did on the side, not part of the test committed here?\r\n\r\nIf so, how about putting the image, region file and script you ran in a `gammapy-extra/checks/pacman/` folder?\r\n","created_at":"2016-02-21T17:04:02Z","updated_at":"2016-02-21T17:04:02Z","html_url":"https://github.com/gammapy/gammapy/pull/461#discussion_r53569451","pull_request_url":"https://api.github.com/repos/gammapy/gammapy/pulls/461","_links":{"self":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/comments/53569451"},"html":{"href":"https://github.com/gammapy/gammapy/pull/461#discussion_r53569451"},"pull_request":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/461"}}},"pull_request":{"url":"https://api.github.com/repos/gammapy/gammapy/pulls/461","id":59835306,"html_url":"https://github.com/gammapy/gammapy/pull/461","diff_url":"https://github.com/gammapy/gammapy/pull/461.diff","patch_url":"https://github.com/gammapy/gammapy/pull/461.patch","issue_url":"https://api.github.com/repos/gammapy/gammapy/issues/461","number":461,"state":"open","locked":false,"title":"Pacman","user":{"login":"JouvinLea","id":14295716,"avatar_url":"https://avatars.githubusercontent.com/u/14295716?v=3","gravatar_id":"","url":"https://api.github.com/users/JouvinLea","html_url":"https://github.com/JouvinLea","followers_url":"https://api.github.com/users/JouvinLea/followers","following_url":"https://api.github.com/users/JouvinLea/following{/other_user}","gists_url":"https://api.github.com/users/JouvinLea/gists{/gist_id}","starred_url":"https://api.github.com/users/JouvinLea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JouvinLea/subscriptions","organizations_url":"https://api.github.com/users/JouvinLea/orgs","repos_url":"https://api.github.com/users/JouvinLea/repos","events_url":"https://api.github.com/users/JouvinLea/events{/privacy}","received_events_url":"https://api.github.com/users/JouvinLea/received_events","type":"User","site_admin":false},"body":"This PR implements livetime and counts correction for Background Model production to take into account the presence of agn with the Pacman method.","created_at":"2016-02-18T17:38:02Z","updated_at":"2016-02-21T17:04:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12ea85de92110151fab8bf6a1c726152a085f28c","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":67,"closed_issues":2,"state":"open","created_at":"2015-08-27T09:29:48Z","updated_at":"2016-02-20T20:13:22Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/gammapy/gammapy/pulls/461/commits","review_comments_url":"https://api.github.com/repos/gammapy/gammapy/pulls/461/comments","review_comment_url":"https://api.github.com/repos/gammapy/gammapy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gammapy/gammapy/issues/461/comments","statuses_url":"https://api.github.com/repos/gammapy/gammapy/statuses/8f4c1b8542f9dde5ba55fb880a62e5f1f7bb1fda","head":{"label":"JouvinLea:Packman","ref":"Packman","sha":"8f4c1b8542f9dde5ba55fb880a62e5f1f7bb1fda","user":{"login":"JouvinLea","id":14295716,"avatar_url":"https://avatars.githubusercontent.com/u/14295716?v=3","gravatar_id":"","url":"https://api.github.com/users/JouvinLea","html_url":"https://github.com/JouvinLea","followers_url":"https://api.github.com/users/JouvinLea/followers","following_url":"https://api.github.com/users/JouvinLea/following{/other_user}","gists_url":"https://api.github.com/users/JouvinLea/gists{/gist_id}","starred_url":"https://api.github.com/users/JouvinLea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JouvinLea/subscriptions","organizations_url":"https://api.github.com/users/JouvinLea/orgs","repos_url":"https://api.github.com/users/JouvinLea/repos","events_url":"https://api.github.com/users/JouvinLea/events{/privacy}","received_events_url":"https://api.github.com/users/JouvinLea/received_events","type":"User","site_admin":false},"repo":{"id":46556710,"name":"gammapy","full_name":"JouvinLea/gammapy","owner":{"login":"JouvinLea","id":14295716,"avatar_url":"https://avatars.githubusercontent.com/u/14295716?v=3","gravatar_id":"","url":"https://api.github.com/users/JouvinLea","html_url":"https://github.com/JouvinLea","followers_url":"https://api.github.com/users/JouvinLea/followers","following_url":"https://api.github.com/users/JouvinLea/following{/other_user}","gists_url":"https://api.github.com/users/JouvinLea/gists{/gist_id}","starred_url":"https://api.github.com/users/JouvinLea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JouvinLea/subscriptions","organizations_url":"https://api.github.com/users/JouvinLea/orgs","repos_url":"https://api.github.com/users/JouvinLea/repos","events_url":"https://api.github.com/users/JouvinLea/events{/privacy}","received_events_url":"https://api.github.com/users/JouvinLea/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JouvinLea/gammapy","description":"A Python package for gamma-ray astronomy","fork":true,"url":"https://api.github.com/repos/JouvinLea/gammapy","forks_url":"https://api.github.com/repos/JouvinLea/gammapy/forks","keys_url":"https://api.github.com/repos/JouvinLea/gammapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JouvinLea/gammapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JouvinLea/gammapy/teams","hooks_url":"https://api.github.com/repos/JouvinLea/gammapy/hooks","issue_events_url":"https://api.github.com/repos/JouvinLea/gammapy/issues/events{/number}","events_url":"https://api.github.com/repos/JouvinLea/gammapy/events","assignees_url":"https://api.github.com/repos/JouvinLea/gammapy/assignees{/user}","branches_url":"https://api.github.com/repos/JouvinLea/gammapy/branches{/branch}","tags_url":"https://api.github.com/repos/JouvinLea/gammapy/tags","blobs_url":"https://api.github.com/repos/JouvinLea/gammapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JouvinLea/gammapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JouvinLea/gammapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/JouvinLea/gammapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JouvinLea/gammapy/statuses/{sha}","languages_url":"https://api.github.com/repos/JouvinLea/gammapy/languages","stargazers_url":"https://api.github.com/repos/JouvinLea/gammapy/stargazers","contributors_url":"https://api.github.com/repos/JouvinLea/gammapy/contributors","subscribers_url":"https://api.github.com/repos/JouvinLea/gammapy/subscribers","subscription_url":"https://api.github.com/repos/JouvinLea/gammapy/subscription","commits_url":"https://api.github.com/repos/JouvinLea/gammapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/JouvinLea/gammapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/JouvinLea/gammapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/JouvinLea/gammapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/JouvinLea/gammapy/contents/{+path}","compare_url":"https://api.github.com/repos/JouvinLea/gammapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JouvinLea/gammapy/merges","archive_url":"https://api.github.com/repos/JouvinLea/gammapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JouvinLea/gammapy/downloads","issues_url":"https://api.github.com/repos/JouvinLea/gammapy/issues{/number}","pulls_url":"https://api.github.com/repos/JouvinLea/gammapy/pulls{/number}","milestones_url":"https://api.github.com/repos/JouvinLea/gammapy/milestones{/number}","notifications_url":"https://api.github.com/repos/JouvinLea/gammapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JouvinLea/gammapy/labels{/name}","releases_url":"https://api.github.com/repos/JouvinLea/gammapy/releases{/id}","deployments_url":"https://api.github.com/repos/JouvinLea/gammapy/deployments","created_at":"2015-11-20T10:54:35Z","updated_at":"2015-11-20T10:54:37Z","pushed_at":"2016-02-21T16:50:40Z","git_url":"git://github.com/JouvinLea/gammapy.git","ssh_url":"git@github.com:JouvinLea/gammapy.git","clone_url":"https://github.com/JouvinLea/gammapy.git","svn_url":"https://github.com/JouvinLea/gammapy","homepage":"https://gammapy.readthedocs.org/","size":4951,"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":"7d183040d594b53fc383e75ac81eb8a583b47f7a","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-02-15T13:43:23Z","pushed_at":"2016-02-21T16:50:40Z","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":5292,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":140,"forks":34,"open_issues":140,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/461"},"html":{"href":"https://github.com/gammapy/gammapy/pull/461"},"issue":{"href":"https://api.github.com/repos/gammapy/gammapy/issues/461"},"comments":{"href":"https://api.github.com/repos/gammapy/gammapy/issues/461/comments"},"review_comments":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/461/comments"},"review_comment":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gammapy/gammapy/pulls/461/commits"},"statuses":{"href":"https://api.github.com/repos/gammapy/gammapy/statuses/8f4c1b8542f9dde5ba55fb880a62e5f1f7bb1fda"}}}}