GitHub PullRequestReviewCommentEvent at 2014-10-29 17:08:00
Repository: hyperspy
Actor: to266
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/comments/19554027","id":19554027,"diff_hunk":"@@ -2143,4 +2112,44 @@ def __init__(self, model, isNavigation):\n         self.model = model\n \n     def __getitem__(self, slices):\n-        return self.model.__getitem__(slices, True, self.isNavigation)\n+        array_slices = self.model.spectrum._get_array_slices(\n+            slices,\n+            self.isNavigation)\n+        _spectrum = self.model.spectrum._slicer(slices, self.isNavigation)\n+        _model = self.model.__class__(_spectrum)\n+        from hyperspy import components\n+        for c in _model:\n+            _model.remove(c)\n+        twin_dict = {}\n+        for c in self.model:\n+            args = {}\n+            for k, v in c._whitelist.iteritems():\n+                if k.startswith('_init_'):\n+                    args[k[6:]] = v\n+            _model.append(getattr(components, c._id_name)(**args))\n+        deal_with_whitelist(\n+            self.model,\n+            _model,\n+            array_slices,\n+            self.isNavigation)\n+        for co, cn in zip(self.model, _model):\n+            deal_with_whitelist(co, cn, array_slices, self.isNavigation)\n+            for po, pn in zip(co.parameters, cn.parameters):\n+                deal_with_whitelist(po, pn, array_slices, self.isNavigation)\n+                twin_dict[id(po)] = ([id(i) for i in list(po._twins)], pn)\n+\n+        for k in twin_dict.keys():\n+            for tw_id in twin_dict[k][0]:\n+                twin_dict[tw_id][1].twin = twin_dict[k][1]\n+\n+        _model.chisq.data = _model.chisq.data.copy()\n+        _model.dof.data = _model.dof.data.copy()\n+        if not self.isNavigation:\n+            # strange bug, skips the first pixel when iterating for the first time -\n+            # maybe the axes_manager is not initialised correctly?\n+            for _ in _model.axes_manager:\n+                pass","path":"hyperspy/model.py","position":404,"original_position":404,"commit_id":"230d0037e3f20ba78f833b94512b86e9f8fcb3e5","original_commit_id":"230d0037e3f20ba78f833b94512b86e9f8fcb3e5","user":{"login":"to266","id":3384140,"avatar_url":"https://avatars.githubusercontent.com/u/3384140?v=2","gravatar_id":"","url":"https://api.github.com/users/to266","html_url":"https://github.com/to266","followers_url":"https://api.github.com/users/to266/followers","following_url":"https://api.github.com/users/to266/following{/other_user}","gists_url":"https://api.github.com/users/to266/gists{/gist_id}","starred_url":"https://api.github.com/users/to266/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/to266/subscriptions","organizations_url":"https://api.github.com/users/to266/orgs","repos_url":"https://api.github.com/users/to266/repos","events_url":"https://api.github.com/users/to266/events{/privacy}","received_events_url":"https://api.github.com/users/to266/received_events","type":"User","site_admin":false},"body":"The behaviour (described in the comment above) is strange. Maybe you know why it needs to iterate through the items twice? Most likely the axes manager did not initialise correctly, but I don't see where/why...","created_at":"2014-10-29T17:08:00Z","updated_at":"2014-10-29T17:08:00Z","html_url":"https://github.com/francisco-dlp/hyperspy/pull/1#discussion_r19554027","pull_request_url":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/comments/19554027"},"html":{"href":"https://github.com/francisco-dlp/hyperspy/pull/1#discussion_r19554027"},"pull_request":{"href":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/1","id":23522001,"html_url":"https://github.com/francisco-dlp/hyperspy/pull/1","diff_url":"https://github.com/francisco-dlp/hyperspy/pull/1.diff","patch_url":"https://github.com/francisco-dlp/hyperspy/pull/1.patch","issue_url":"https://api.github.com/repos/francisco-dlp/hyperspy/issues/1","number":1,"state":"open","locked":false,"title":"Enh fancy general indexing","user":{"login":"to266","id":3384140,"avatar_url":"https://avatars.githubusercontent.com/u/3384140?v=2","gravatar_id":"","url":"https://api.github.com/users/to266","html_url":"https://github.com/to266","followers_url":"https://api.github.com/users/to266/followers","following_url":"https://api.github.com/users/to266/following{/other_user}","gists_url":"https://api.github.com/users/to266/gists{/gist_id}","starred_url":"https://api.github.com/users/to266/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/to266/subscriptions","organizations_url":"https://api.github.com/users/to266/orgs","repos_url":"https://api.github.com/users/to266/repos","events_url":"https://api.github.com/users/to266/events{/privacy}","received_events_url":"https://api.github.com/users/to266/received_events","type":"User","site_admin":false},"body":"I need the functionality to continue working, so I will just PR to your branch instead of the hyperspy master.\r\n\r\nDo let me know if anything is amiss or you do not like some parts of implementation (such as '_additional_slicing_targets' in signal), as I am making this up as I go, obviously","created_at":"2014-10-29T11:01:47Z","updated_at":"2014-10-29T17:08:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68864ab9f74171ed0eea433363aea67e398c9c11","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/1/commits","review_comments_url":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/1/comments","review_comment_url":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/comments/{number}","comments_url":"https://api.github.com/repos/francisco-dlp/hyperspy/issues/1/comments","statuses_url":"https://api.github.com/repos/francisco-dlp/hyperspy/statuses/230d0037e3f20ba78f833b94512b86e9f8fcb3e5","head":{"label":"to266:ENH_fancy_general_indexing","ref":"ENH_fancy_general_indexing","sha":"230d0037e3f20ba78f833b94512b86e9f8fcb3e5","user":{"login":"to266","id":3384140,"avatar_url":"https://avatars.githubusercontent.com/u/3384140?v=2","gravatar_id":"","url":"https://api.github.com/users/to266","html_url":"https://github.com/to266","followers_url":"https://api.github.com/users/to266/followers","following_url":"https://api.github.com/users/to266/following{/other_user}","gists_url":"https://api.github.com/users/to266/gists{/gist_id}","starred_url":"https://api.github.com/users/to266/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/to266/subscriptions","organizations_url":"https://api.github.com/users/to266/orgs","repos_url":"https://api.github.com/users/to266/repos","events_url":"https://api.github.com/users/to266/events{/privacy}","received_events_url":"https://api.github.com/users/to266/received_events","type":"User","site_admin":false},"repo":{"id":13862483,"name":"hyperspy","full_name":"to266/hyperspy","owner":{"login":"to266","id":3384140,"avatar_url":"https://avatars.githubusercontent.com/u/3384140?v=2","gravatar_id":"","url":"https://api.github.com/users/to266","html_url":"https://github.com/to266","followers_url":"https://api.github.com/users/to266/followers","following_url":"https://api.github.com/users/to266/following{/other_user}","gists_url":"https://api.github.com/users/to266/gists{/gist_id}","starred_url":"https://api.github.com/users/to266/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/to266/subscriptions","organizations_url":"https://api.github.com/users/to266/orgs","repos_url":"https://api.github.com/users/to266/repos","events_url":"https://api.github.com/users/to266/events{/privacy}","received_events_url":"https://api.github.com/users/to266/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/to266/hyperspy","description":"Hyperspectral data analysis","fork":true,"url":"https://api.github.com/repos/to266/hyperspy","forks_url":"https://api.github.com/repos/to266/hyperspy/forks","keys_url":"https://api.github.com/repos/to266/hyperspy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/to266/hyperspy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/to266/hyperspy/teams","hooks_url":"https://api.github.com/repos/to266/hyperspy/hooks","issue_events_url":"https://api.github.com/repos/to266/hyperspy/issues/events{/number}","events_url":"https://api.github.com/repos/to266/hyperspy/events","assignees_url":"https://api.github.com/repos/to266/hyperspy/assignees{/user}","branches_url":"https://api.github.com/repos/to266/hyperspy/branches{/branch}","tags_url":"https://api.github.com/repos/to266/hyperspy/tags","blobs_url":"https://api.github.com/repos/to266/hyperspy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/to266/hyperspy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/to266/hyperspy/git/refs{/sha}","trees_url":"https://api.github.com/repos/to266/hyperspy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/to266/hyperspy/statuses/{sha}","languages_url":"https://api.github.com/repos/to266/hyperspy/languages","stargazers_url":"https://api.github.com/repos/to266/hyperspy/stargazers","contributors_url":"https://api.github.com/repos/to266/hyperspy/contributors","subscribers_url":"https://api.github.com/repos/to266/hyperspy/subscribers","subscription_url":"https://api.github.com/repos/to266/hyperspy/subscription","commits_url":"https://api.github.com/repos/to266/hyperspy/commits{/sha}","git_commits_url":"https://api.github.com/repos/to266/hyperspy/git/commits{/sha}","comments_url":"https://api.github.com/repos/to266/hyperspy/comments{/number}","issue_comment_url":"https://api.github.com/repos/to266/hyperspy/issues/comments/{number}","contents_url":"https://api.github.com/repos/to266/hyperspy/contents/{+path}","compare_url":"https://api.github.com/repos/to266/hyperspy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/to266/hyperspy/merges","archive_url":"https://api.github.com/repos/to266/hyperspy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/to266/hyperspy/downloads","issues_url":"https://api.github.com/repos/to266/hyperspy/issues{/number}","pulls_url":"https://api.github.com/repos/to266/hyperspy/pulls{/number}","milestones_url":"https://api.github.com/repos/to266/hyperspy/milestones{/number}","notifications_url":"https://api.github.com/repos/to266/hyperspy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/to266/hyperspy/labels{/name}","releases_url":"https://api.github.com/repos/to266/hyperspy/releases{/id}","created_at":"2013-10-25T14:12:17Z","updated_at":"2014-09-25T14:02:46Z","pushed_at":"2014-10-29T17:04:22Z","git_url":"git://github.com/to266/hyperspy.git","ssh_url":"git@github.com:to266/hyperspy.git","clone_url":"https://github.com/to266/hyperspy.git","svn_url":"https://github.com/to266/hyperspy","homepage":"http://www.hyperspy.org","size":20556,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"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":1,"default_branch":"master"}},"base":{"label":"francisco-dlp:ENH_fancy_model_indexing","ref":"ENH_fancy_model_indexing","sha":"4f9130d43aa5f7d3ac11dee8620383ac772f2dc5","user":{"login":"francisco-dlp","id":989719,"avatar_url":"https://avatars.githubusercontent.com/u/989719?v=2","gravatar_id":"","url":"https://api.github.com/users/francisco-dlp","html_url":"https://github.com/francisco-dlp","followers_url":"https://api.github.com/users/francisco-dlp/followers","following_url":"https://api.github.com/users/francisco-dlp/following{/other_user}","gists_url":"https://api.github.com/users/francisco-dlp/gists{/gist_id}","starred_url":"https://api.github.com/users/francisco-dlp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francisco-dlp/subscriptions","organizations_url":"https://api.github.com/users/francisco-dlp/orgs","repos_url":"https://api.github.com/users/francisco-dlp/repos","events_url":"https://api.github.com/users/francisco-dlp/events{/privacy}","received_events_url":"https://api.github.com/users/francisco-dlp/received_events","type":"User","site_admin":false},"repo":{"id":10522613,"name":"hyperspy","full_name":"francisco-dlp/hyperspy","owner":{"login":"francisco-dlp","id":989719,"avatar_url":"https://avatars.githubusercontent.com/u/989719?v=2","gravatar_id":"","url":"https://api.github.com/users/francisco-dlp","html_url":"https://github.com/francisco-dlp","followers_url":"https://api.github.com/users/francisco-dlp/followers","following_url":"https://api.github.com/users/francisco-dlp/following{/other_user}","gists_url":"https://api.github.com/users/francisco-dlp/gists{/gist_id}","starred_url":"https://api.github.com/users/francisco-dlp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francisco-dlp/subscriptions","organizations_url":"https://api.github.com/users/francisco-dlp/orgs","repos_url":"https://api.github.com/users/francisco-dlp/repos","events_url":"https://api.github.com/users/francisco-dlp/events{/privacy}","received_events_url":"https://api.github.com/users/francisco-dlp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/francisco-dlp/hyperspy","description":"A toolbox for hyperspectra data analysis","fork":true,"url":"https://api.github.com/repos/francisco-dlp/hyperspy","forks_url":"https://api.github.com/repos/francisco-dlp/hyperspy/forks","keys_url":"https://api.github.com/repos/francisco-dlp/hyperspy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/francisco-dlp/hyperspy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/francisco-dlp/hyperspy/teams","hooks_url":"https://api.github.com/repos/francisco-dlp/hyperspy/hooks","issue_events_url":"https://api.github.com/repos/francisco-dlp/hyperspy/issues/events{/number}","events_url":"https://api.github.com/repos/francisco-dlp/hyperspy/events","assignees_url":"https://api.github.com/repos/francisco-dlp/hyperspy/assignees{/user}","branches_url":"https://api.github.com/repos/francisco-dlp/hyperspy/branches{/branch}","tags_url":"https://api.github.com/repos/francisco-dlp/hyperspy/tags","blobs_url":"https://api.github.com/repos/francisco-dlp/hyperspy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/francisco-dlp/hyperspy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/francisco-dlp/hyperspy/git/refs{/sha}","trees_url":"https://api.github.com/repos/francisco-dlp/hyperspy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/francisco-dlp/hyperspy/statuses/{sha}","languages_url":"https://api.github.com/repos/francisco-dlp/hyperspy/languages","stargazers_url":"https://api.github.com/repos/francisco-dlp/hyperspy/stargazers","contributors_url":"https://api.github.com/repos/francisco-dlp/hyperspy/contributors","subscribers_url":"https://api.github.com/repos/francisco-dlp/hyperspy/subscribers","subscription_url":"https://api.github.com/repos/francisco-dlp/hyperspy/subscription","commits_url":"https://api.github.com/repos/francisco-dlp/hyperspy/commits{/sha}","git_commits_url":"https://api.github.com/repos/francisco-dlp/hyperspy/git/commits{/sha}","comments_url":"https://api.github.com/repos/francisco-dlp/hyperspy/comments{/number}","issue_comment_url":"https://api.github.com/repos/francisco-dlp/hyperspy/issues/comments/{number}","contents_url":"https://api.github.com/repos/francisco-dlp/hyperspy/contents/{+path}","compare_url":"https://api.github.com/repos/francisco-dlp/hyperspy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/francisco-dlp/hyperspy/merges","archive_url":"https://api.github.com/repos/francisco-dlp/hyperspy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/francisco-dlp/hyperspy/downloads","issues_url":"https://api.github.com/repos/francisco-dlp/hyperspy/issues{/number}","pulls_url":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls{/number}","milestones_url":"https://api.github.com/repos/francisco-dlp/hyperspy/milestones{/number}","notifications_url":"https://api.github.com/repos/francisco-dlp/hyperspy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/francisco-dlp/hyperspy/labels{/name}","releases_url":"https://api.github.com/repos/francisco-dlp/hyperspy/releases{/id}","created_at":"2013-06-06T09:01:00Z","updated_at":"2014-10-25T09:43:36Z","pushed_at":"2014-10-26T16:53:07Z","git_url":"git://github.com/francisco-dlp/hyperspy.git","ssh_url":"git@github.com:francisco-dlp/hyperspy.git","clone_url":"https://github.com/francisco-dlp/hyperspy.git","svn_url":"https://github.com/francisco-dlp/hyperspy","homepage":"http://www.hyperspy.org","size":19641,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/1"},"html":{"href":"https://github.com/francisco-dlp/hyperspy/pull/1"},"issue":{"href":"https://api.github.com/repos/francisco-dlp/hyperspy/issues/1"},"comments":{"href":"https://api.github.com/repos/francisco-dlp/hyperspy/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/francisco-dlp/hyperspy/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/francisco-dlp/hyperspy/statuses/230d0037e3f20ba78f833b94512b86e9f8fcb3e5"}}}}