{"action":"created","comment":{"url":"https://api.github.com/repos/snoplusuk/echidna/pulls/comments/23857432","id":23857432,"diff_hunk":"@@ -0,0 +1,87 @@\n+import ROOT\n+import rat\n+import math\n+import echidna.core.spectra as spectra\n+\n+def _scint_weights(times, T):\n+    \"\"\"This method applies to the scintillator backgrounds.\n+    It produces the list of weights relative to each time period. \n+    The calculation of weights is based on radioactive decay formula.\n+ \n+    Args:\n+      times (*list* of *int*): Time periods \n+      T (float): The Half-life of a studied background\n+\n+    Returns:\n+      Weights (*list* of *float*)\n+    \"\"\"\n+    weights = [0]\n+    for time in times:\n+        weights.append( math.exp(-time/T) )\n+    return (weights)\n+\n+def _av_weights(times, T):\n+    \"\"\"This method applies to the backgrounds due to AV leaching.\n+    It produces the list of weights relative to each time period. \n+    The calculation of weights is based on radioactive decay formula.\n+ \n+    Args:\n+      times (*list* of *int*): Time periods \n+      T (float): The Half-life of a studied background\n+\n+    Returns:\n+      Weights (*list* of *float*)\n+    \"\"\"\n+    weights = [0]\n+    for time in times:\n+        weights.append( 1.0 )\n+    return (weights)\n+\n+def fill_spectrum(filename, spectrumname, T):\n+    \"\"\"This function fills in the ndarray of energies, radii, times \n+    and weights. It takes the reconstructed energies and positions\n+    of the events from the root file. In order to keep the statistics, \n+    the time dependence is performed via adding weights to every event\n+    depending on the time period. Both, studied time and Half-life must \n+    be written in the same units.  \n+    \n+    Args:\n+      filename (str): A root file to study \n+      spectrumname (str): A name of future ndarray \n+      T (float): The Half-life of a studied background\n+\n+      Returns:\n+        spectrum (spectra.Spectra) \n+    \"\"\"\n+    print filename\n+    print spectrumname\n+    spectrum = spectra.Spectra(str(spectrumname))\n+\n+    times = [0]\n+    for time_step in range(0, spectrum._time_bins):\n+        time = time_step * spectrum._time_width + spectrum._time_low \n+        times.append(time)\n+\n+    if 'AV' in spectrumname:\n+        print \"AV WEIGHTS ARE CURRENTLY UNAVAILABLE\"","path":"echidna/core/fill_spectrum.py","position":66,"original_position":66,"commit_id":"726d2e4bdea5cd6a550673412a0c732900678567","original_commit_id":"4971da4ce70048e09d13efe0b4cf46f7158373fa","user":{"login":"arushanova","id":2478616,"avatar_url":"https://avatars.githubusercontent.com/u/2478616?v=3","gravatar_id":"","url":"https://api.github.com/users/arushanova","html_url":"https://github.com/arushanova","followers_url":"https://api.github.com/users/arushanova/followers","following_url":"https://api.github.com/users/arushanova/following{/other_user}","gists_url":"https://api.github.com/users/arushanova/gists{/gist_id}","starred_url":"https://api.github.com/users/arushanova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arushanova/subscriptions","organizations_url":"https://api.github.com/users/arushanova/orgs","repos_url":"https://api.github.com/users/arushanova/repos","events_url":"https://api.github.com/users/arushanova/events{/privacy}","received_events_url":"https://api.github.com/users/arushanova/received_events","type":"User","site_admin":false},"body":"All AV weights are equal to 1, so AV weighting is not applied properly. ","created_at":"2015-01-30T17:32:31Z","updated_at":"2015-01-30T17:32:31Z","html_url":"https://github.com/snoplusuk/echidna/pull/15#discussion_r23857432","pull_request_url":"https://api.github.com/repos/snoplusuk/echidna/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/comments/23857432"},"html":{"href":"https://github.com/snoplusuk/echidna/pull/15#discussion_r23857432"},"pull_request":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/snoplusuk/echidna/pulls/15","id":27852743,"html_url":"https://github.com/snoplusuk/echidna/pull/15","diff_url":"https://github.com/snoplusuk/echidna/pull/15.diff","patch_url":"https://github.com/snoplusuk/echidna/pull/15.patch","issue_url":"https://api.github.com/repos/snoplusuk/echidna/issues/15","number":15,"state":"open","locked":false,"title":"Filling the ndarray","user":{"login":"arushanova","id":2478616,"avatar_url":"https://avatars.githubusercontent.com/u/2478616?v=3","gravatar_id":"","url":"https://api.github.com/users/arushanova","html_url":"https://github.com/arushanova","followers_url":"https://api.github.com/users/arushanova/followers","following_url":"https://api.github.com/users/arushanova/following{/other_user}","gists_url":"https://api.github.com/users/arushanova/gists{/gist_id}","starred_url":"https://api.github.com/users/arushanova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arushanova/subscriptions","organizations_url":"https://api.github.com/users/arushanova/orgs","repos_url":"https://api.github.com/users/arushanova/repos","events_url":"https://api.github.com/users/arushanova/events{/privacy}","received_events_url":"https://api.github.com/users/arushanova/received_events","type":"User","site_admin":false},"body":"Filling the ndarray with reconstructed energy and position from the root file. The time dependence is done via adding weights to the events. ","created_at":"2015-01-22T15:54:01Z","updated_at":"2015-01-30T17:32:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dfd05f60db213c2c985f2ec3d0cfa743cc869104","assignee":{"login":"pgjones","id":1391482,"avatar_url":"https://avatars.githubusercontent.com/u/1391482?v=3","gravatar_id":"","url":"https://api.github.com/users/pgjones","html_url":"https://github.com/pgjones","followers_url":"https://api.github.com/users/pgjones/followers","following_url":"https://api.github.com/users/pgjones/following{/other_user}","gists_url":"https://api.github.com/users/pgjones/gists{/gist_id}","starred_url":"https://api.github.com/users/pgjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgjones/subscriptions","organizations_url":"https://api.github.com/users/pgjones/orgs","repos_url":"https://api.github.com/users/pgjones/repos","events_url":"https://api.github.com/users/pgjones/events{/privacy}","received_events_url":"https://api.github.com/users/pgjones/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/snoplusuk/echidna/milestones/1","labels_url":"https://api.github.com/repos/snoplusuk/echidna/milestones/1/labels","id":843543,"number":1,"title":"Alpha","description":"Must:\r\n - [ ] Load spectra\r\n - [ ] Convolve resolution\r\n - [ ] Set limits ","creator":{"login":"pgjones","id":1391482,"avatar_url":"https://avatars.githubusercontent.com/u/1391482?v=3","gravatar_id":"","url":"https://api.github.com/users/pgjones","html_url":"https://github.com/pgjones","followers_url":"https://api.github.com/users/pgjones/followers","following_url":"https://api.github.com/users/pgjones/following{/other_user}","gists_url":"https://api.github.com/users/pgjones/gists{/gist_id}","starred_url":"https://api.github.com/users/pgjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgjones/subscriptions","organizations_url":"https://api.github.com/users/pgjones/orgs","repos_url":"https://api.github.com/users/pgjones/repos","events_url":"https://api.github.com/users/pgjones/events{/privacy}","received_events_url":"https://api.github.com/users/pgjones/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":1,"state":"open","created_at":"2014-10-28T12:42:11Z","updated_at":"2015-01-30T12:05:57Z","due_on":"2015-01-31T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/snoplusuk/echidna/pulls/15/commits","review_comments_url":"https://api.github.com/repos/snoplusuk/echidna/pulls/15/comments","review_comment_url":"https://api.github.com/repos/snoplusuk/echidna/pulls/comments/{number}","comments_url":"https://api.github.com/repos/snoplusuk/echidna/issues/15/comments","statuses_url":"https://api.github.com/repos/snoplusuk/echidna/statuses/726d2e4bdea5cd6a550673412a0c732900678567","head":{"label":"arushanova:master","ref":"master","sha":"726d2e4bdea5cd6a550673412a0c732900678567","user":{"login":"arushanova","id":2478616,"avatar_url":"https://avatars.githubusercontent.com/u/2478616?v=3","gravatar_id":"","url":"https://api.github.com/users/arushanova","html_url":"https://github.com/arushanova","followers_url":"https://api.github.com/users/arushanova/followers","following_url":"https://api.github.com/users/arushanova/following{/other_user}","gists_url":"https://api.github.com/users/arushanova/gists{/gist_id}","starred_url":"https://api.github.com/users/arushanova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arushanova/subscriptions","organizations_url":"https://api.github.com/users/arushanova/orgs","repos_url":"https://api.github.com/users/arushanova/repos","events_url":"https://api.github.com/users/arushanova/events{/privacy}","received_events_url":"https://api.github.com/users/arushanova/received_events","type":"User","site_admin":false},"repo":{"id":28960501,"name":"echidna","full_name":"arushanova/echidna","owner":{"login":"arushanova","id":2478616,"avatar_url":"https://avatars.githubusercontent.com/u/2478616?v=3","gravatar_id":"","url":"https://api.github.com/users/arushanova","html_url":"https://github.com/arushanova","followers_url":"https://api.github.com/users/arushanova/followers","following_url":"https://api.github.com/users/arushanova/following{/other_user}","gists_url":"https://api.github.com/users/arushanova/gists{/gist_id}","starred_url":"https://api.github.com/users/arushanova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arushanova/subscriptions","organizations_url":"https://api.github.com/users/arushanova/orgs","repos_url":"https://api.github.com/users/arushanova/repos","events_url":"https://api.github.com/users/arushanova/events{/privacy}","received_events_url":"https://api.github.com/users/arushanova/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arushanova/echidna","description":"","fork":true,"url":"https://api.github.com/repos/arushanova/echidna","forks_url":"https://api.github.com/repos/arushanova/echidna/forks","keys_url":"https://api.github.com/repos/arushanova/echidna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arushanova/echidna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arushanova/echidna/teams","hooks_url":"https://api.github.com/repos/arushanova/echidna/hooks","issue_events_url":"https://api.github.com/repos/arushanova/echidna/issues/events{/number}","events_url":"https://api.github.com/repos/arushanova/echidna/events","assignees_url":"https://api.github.com/repos/arushanova/echidna/assignees{/user}","branches_url":"https://api.github.com/repos/arushanova/echidna/branches{/branch}","tags_url":"https://api.github.com/repos/arushanova/echidna/tags","blobs_url":"https://api.github.com/repos/arushanova/echidna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arushanova/echidna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arushanova/echidna/git/refs{/sha}","trees_url":"https://api.github.com/repos/arushanova/echidna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arushanova/echidna/statuses/{sha}","languages_url":"https://api.github.com/repos/arushanova/echidna/languages","stargazers_url":"https://api.github.com/repos/arushanova/echidna/stargazers","contributors_url":"https://api.github.com/repos/arushanova/echidna/contributors","subscribers_url":"https://api.github.com/repos/arushanova/echidna/subscribers","subscription_url":"https://api.github.com/repos/arushanova/echidna/subscription","commits_url":"https://api.github.com/repos/arushanova/echidna/commits{/sha}","git_commits_url":"https://api.github.com/repos/arushanova/echidna/git/commits{/sha}","comments_url":"https://api.github.com/repos/arushanova/echidna/comments{/number}","issue_comment_url":"https://api.github.com/repos/arushanova/echidna/issues/comments/{number}","contents_url":"https://api.github.com/repos/arushanova/echidna/contents/{+path}","compare_url":"https://api.github.com/repos/arushanova/echidna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arushanova/echidna/merges","archive_url":"https://api.github.com/repos/arushanova/echidna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arushanova/echidna/downloads","issues_url":"https://api.github.com/repos/arushanova/echidna/issues{/number}","pulls_url":"https://api.github.com/repos/arushanova/echidna/pulls{/number}","milestones_url":"https://api.github.com/repos/arushanova/echidna/milestones{/number}","notifications_url":"https://api.github.com/repos/arushanova/echidna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arushanova/echidna/labels{/name}","releases_url":"https://api.github.com/repos/arushanova/echidna/releases{/id}","created_at":"2015-01-08T10:18:31Z","updated_at":"2015-01-30T17:29:48Z","pushed_at":"2015-01-30T17:29:48Z","git_url":"git://github.com/arushanova/echidna.git","ssh_url":"git@github.com:arushanova/echidna.git","clone_url":"https://github.com/arushanova/echidna.git","svn_url":"https://github.com/arushanova/echidna","homepage":null,"size":115,"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":"snoplusuk:master","ref":"master","sha":"33e133b984366e188b76413c4b8f5f28c6661f73","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-01-29T13:59:26Z","pushed_at":"2015-01-06T16:38: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":280,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":14,"forks":4,"open_issues":14,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/15"},"html":{"href":"https://github.com/snoplusuk/echidna/pull/15"},"issue":{"href":"https://api.github.com/repos/snoplusuk/echidna/issues/15"},"comments":{"href":"https://api.github.com/repos/snoplusuk/echidna/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/snoplusuk/echidna/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/snoplusuk/echidna/statuses/726d2e4bdea5cd6a550673412a0c732900678567"}}}}