{"action":"created","comment":{"url":"https://api.github.com/repos/snoplusuk/echidna/pulls/comments/35865026","id":35865026,"diff_hunk":"@@ -389,3 +389,32 @@ def weight_gaussian_radius_spectra(self, true_spectrum, num_sigma=5.):\n                         i += 1\n         smeared_spectrum._raw_events = raw_events\n         return smeared_spectrum\n+\n+\n+class EResSmear(Smear):\n+    \"\"\" Allows you to smear directly by energy resolution (e.g. 0.05 * E)\n+\n+    Inherits from :class:`Smear` to provide exactly the same functionality\n+    but overrides :meth:`Smear.get_energy_sigma` to use an energy \n+    resolution to calculate sigma.\n+\n+    Attributes:\n+      _light_yield (float): Number of PMT hits expected for a\n+        MeV energy deposit in NHit/MeV\n+      _energy_resolution (float): energy resolution e.g. 0.05 for 5%. \n+      _position_resolution (float): Sigma in mm\n+    \"\"\"\n+    def __init__(self, energy_resolution):\n+        super(EResSmear, self).__init__()\n+        self._energy_resolution = energy_resolution\n+\n+    def get_energy_sigma(self, energy):\n+        \"\"\" Calculates sigma at a given energy.\n+\n+        Args:\n+          energy (float): Energy value of data point(s)\n+\n+        Returns:\n+          float. Sigma equivalent to energy * energy_resolution\n+        \"\"\"\n+        return energy * self._energy_resolution","path":"echidna/core/smear.py","position":32,"original_position":32,"commit_id":"b4f85612e7f750939cad2ab5c7e38bf91c27bbab","original_commit_id":"b4f85612e7f750939cad2ab5c7e38bf91c27bbab","user":{"login":"ashleyrback","id":1931666,"avatar_url":"https://avatars.githubusercontent.com/u/1931666?v=3","gravatar_id":"","url":"https://api.github.com/users/ashleyrback","html_url":"https://github.com/ashleyrback","followers_url":"https://api.github.com/users/ashleyrback/followers","following_url":"https://api.github.com/users/ashleyrback/following{/other_user}","gists_url":"https://api.github.com/users/ashleyrback/gists{/gist_id}","starred_url":"https://api.github.com/users/ashleyrback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashleyrback/subscriptions","organizations_url":"https://api.github.com/users/ashleyrback/orgs","repos_url":"https://api.github.com/users/ashleyrback/repos","events_url":"https://api.github.com/users/ashleyrback/events{/privacy}","received_events_url":"https://api.github.com/users/ashleyrback/received_events","type":"User","site_admin":false},"body":"I think there are definitely some pep8 changes to be made. Also hold off on merging for the moment anyway as the Xe136 simulations I converted to truth spectra using this code, don't have the values for `_num_decays` that I was expecting, so I'm going to try and solve this before merging. ","created_at":"2015-07-30T12:26:32Z","updated_at":"2015-07-30T12:26:32Z","html_url":"https://github.com/snoplusuk/echidna/pull/74#discussion_r35865026","pull_request_url":"https://api.github.com/repos/snoplusuk/echidna/pulls/74","_links":{"self":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/comments/35865026"},"html":{"href":"https://github.com/snoplusuk/echidna/pull/74#discussion_r35865026"},"pull_request":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/74"}}},"pull_request":{"url":"https://api.github.com/repos/snoplusuk/echidna/pulls/74","id":41128433,"html_url":"https://github.com/snoplusuk/echidna/pull/74","diff_url":"https://github.com/snoplusuk/echidna/pull/74.diff","patch_url":"https://github.com/snoplusuk/echidna/pull/74.patch","issue_url":"https://api.github.com/repos/snoplusuk/echidna/issues/74","number":74,"state":"open","locked":false,"title":"Truth spectra","user":{"login":"ashleyrback","id":1931666,"avatar_url":"https://avatars.githubusercontent.com/u/1931666?v=3","gravatar_id":"","url":"https://api.github.com/users/ashleyrback","html_url":"https://github.com/ashleyrback","followers_url":"https://api.github.com/users/ashleyrback/followers","following_url":"https://api.github.com/users/ashleyrback/following{/other_user}","gists_url":"https://api.github.com/users/ashleyrback/gists{/gist_id}","starred_url":"https://api.github.com/users/ashleyrback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashleyrback/subscriptions","organizations_url":"https://api.github.com/users/ashleyrback/orgs","repos_url":"https://api.github.com/users/ashleyrback/repos","events_url":"https://api.github.com/users/ashleyrback/events{/privacy}","received_events_url":"https://api.github.com/users/ashleyrback/received_events","type":"User","site_admin":false},"body":"Adds methods (both root and ntuple) to `fill_spectrum` to produce truth (non-quenched) spectra.\r\n\r\nAlso modifies `dump_spectra_ntuple`, `dump_spectra_root` and`multi_ntuple_spectrum` so that the truth spectrum is produced by default, along with the existing mc and reco spectra.\r\n\r\nFinally adds to `smear` module the functionality to smear directly by energy resolution. This is mainly useful for comparisons with other experiments e.g. KamLAND-Zen where NHit per MeV is unknown or not defined, but actual resolution as a percentage is known.","created_at":"2015-07-29T14:20:27Z","updated_at":"2015-07-30T12:26:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b32a559543be6348530cd1a0f7505edf19b7d01","assignee":{"login":"jwaterfield","id":1927874,"avatar_url":"https://avatars.githubusercontent.com/u/1927874?v=3","gravatar_id":"","url":"https://api.github.com/users/jwaterfield","html_url":"https://github.com/jwaterfield","followers_url":"https://api.github.com/users/jwaterfield/followers","following_url":"https://api.github.com/users/jwaterfield/following{/other_user}","gists_url":"https://api.github.com/users/jwaterfield/gists{/gist_id}","starred_url":"https://api.github.com/users/jwaterfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwaterfield/subscriptions","organizations_url":"https://api.github.com/users/jwaterfield/orgs","repos_url":"https://api.github.com/users/jwaterfield/repos","events_url":"https://api.github.com/users/jwaterfield/events{/privacy}","received_events_url":"https://api.github.com/users/jwaterfield/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/snoplusuk/echidna/pulls/74/commits","review_comments_url":"https://api.github.com/repos/snoplusuk/echidna/pulls/74/comments","review_comment_url":"https://api.github.com/repos/snoplusuk/echidna/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snoplusuk/echidna/issues/74/comments","statuses_url":"https://api.github.com/repos/snoplusuk/echidna/statuses/b4f85612e7f750939cad2ab5c7e38bf91c27bbab","head":{"label":"ashleyrback:truth_spectra","ref":"truth_spectra","sha":"b4f85612e7f750939cad2ab5c7e38bf91c27bbab","user":{"login":"ashleyrback","id":1931666,"avatar_url":"https://avatars.githubusercontent.com/u/1931666?v=3","gravatar_id":"","url":"https://api.github.com/users/ashleyrback","html_url":"https://github.com/ashleyrback","followers_url":"https://api.github.com/users/ashleyrback/followers","following_url":"https://api.github.com/users/ashleyrback/following{/other_user}","gists_url":"https://api.github.com/users/ashleyrback/gists{/gist_id}","starred_url":"https://api.github.com/users/ashleyrback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashleyrback/subscriptions","organizations_url":"https://api.github.com/users/ashleyrback/orgs","repos_url":"https://api.github.com/users/ashleyrback/repos","events_url":"https://api.github.com/users/ashleyrback/events{/privacy}","received_events_url":"https://api.github.com/users/ashleyrback/received_events","type":"User","site_admin":false},"repo":{"id":26441505,"name":"echidna","full_name":"ashleyrback/echidna","owner":{"login":"ashleyrback","id":1931666,"avatar_url":"https://avatars.githubusercontent.com/u/1931666?v=3","gravatar_id":"","url":"https://api.github.com/users/ashleyrback","html_url":"https://github.com/ashleyrback","followers_url":"https://api.github.com/users/ashleyrback/followers","following_url":"https://api.github.com/users/ashleyrback/following{/other_user}","gists_url":"https://api.github.com/users/ashleyrback/gists{/gist_id}","starred_url":"https://api.github.com/users/ashleyrback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashleyrback/subscriptions","organizations_url":"https://api.github.com/users/ashleyrback/orgs","repos_url":"https://api.github.com/users/ashleyrback/repos","events_url":"https://api.github.com/users/ashleyrback/events{/privacy}","received_events_url":"https://api.github.com/users/ashleyrback/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ashleyrback/echidna","description":"","fork":true,"url":"https://api.github.com/repos/ashleyrback/echidna","forks_url":"https://api.github.com/repos/ashleyrback/echidna/forks","keys_url":"https://api.github.com/repos/ashleyrback/echidna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ashleyrback/echidna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ashleyrback/echidna/teams","hooks_url":"https://api.github.com/repos/ashleyrback/echidna/hooks","issue_events_url":"https://api.github.com/repos/ashleyrback/echidna/issues/events{/number}","events_url":"https://api.github.com/repos/ashleyrback/echidna/events","assignees_url":"https://api.github.com/repos/ashleyrback/echidna/assignees{/user}","branches_url":"https://api.github.com/repos/ashleyrback/echidna/branches{/branch}","tags_url":"https://api.github.com/repos/ashleyrback/echidna/tags","blobs_url":"https://api.github.com/repos/ashleyrback/echidna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ashleyrback/echidna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ashleyrback/echidna/git/refs{/sha}","trees_url":"https://api.github.com/repos/ashleyrback/echidna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ashleyrback/echidna/statuses/{sha}","languages_url":"https://api.github.com/repos/ashleyrback/echidna/languages","stargazers_url":"https://api.github.com/repos/ashleyrback/echidna/stargazers","contributors_url":"https://api.github.com/repos/ashleyrback/echidna/contributors","subscribers_url":"https://api.github.com/repos/ashleyrback/echidna/subscribers","subscription_url":"https://api.github.com/repos/ashleyrback/echidna/subscription","commits_url":"https://api.github.com/repos/ashleyrback/echidna/commits{/sha}","git_commits_url":"https://api.github.com/repos/ashleyrback/echidna/git/commits{/sha}","comments_url":"https://api.github.com/repos/ashleyrback/echidna/comments{/number}","issue_comment_url":"https://api.github.com/repos/ashleyrback/echidna/issues/comments{/number}","contents_url":"https://api.github.com/repos/ashleyrback/echidna/contents/{+path}","compare_url":"https://api.github.com/repos/ashleyrback/echidna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ashleyrback/echidna/merges","archive_url":"https://api.github.com/repos/ashleyrback/echidna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ashleyrback/echidna/downloads","issues_url":"https://api.github.com/repos/ashleyrback/echidna/issues{/number}","pulls_url":"https://api.github.com/repos/ashleyrback/echidna/pulls{/number}","milestones_url":"https://api.github.com/repos/ashleyrback/echidna/milestones{/number}","notifications_url":"https://api.github.com/repos/ashleyrback/echidna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ashleyrback/echidna/labels{/name}","releases_url":"https://api.github.com/repos/ashleyrback/echidna/releases{/id}","created_at":"2014-11-10T15:09:35Z","updated_at":"2015-04-16T17:56:56Z","pushed_at":"2015-07-29T14:39:02Z","git_url":"git://github.com/ashleyrback/echidna.git","ssh_url":"git@github.com:ashleyrback/echidna.git","clone_url":"https://github.com/ashleyrback/echidna.git","svn_url":"https://github.com/ashleyrback/echidna","homepage":null,"size":549,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"snoplusuk:master","ref":"master","sha":"61b4ab653fb6728a2ee88c970729205cc5e24d25","user":{"login":"snoplusuk","id":9432162,"avatar_url":"https://avatars.githubusercontent.com/u/9432162?v=3","gravatar_id":"","url":"https://api.github.com/users/snoplusuk","html_url":"https://github.com/snoplusuk","followers_url":"https://api.github.com/users/snoplusuk/followers","following_url":"https://api.github.com/users/snoplusuk/following{/other_user}","gists_url":"https://api.github.com/users/snoplusuk/gists{/gist_id}","starred_url":"https://api.github.com/users/snoplusuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoplusuk/subscriptions","organizations_url":"https://api.github.com/users/snoplusuk/orgs","repos_url":"https://api.github.com/users/snoplusuk/repos","events_url":"https://api.github.com/users/snoplusuk/events{/privacy}","received_events_url":"https://api.github.com/users/snoplusuk/received_events","type":"Organization","site_admin":false},"repo":{"id":25868677,"name":"echidna","full_name":"snoplusuk/echidna","owner":{"login":"snoplusuk","id":9432162,"avatar_url":"https://avatars.githubusercontent.com/u/9432162?v=3","gravatar_id":"","url":"https://api.github.com/users/snoplusuk","html_url":"https://github.com/snoplusuk","followers_url":"https://api.github.com/users/snoplusuk/followers","following_url":"https://api.github.com/users/snoplusuk/following{/other_user}","gists_url":"https://api.github.com/users/snoplusuk/gists{/gist_id}","starred_url":"https://api.github.com/users/snoplusuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoplusuk/subscriptions","organizations_url":"https://api.github.com/users/snoplusuk/orgs","repos_url":"https://api.github.com/users/snoplusuk/repos","events_url":"https://api.github.com/users/snoplusuk/events{/privacy}","received_events_url":"https://api.github.com/users/snoplusuk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/snoplusuk/echidna","description":"","fork":false,"url":"https://api.github.com/repos/snoplusuk/echidna","forks_url":"https://api.github.com/repos/snoplusuk/echidna/forks","keys_url":"https://api.github.com/repos/snoplusuk/echidna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snoplusuk/echidna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snoplusuk/echidna/teams","hooks_url":"https://api.github.com/repos/snoplusuk/echidna/hooks","issue_events_url":"https://api.github.com/repos/snoplusuk/echidna/issues/events{/number}","events_url":"https://api.github.com/repos/snoplusuk/echidna/events","assignees_url":"https://api.github.com/repos/snoplusuk/echidna/assignees{/user}","branches_url":"https://api.github.com/repos/snoplusuk/echidna/branches{/branch}","tags_url":"https://api.github.com/repos/snoplusuk/echidna/tags","blobs_url":"https://api.github.com/repos/snoplusuk/echidna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snoplusuk/echidna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snoplusuk/echidna/git/refs{/sha}","trees_url":"https://api.github.com/repos/snoplusuk/echidna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snoplusuk/echidna/statuses/{sha}","languages_url":"https://api.github.com/repos/snoplusuk/echidna/languages","stargazers_url":"https://api.github.com/repos/snoplusuk/echidna/stargazers","contributors_url":"https://api.github.com/repos/snoplusuk/echidna/contributors","subscribers_url":"https://api.github.com/repos/snoplusuk/echidna/subscribers","subscription_url":"https://api.github.com/repos/snoplusuk/echidna/subscription","commits_url":"https://api.github.com/repos/snoplusuk/echidna/commits{/sha}","git_commits_url":"https://api.github.com/repos/snoplusuk/echidna/git/commits{/sha}","comments_url":"https://api.github.com/repos/snoplusuk/echidna/comments{/number}","issue_comment_url":"https://api.github.com/repos/snoplusuk/echidna/issues/comments{/number}","contents_url":"https://api.github.com/repos/snoplusuk/echidna/contents/{+path}","compare_url":"https://api.github.com/repos/snoplusuk/echidna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snoplusuk/echidna/merges","archive_url":"https://api.github.com/repos/snoplusuk/echidna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snoplusuk/echidna/downloads","issues_url":"https://api.github.com/repos/snoplusuk/echidna/issues{/number}","pulls_url":"https://api.github.com/repos/snoplusuk/echidna/pulls{/number}","milestones_url":"https://api.github.com/repos/snoplusuk/echidna/milestones{/number}","notifications_url":"https://api.github.com/repos/snoplusuk/echidna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snoplusuk/echidna/labels{/name}","releases_url":"https://api.github.com/repos/snoplusuk/echidna/releases{/id}","created_at":"2014-10-28T12:40:38Z","updated_at":"2015-06-25T12:50:34Z","pushed_at":"2015-07-30T10:34:29Z","git_url":"git://github.com/snoplusuk/echidna.git","ssh_url":"git@github.com:snoplusuk/echidna.git","clone_url":"https://github.com/snoplusuk/echidna.git","svn_url":"https://github.com/snoplusuk/echidna","homepage":null,"size":1452,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":9,"forks":9,"open_issues":9,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/74"},"html":{"href":"https://github.com/snoplusuk/echidna/pull/74"},"issue":{"href":"https://api.github.com/repos/snoplusuk/echidna/issues/74"},"comments":{"href":"https://api.github.com/repos/snoplusuk/echidna/issues/74/comments"},"review_comments":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/74/comments"},"review_comment":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/74/commits"},"statuses":{"href":"https://api.github.com/repos/snoplusuk/echidna/statuses/b4f85612e7f750939cad2ab5c7e38bf91c27bbab"}}}}