{"action":"created","comment":{"url":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/comments/62891118","id":62891118,"diff_hunk":"@@ -0,0 +1,64 @@\n+from __future__ import print_function, absolute_import, division\n+\n+from .behavior_tree import BehaviorTree\n+from mousestyles.behavior import metrics\n+\n+\n+def process_raw_intervals(consumption, intervals, active_time,\n+                          total_time, epsilon):\n+    \"\"\"\n+    Takes `total_consumption` and the data in `intervals` and\n+    decomposes it into a tree of behavioral summary statistics.\n+\n+    Parameters\n+    ----------\n+    consumption: float\n+        total consumption (food, water, or movement) in the time period\n+    intervals: Intervals\n+        Intervals object representing intervals of behavior\n+    epsilon: float\n+        tolerance for merging events into bouts\n+\n+    Returns\n+    -------\n+    behavior : BehaviorTree\n+        dictionary-like object representing breakdown of\n+        consumption into various nodes\n+\n+    Examples\n+    --------\n+    >>> from mousestyles import data, intervals\n+    >>> ints = intervals.Intervals(data.load_intervals('AS'))\n+    >>> results = process_raw_intervals(1000, ints, 1)\n+    \"\"\"\n+    tree = BehaviorTree(['Consumption',\n+                         ['AS Prob',\n+                          ['Intensity',\n+                           ['Bout Rate',\n+                            ['Bout Size',\n+                             ['Bout Duration',\n+                              ['Bout Intensity',\n+                               ['Bout Event Rate',\n+                                'Event Size']]]]]]]])\n+    bout_intervals = metrics.create_collapsed_intervals(intervals, epsilon)\n+    as_probability = active_time / total_time\n+    tree['Consumption'] = consumption","path":"mousestyles/behavior/construct_trees.py","position":45,"original_position":45,"commit_id":"b660f00090996d336ccd036d0e5aa9be3f155315","original_commit_id":"b660f00090996d336ccd036d0e5aa9be3f155315","user":{"login":"peterasujan","id":3139511,"avatar_url":"https://avatars.githubusercontent.com/u/3139511?v=3","gravatar_id":"","url":"https://api.github.com/users/peterasujan","html_url":"https://github.com/peterasujan","followers_url":"https://api.github.com/users/peterasujan/followers","following_url":"https://api.github.com/users/peterasujan/following{/other_user}","gists_url":"https://api.github.com/users/peterasujan/gists{/gist_id}","starred_url":"https://api.github.com/users/peterasujan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterasujan/subscriptions","organizations_url":"https://api.github.com/users/peterasujan/orgs","repos_url":"https://api.github.com/users/peterasujan/repos","events_url":"https://api.github.com/users/peterasujan/events{/privacy}","received_events_url":"https://api.github.com/users/peterasujan/received_events","type":"User","site_admin":false},"body":"Thanks for this feedback @dylandaniels! I'll push these fixes in a few minutes.","created_at":"2016-05-11T17:32:55Z","updated_at":"2016-05-11T17:32:55Z","html_url":"https://github.com/berkeley-stat222/mousestyles/pull/136#discussion_r62891118","pull_request_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/136","_links":{"self":{"href":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/comments/62891118"},"html":{"href":"https://github.com/berkeley-stat222/mousestyles/pull/136#discussion_r62891118"},"pull_request":{"href":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/136"}}},"pull_request":{"url":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/136","id":68291232,"html_url":"https://github.com/berkeley-stat222/mousestyles/pull/136","diff_url":"https://github.com/berkeley-stat222/mousestyles/pull/136.diff","patch_url":"https://github.com/berkeley-stat222/mousestyles/pull/136.patch","issue_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/issues/136","number":136,"state":"open","locked":false,"title":"WIP: Behavior subproject","user":{"login":"dylandaniels","id":1553821,"avatar_url":"https://avatars.githubusercontent.com/u/1553821?v=3","gravatar_id":"","url":"https://api.github.com/users/dylandaniels","html_url":"https://github.com/dylandaniels","followers_url":"https://api.github.com/users/dylandaniels/followers","following_url":"https://api.github.com/users/dylandaniels/following{/other_user}","gists_url":"https://api.github.com/users/dylandaniels/gists{/gist_id}","starred_url":"https://api.github.com/users/dylandaniels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylandaniels/subscriptions","organizations_url":"https://api.github.com/users/dylandaniels/orgs","repos_url":"https://api.github.com/users/dylandaniels/repos","events_url":"https://api.github.com/users/dylandaniels/events{/privacy}","received_events_url":"https://api.github.com/users/dylandaniels/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-28T21:11:02Z","updated_at":"2016-05-11T17:32:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f38e9f83f6e36dbd90970c4fdf9f81d52523f603","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/136/commits","review_comments_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/136/comments","review_comment_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/comments{/number}","comments_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/issues/136/comments","statuses_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/statuses/b660f00090996d336ccd036d0e5aa9be3f155315","head":{"label":"dylandaniels:behavior","ref":"behavior","sha":"b660f00090996d336ccd036d0e5aa9be3f155315","user":{"login":"dylandaniels","id":1553821,"avatar_url":"https://avatars.githubusercontent.com/u/1553821?v=3","gravatar_id":"","url":"https://api.github.com/users/dylandaniels","html_url":"https://github.com/dylandaniels","followers_url":"https://api.github.com/users/dylandaniels/followers","following_url":"https://api.github.com/users/dylandaniels/following{/other_user}","gists_url":"https://api.github.com/users/dylandaniels/gists{/gist_id}","starred_url":"https://api.github.com/users/dylandaniels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylandaniels/subscriptions","organizations_url":"https://api.github.com/users/dylandaniels/orgs","repos_url":"https://api.github.com/users/dylandaniels/repos","events_url":"https://api.github.com/users/dylandaniels/events{/privacy}","received_events_url":"https://api.github.com/users/dylandaniels/received_events","type":"User","site_admin":false},"repo":{"id":55080231,"name":"mousestyles","full_name":"dylandaniels/mousestyles","owner":{"login":"dylandaniels","id":1553821,"avatar_url":"https://avatars.githubusercontent.com/u/1553821?v=3","gravatar_id":"","url":"https://api.github.com/users/dylandaniels","html_url":"https://github.com/dylandaniels","followers_url":"https://api.github.com/users/dylandaniels/followers","following_url":"https://api.github.com/users/dylandaniels/following{/other_user}","gists_url":"https://api.github.com/users/dylandaniels/gists{/gist_id}","starred_url":"https://api.github.com/users/dylandaniels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylandaniels/subscriptions","organizations_url":"https://api.github.com/users/dylandaniels/orgs","repos_url":"https://api.github.com/users/dylandaniels/repos","events_url":"https://api.github.com/users/dylandaniels/events{/privacy}","received_events_url":"https://api.github.com/users/dylandaniels/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dylandaniels/mousestyles","description":"2016 final project","fork":true,"url":"https://api.github.com/repos/dylandaniels/mousestyles","forks_url":"https://api.github.com/repos/dylandaniels/mousestyles/forks","keys_url":"https://api.github.com/repos/dylandaniels/mousestyles/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dylandaniels/mousestyles/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dylandaniels/mousestyles/teams","hooks_url":"https://api.github.com/repos/dylandaniels/mousestyles/hooks","issue_events_url":"https://api.github.com/repos/dylandaniels/mousestyles/issues/events{/number}","events_url":"https://api.github.com/repos/dylandaniels/mousestyles/events","assignees_url":"https://api.github.com/repos/dylandaniels/mousestyles/assignees{/user}","branches_url":"https://api.github.com/repos/dylandaniels/mousestyles/branches{/branch}","tags_url":"https://api.github.com/repos/dylandaniels/mousestyles/tags","blobs_url":"https://api.github.com/repos/dylandaniels/mousestyles/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dylandaniels/mousestyles/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dylandaniels/mousestyles/git/refs{/sha}","trees_url":"https://api.github.com/repos/dylandaniels/mousestyles/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dylandaniels/mousestyles/statuses/{sha}","languages_url":"https://api.github.com/repos/dylandaniels/mousestyles/languages","stargazers_url":"https://api.github.com/repos/dylandaniels/mousestyles/stargazers","contributors_url":"https://api.github.com/repos/dylandaniels/mousestyles/contributors","subscribers_url":"https://api.github.com/repos/dylandaniels/mousestyles/subscribers","subscription_url":"https://api.github.com/repos/dylandaniels/mousestyles/subscription","commits_url":"https://api.github.com/repos/dylandaniels/mousestyles/commits{/sha}","git_commits_url":"https://api.github.com/repos/dylandaniels/mousestyles/git/commits{/sha}","comments_url":"https://api.github.com/repos/dylandaniels/mousestyles/comments{/number}","issue_comment_url":"https://api.github.com/repos/dylandaniels/mousestyles/issues/comments{/number}","contents_url":"https://api.github.com/repos/dylandaniels/mousestyles/contents/{+path}","compare_url":"https://api.github.com/repos/dylandaniels/mousestyles/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dylandaniels/mousestyles/merges","archive_url":"https://api.github.com/repos/dylandaniels/mousestyles/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dylandaniels/mousestyles/downloads","issues_url":"https://api.github.com/repos/dylandaniels/mousestyles/issues{/number}","pulls_url":"https://api.github.com/repos/dylandaniels/mousestyles/pulls{/number}","milestones_url":"https://api.github.com/repos/dylandaniels/mousestyles/milestones{/number}","notifications_url":"https://api.github.com/repos/dylandaniels/mousestyles/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dylandaniels/mousestyles/labels{/name}","releases_url":"https://api.github.com/repos/dylandaniels/mousestyles/releases{/id}","deployments_url":"https://api.github.com/repos/dylandaniels/mousestyles/deployments","created_at":"2016-03-30T16:47:41Z","updated_at":"2016-03-30T16:47:43Z","pushed_at":"2016-05-08T03:00:15Z","git_url":"git://github.com/dylandaniels/mousestyles.git","ssh_url":"git@github.com:dylandaniels/mousestyles.git","clone_url":"https://github.com/dylandaniels/mousestyles.git","svn_url":"https://github.com/dylandaniels/mousestyles","homepage":null,"size":96334,"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":"berkeley-stat222:master","ref":"master","sha":"7f1027ca36f1bd947c4525efed3f155dea9c0cc3","user":{"login":"berkeley-stat222","id":10637124,"avatar_url":"https://avatars.githubusercontent.com/u/10637124?v=3","gravatar_id":"","url":"https://api.github.com/users/berkeley-stat222","html_url":"https://github.com/berkeley-stat222","followers_url":"https://api.github.com/users/berkeley-stat222/followers","following_url":"https://api.github.com/users/berkeley-stat222/following{/other_user}","gists_url":"https://api.github.com/users/berkeley-stat222/gists{/gist_id}","starred_url":"https://api.github.com/users/berkeley-stat222/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/berkeley-stat222/subscriptions","organizations_url":"https://api.github.com/users/berkeley-stat222/orgs","repos_url":"https://api.github.com/users/berkeley-stat222/repos","events_url":"https://api.github.com/users/berkeley-stat222/events{/privacy}","received_events_url":"https://api.github.com/users/berkeley-stat222/received_events","type":"Organization","site_admin":false},"repo":{"id":53807239,"name":"mousestyles","full_name":"berkeley-stat222/mousestyles","owner":{"login":"berkeley-stat222","id":10637124,"avatar_url":"https://avatars.githubusercontent.com/u/10637124?v=3","gravatar_id":"","url":"https://api.github.com/users/berkeley-stat222","html_url":"https://github.com/berkeley-stat222","followers_url":"https://api.github.com/users/berkeley-stat222/followers","following_url":"https://api.github.com/users/berkeley-stat222/following{/other_user}","gists_url":"https://api.github.com/users/berkeley-stat222/gists{/gist_id}","starred_url":"https://api.github.com/users/berkeley-stat222/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/berkeley-stat222/subscriptions","organizations_url":"https://api.github.com/users/berkeley-stat222/orgs","repos_url":"https://api.github.com/users/berkeley-stat222/repos","events_url":"https://api.github.com/users/berkeley-stat222/events{/privacy}","received_events_url":"https://api.github.com/users/berkeley-stat222/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/berkeley-stat222/mousestyles","description":"2016 final project","fork":false,"url":"https://api.github.com/repos/berkeley-stat222/mousestyles","forks_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/forks","keys_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/keys{/key_id}","collaborators_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/teams","hooks_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/hooks","issue_events_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/issues/events{/number}","events_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/events","assignees_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/assignees{/user}","branches_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/branches{/branch}","tags_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/tags","blobs_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/git/refs{/sha}","trees_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/git/trees{/sha}","statuses_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/statuses/{sha}","languages_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/languages","stargazers_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/stargazers","contributors_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/contributors","subscribers_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/subscribers","subscription_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/subscription","commits_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/commits{/sha}","git_commits_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/git/commits{/sha}","comments_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/comments{/number}","issue_comment_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/issues/comments{/number}","contents_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/contents/{+path}","compare_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/compare/{base}...{head}","merges_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/merges","archive_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/downloads","issues_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/issues{/number}","pulls_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls{/number}","milestones_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/milestones{/number}","notifications_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/labels{/name}","releases_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/releases{/id}","deployments_url":"https://api.github.com/repos/berkeley-stat222/mousestyles/deployments","created_at":"2016-03-13T20:55:24Z","updated_at":"2016-05-09T20:34:11Z","pushed_at":"2016-05-11T17:24:11Z","git_url":"git://github.com/berkeley-stat222/mousestyles.git","ssh_url":"git@github.com:berkeley-stat222/mousestyles.git","clone_url":"https://github.com/berkeley-stat222/mousestyles.git","svn_url":"https://github.com/berkeley-stat222/mousestyles","homepage":"http://berkeley-stat222.github.io/mousestyles/","size":102128,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":35,"mirror_url":null,"open_issues_count":28,"forks":35,"open_issues":28,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/136"},"html":{"href":"https://github.com/berkeley-stat222/mousestyles/pull/136"},"issue":{"href":"https://api.github.com/repos/berkeley-stat222/mousestyles/issues/136"},"comments":{"href":"https://api.github.com/repos/berkeley-stat222/mousestyles/issues/136/comments"},"review_comments":{"href":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/136/comments"},"review_comment":{"href":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/berkeley-stat222/mousestyles/pulls/136/commits"},"statuses":{"href":"https://api.github.com/repos/berkeley-stat222/mousestyles/statuses/b660f00090996d336ccd036d0e5aa9be3f155315"}}}}