{"action":"created","comment":{"url":"https://api.github.com/repos/NSLS-II/dataportal/pulls/comments/27476454","id":27476454,"diff_hunk":"@@ -413,126 +451,81 @@ def bin_by_edges(self, bin_edges, anchor=None, time_labels=None,\n         # Mark them\n         binning[binning % 2 == 0] = np.nan\n         binning //= 2  # Make bin number sequential, not odds only.\n-        bin_count = pd.Series(binning).nunique()  # not including NaN\n-        if anchor is None and time_labels is None:\n-            anchor = 'center'\n-        if time_labels is not None:\n-            if len(time_labels) != bin_count:\n-                raise ValueError(\"The number of time_labels ({0}) must equal \"\n-                                 \"the number of bins ({1}).\".format(\n-                                     len(time_labels), bin_count))\n-        elif isinstance(anchor, six.string_types):\n-            if anchor == 'left':\n-                time_labels = edges_as_pairs[:, 0]\n-            elif anchor == 'center':\n-                time_labels = np.mean(edges_as_pairs, axis=1)\n-            elif anchor == 'right':\n-                time_labels = edges_as_pairs[:, 1]\n-            else:\n-                raise ValueError(\"anchor must be 'left', 'center', 'right', \"\n-                                 \"or None\")\n-        return self.resample(time_labels, binning, interpolation, agg, col_names=col_names)\n-\n-    def resample(self, time_labels, binning, interpolation=None, agg=None,\n-                 verify_integrity=True, col_names=None):\n-        result = {}  # dict of DataFrames, to become one MultiIndexed DataFrame\n-        # How many (non-null) data points in each bin?\n+        if bin_anchors is None:\n+            bin_anchors = np.mean(edges_as_pairs, axis=1)  # bin centers\n+        else:\n+            if len(bin_anchors) != len(bin_edges):\n+                raise ValueError(\"There are {0} bin_anchors but {1} pairs of \"\n+                                 \"bin_edges. These must match.\".format(\n+                                     len(bin_anchors), len(bin_edges)))\n+        return bin_anchors, binning\n+\n+    def resample(self, bin_anchors, binning, interpolation=None, agg=None,\n+                 verify_integrity=True, use_cols=None):","path":"dataportal/muxer/data_muxer.py","position":274,"original_position":206,"commit_id":"08c42669ff0eda0d471efd01cfcde6ba99cff8e8","original_commit_id":"f4a60159a7fedf4e683b36a06a7498fc1e29e10d","user":{"login":"danielballan","id":2279598,"avatar_url":"https://avatars.githubusercontent.com/u/2279598?v=3","gravatar_id":"","url":"https://api.github.com/users/danielballan","html_url":"https://github.com/danielballan","followers_url":"https://api.github.com/users/danielballan/followers","following_url":"https://api.github.com/users/danielballan/following{/other_user}","gists_url":"https://api.github.com/users/danielballan/gists{/gist_id}","starred_url":"https://api.github.com/users/danielballan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielballan/subscriptions","organizations_url":"https://api.github.com/users/danielballan/orgs","repos_url":"https://api.github.com/users/danielballan/repos","events_url":"https://api.github.com/users/danielballan/events{/privacy}","received_events_url":"https://api.github.com/users/danielballan/received_events","type":"User","site_admin":false},"body":"Well I definitely agree with that. OK.","created_at":"2015-03-31T13:07:10Z","updated_at":"2015-03-31T13:07:10Z","html_url":"https://github.com/NSLS-II/dataportal/pull/134#discussion_r27476454","pull_request_url":"https://api.github.com/repos/NSLS-II/dataportal/pulls/134","_links":{"self":{"href":"https://api.github.com/repos/NSLS-II/dataportal/pulls/comments/27476454"},"html":{"href":"https://github.com/NSLS-II/dataportal/pull/134#discussion_r27476454"},"pull_request":{"href":"https://api.github.com/repos/NSLS-II/dataportal/pulls/134"}}},"pull_request":{"url":"https://api.github.com/repos/NSLS-II/dataportal/pulls/134","id":32256265,"html_url":"https://github.com/NSLS-II/dataportal/pull/134","diff_url":"https://github.com/NSLS-II/dataportal/pull/134.diff","patch_url":"https://github.com/NSLS-II/dataportal/pull/134.patch","issue_url":"https://api.github.com/repos/NSLS-II/dataportal/issues/134","number":134,"state":"open","locked":false,"title":"DataMuxer, revisited","user":{"login":"danielballan","id":2279598,"avatar_url":"https://avatars.githubusercontent.com/u/2279598?v=3","gravatar_id":"","url":"https://api.github.com/users/danielballan","html_url":"https://github.com/danielballan","followers_url":"https://api.github.com/users/danielballan/followers","following_url":"https://api.github.com/users/danielballan/following{/other_user}","gists_url":"https://api.github.com/users/danielballan/gists{/gist_id}","starred_url":"https://api.github.com/users/danielballan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielballan/subscriptions","organizations_url":"https://api.github.com/users/danielballan/orgs","repos_url":"https://api.github.com/users/danielballan/repos","events_url":"https://api.github.com/users/danielballan/events{/privacy}","received_events_url":"https://api.github.com/users/danielballan/received_events","type":"User","site_admin":false},"body":"Some long-planned updates to the muxer:\r\n\r\n* Rather than trying to convey upsampling and downsampling operations in column names (e.g., 'val_linear_mean'), all columns will be called 'val'. Instead, for each `DataMuxer.bin_*` function, there is now a `DataMuxer.plan.bin_*` function taking the exact same arguments. It returns an explanation of what resampling will be done for that given muxer object and function arguments. Example:\r\n\r\n   ```\r\n   In [21]: dm.plan.bin_on('Tsam')\r\n   Out[21]: \r\n             downsampling_needed upsampling_possible downsample upsample\r\n   Tsam                    False               False       None     None\r\n   point_det                True               False       None     None\r\n   time                     True               False       mean   linear\r\n   ```\r\n* Binning operations return a DataFrame indexed by bin number, not time. A new `time` column contains the Event time.\r\n* Provide `.to_sparse_dataframe()`, allowing us to remove or refactor `_dataframe` in the future.\r\n* Remove the notion of bin anchoring, simplifying the bin functions considerably. Now that bins are indexed by number, there is no anchoring.\r\n* Simplify API: `from dataportal import DataBroker, DataMuxer`","created_at":"2015-03-30T18:59:20Z","updated_at":"2015-03-31T13:07:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"30ff7175fc23ff3a4912d16ef90e3e1ea930dc89","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/NSLS-II/dataportal/pulls/134/commits","review_comments_url":"https://api.github.com/repos/NSLS-II/dataportal/pulls/134/comments","review_comment_url":"https://api.github.com/repos/NSLS-II/dataportal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NSLS-II/dataportal/issues/134/comments","statuses_url":"https://api.github.com/repos/NSLS-II/dataportal/statuses/08c42669ff0eda0d471efd01cfcde6ba99cff8e8","head":{"label":"danielballan:muxer-revisited","ref":"muxer-revisited","sha":"08c42669ff0eda0d471efd01cfcde6ba99cff8e8","user":{"login":"danielballan","id":2279598,"avatar_url":"https://avatars.githubusercontent.com/u/2279598?v=3","gravatar_id":"","url":"https://api.github.com/users/danielballan","html_url":"https://github.com/danielballan","followers_url":"https://api.github.com/users/danielballan/followers","following_url":"https://api.github.com/users/danielballan/following{/other_user}","gists_url":"https://api.github.com/users/danielballan/gists{/gist_id}","starred_url":"https://api.github.com/users/danielballan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielballan/subscriptions","organizations_url":"https://api.github.com/users/danielballan/orgs","repos_url":"https://api.github.com/users/danielballan/repos","events_url":"https://api.github.com/users/danielballan/events{/privacy}","received_events_url":"https://api.github.com/users/danielballan/received_events","type":"User","site_admin":false},"repo":{"id":28930175,"name":"dataportal","full_name":"danielballan/dataportal","owner":{"login":"danielballan","id":2279598,"avatar_url":"https://avatars.githubusercontent.com/u/2279598?v=3","gravatar_id":"","url":"https://api.github.com/users/danielballan","html_url":"https://github.com/danielballan","followers_url":"https://api.github.com/users/danielballan/followers","following_url":"https://api.github.com/users/danielballan/following{/other_user}","gists_url":"https://api.github.com/users/danielballan/gists{/gist_id}","starred_url":"https://api.github.com/users/danielballan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielballan/subscriptions","organizations_url":"https://api.github.com/users/danielballan/orgs","repos_url":"https://api.github.com/users/danielballan/repos","events_url":"https://api.github.com/users/danielballan/events{/privacy}","received_events_url":"https://api.github.com/users/danielballan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danielballan/dataportal","description":"Externally facing API for data","fork":true,"url":"https://api.github.com/repos/danielballan/dataportal","forks_url":"https://api.github.com/repos/danielballan/dataportal/forks","keys_url":"https://api.github.com/repos/danielballan/dataportal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danielballan/dataportal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danielballan/dataportal/teams","hooks_url":"https://api.github.com/repos/danielballan/dataportal/hooks","issue_events_url":"https://api.github.com/repos/danielballan/dataportal/issues/events{/number}","events_url":"https://api.github.com/repos/danielballan/dataportal/events","assignees_url":"https://api.github.com/repos/danielballan/dataportal/assignees{/user}","branches_url":"https://api.github.com/repos/danielballan/dataportal/branches{/branch}","tags_url":"https://api.github.com/repos/danielballan/dataportal/tags","blobs_url":"https://api.github.com/repos/danielballan/dataportal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danielballan/dataportal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danielballan/dataportal/git/refs{/sha}","trees_url":"https://api.github.com/repos/danielballan/dataportal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danielballan/dataportal/statuses/{sha}","languages_url":"https://api.github.com/repos/danielballan/dataportal/languages","stargazers_url":"https://api.github.com/repos/danielballan/dataportal/stargazers","contributors_url":"https://api.github.com/repos/danielballan/dataportal/contributors","subscribers_url":"https://api.github.com/repos/danielballan/dataportal/subscribers","subscription_url":"https://api.github.com/repos/danielballan/dataportal/subscription","commits_url":"https://api.github.com/repos/danielballan/dataportal/commits{/sha}","git_commits_url":"https://api.github.com/repos/danielballan/dataportal/git/commits{/sha}","comments_url":"https://api.github.com/repos/danielballan/dataportal/comments{/number}","issue_comment_url":"https://api.github.com/repos/danielballan/dataportal/issues/comments{/number}","contents_url":"https://api.github.com/repos/danielballan/dataportal/contents/{+path}","compare_url":"https://api.github.com/repos/danielballan/dataportal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danielballan/dataportal/merges","archive_url":"https://api.github.com/repos/danielballan/dataportal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danielballan/dataportal/downloads","issues_url":"https://api.github.com/repos/danielballan/dataportal/issues{/number}","pulls_url":"https://api.github.com/repos/danielballan/dataportal/pulls{/number}","milestones_url":"https://api.github.com/repos/danielballan/dataportal/milestones{/number}","notifications_url":"https://api.github.com/repos/danielballan/dataportal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danielballan/dataportal/labels{/name}","releases_url":"https://api.github.com/repos/danielballan/dataportal/releases{/id}","created_at":"2015-01-07T19:30:49Z","updated_at":"2015-03-23T20:46:37Z","pushed_at":"2015-03-31T12:32:23Z","git_url":"git://github.com/danielballan/dataportal.git","ssh_url":"git@github.com:danielballan/dataportal.git","clone_url":"https://github.com/danielballan/dataportal.git","svn_url":"https://github.com/danielballan/dataportal","homepage":null,"size":1714,"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":"NSLS-II:master","ref":"master","sha":"73c852ec391bc3c2f8837a2b0634fc2a57d27db4","user":{"login":"NSLS-II","id":8700262,"avatar_url":"https://avatars.githubusercontent.com/u/8700262?v=3","gravatar_id":"","url":"https://api.github.com/users/NSLS-II","html_url":"https://github.com/NSLS-II","followers_url":"https://api.github.com/users/NSLS-II/followers","following_url":"https://api.github.com/users/NSLS-II/following{/other_user}","gists_url":"https://api.github.com/users/NSLS-II/gists{/gist_id}","starred_url":"https://api.github.com/users/NSLS-II/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NSLS-II/subscriptions","organizations_url":"https://api.github.com/users/NSLS-II/orgs","repos_url":"https://api.github.com/users/NSLS-II/repos","events_url":"https://api.github.com/users/NSLS-II/events{/privacy}","received_events_url":"https://api.github.com/users/NSLS-II/received_events","type":"Organization","site_admin":false},"repo":{"id":24718080,"name":"dataportal","full_name":"NSLS-II/dataportal","owner":{"login":"NSLS-II","id":8700262,"avatar_url":"https://avatars.githubusercontent.com/u/8700262?v=3","gravatar_id":"","url":"https://api.github.com/users/NSLS-II","html_url":"https://github.com/NSLS-II","followers_url":"https://api.github.com/users/NSLS-II/followers","following_url":"https://api.github.com/users/NSLS-II/following{/other_user}","gists_url":"https://api.github.com/users/NSLS-II/gists{/gist_id}","starred_url":"https://api.github.com/users/NSLS-II/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NSLS-II/subscriptions","organizations_url":"https://api.github.com/users/NSLS-II/orgs","repos_url":"https://api.github.com/users/NSLS-II/repos","events_url":"https://api.github.com/users/NSLS-II/events{/privacy}","received_events_url":"https://api.github.com/users/NSLS-II/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NSLS-II/dataportal","description":"Externally facing API for data","fork":false,"url":"https://api.github.com/repos/NSLS-II/dataportal","forks_url":"https://api.github.com/repos/NSLS-II/dataportal/forks","keys_url":"https://api.github.com/repos/NSLS-II/dataportal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NSLS-II/dataportal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NSLS-II/dataportal/teams","hooks_url":"https://api.github.com/repos/NSLS-II/dataportal/hooks","issue_events_url":"https://api.github.com/repos/NSLS-II/dataportal/issues/events{/number}","events_url":"https://api.github.com/repos/NSLS-II/dataportal/events","assignees_url":"https://api.github.com/repos/NSLS-II/dataportal/assignees{/user}","branches_url":"https://api.github.com/repos/NSLS-II/dataportal/branches{/branch}","tags_url":"https://api.github.com/repos/NSLS-II/dataportal/tags","blobs_url":"https://api.github.com/repos/NSLS-II/dataportal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NSLS-II/dataportal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NSLS-II/dataportal/git/refs{/sha}","trees_url":"https://api.github.com/repos/NSLS-II/dataportal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NSLS-II/dataportal/statuses/{sha}","languages_url":"https://api.github.com/repos/NSLS-II/dataportal/languages","stargazers_url":"https://api.github.com/repos/NSLS-II/dataportal/stargazers","contributors_url":"https://api.github.com/repos/NSLS-II/dataportal/contributors","subscribers_url":"https://api.github.com/repos/NSLS-II/dataportal/subscribers","subscription_url":"https://api.github.com/repos/NSLS-II/dataportal/subscription","commits_url":"https://api.github.com/repos/NSLS-II/dataportal/commits{/sha}","git_commits_url":"https://api.github.com/repos/NSLS-II/dataportal/git/commits{/sha}","comments_url":"https://api.github.com/repos/NSLS-II/dataportal/comments{/number}","issue_comment_url":"https://api.github.com/repos/NSLS-II/dataportal/issues/comments{/number}","contents_url":"https://api.github.com/repos/NSLS-II/dataportal/contents/{+path}","compare_url":"https://api.github.com/repos/NSLS-II/dataportal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NSLS-II/dataportal/merges","archive_url":"https://api.github.com/repos/NSLS-II/dataportal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NSLS-II/dataportal/downloads","issues_url":"https://api.github.com/repos/NSLS-II/dataportal/issues{/number}","pulls_url":"https://api.github.com/repos/NSLS-II/dataportal/pulls{/number}","milestones_url":"https://api.github.com/repos/NSLS-II/dataportal/milestones{/number}","notifications_url":"https://api.github.com/repos/NSLS-II/dataportal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NSLS-II/dataportal/labels{/name}","releases_url":"https://api.github.com/repos/NSLS-II/dataportal/releases{/id}","created_at":"2014-10-02T12:34:01Z","updated_at":"2015-03-31T01:57:46Z","pushed_at":"2015-03-31T12:32:23Z","git_url":"git://github.com/NSLS-II/dataportal.git","ssh_url":"git@github.com:NSLS-II/dataportal.git","clone_url":"https://github.com/NSLS-II/dataportal.git","svn_url":"https://github.com/NSLS-II/dataportal","homepage":"http://nsls-ii.github.io/","size":2309,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":21,"forks":4,"open_issues":21,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NSLS-II/dataportal/pulls/134"},"html":{"href":"https://github.com/NSLS-II/dataportal/pull/134"},"issue":{"href":"https://api.github.com/repos/NSLS-II/dataportal/issues/134"},"comments":{"href":"https://api.github.com/repos/NSLS-II/dataportal/issues/134/comments"},"review_comments":{"href":"https://api.github.com/repos/NSLS-II/dataportal/pulls/134/comments"},"review_comment":{"href":"https://api.github.com/repos/NSLS-II/dataportal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NSLS-II/dataportal/pulls/134/commits"},"statuses":{"href":"https://api.github.com/repos/NSLS-II/dataportal/statuses/08c42669ff0eda0d471efd01cfcde6ba99cff8e8"}}}}