{"action":"created","comment":{"url":"https://api.github.com/repos/yt-project/yt/pulls/comments/203436703","pull_request_review_id":138325830,"id":203436703,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzQzNjcwMw==","diff_hunk":"@@ -134,26 +310,29 @@ cdef inline int cull_node(Node* node,\n         else:\n             tpos = 0\n         ndist += tpos*tpos\n-    return ndist > queue.heap_ptr[0]\n+        k += axes.step\n+\n+    return (ndist > queue.heap[0] and queue.size == queue.max_elements)\n \n @cython.boundscheck(False)\n @cython.wraparound(False)\n cdef inline int process_node_points(Node* node,\n-                                    np.float64_t* pos,\n-                                    np.float64_t[:, :] positions,\n                                     BoundedPriorityQueue queue,\n-                                    uint64_t skip_idx) nogil except -1:\n-    cdef uint64_t i, idx\n+                                    np.float64_t[:, ::1] positions,\n+                                    np.float64_t* pos,\n+                                    int skipidx,\n+                                    axes_range * axes,\n+                                    ) nogil except -1:\n+    cdef uint64_t i, k\n     cdef np.float64_t tpos, sq_dist\n-    cdef int j\n-    cdef np.float64_t* p_ptr\n     for i in range(node.left_idx, node.left_idx + node.children):\n-        p_ptr = &(positions[i, 0])\n-        if i != skip_idx:\n-            sq_dist = 0\n-            for j in range(3):\n-                tpos = p_ptr[j] - pos[j]\n-                sq_dist += tpos*tpos\n-            queue.add(sq_dist)\n+        sq_dist = 0\n+        k = axes.start\n+        while k < axes.stop:\n+            tpos = positions[i, k] - pos[k]\n+            sq_dist += tpos*tpos\n+            k += axes.step","path":"yt/utilities/lib/particle_kdtree_tools.pyx","position":323,"original_position":323,"commit_id":"dbd85fdfef046a36e8434349bb8e4b4a518068bd","original_commit_id":"dbd85fdfef046a36e8434349bb8e4b4a518068bd","user":{"login":"AshKelly","id":30047498,"node_id":"MDQ6VXNlcjMwMDQ3NDk4","avatar_url":"https://avatars3.githubusercontent.com/u/30047498?v=4","gravatar_id":"","url":"https://api.github.com/users/AshKelly","html_url":"https://github.com/AshKelly","followers_url":"https://api.github.com/users/AshKelly/followers","following_url":"https://api.github.com/users/AshKelly/following{/other_user}","gists_url":"https://api.github.com/users/AshKelly/gists{/gist_id}","starred_url":"https://api.github.com/users/AshKelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AshKelly/subscriptions","organizations_url":"https://api.github.com/users/AshKelly/orgs","repos_url":"https://api.github.com/users/AshKelly/repos","events_url":"https://api.github.com/users/AshKelly/events{/privacy}","received_events_url":"https://api.github.com/users/AshKelly/received_events","type":"User","site_admin":false},"body":"as referenced earlier this replaces range(3) to allow easy skipping of certain axes for projection plots which will be implemented soon","created_at":"2018-07-18T16:01:23Z","updated_at":"2018-07-18T16:01:23Z","html_url":"https://github.com/yt-project/yt/pull/1828#discussion_r203436703","pull_request_url":"https://api.github.com/repos/yt-project/yt/pulls/1828","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/yt-project/yt/pulls/comments/203436703"},"html":{"href":"https://github.com/yt-project/yt/pull/1828#discussion_r203436703"},"pull_request":{"href":"https://api.github.com/repos/yt-project/yt/pulls/1828"}}},"pull_request":{"url":"https://api.github.com/repos/yt-project/yt/pulls/1828","id":193836468,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzODM2NDY4","html_url":"https://github.com/yt-project/yt/pull/1828","diff_url":"https://github.com/yt-project/yt/pull/1828.diff","patch_url":"https://github.com/yt-project/yt/pull/1828.patch","issue_url":"https://api.github.com/repos/yt-project/yt/issues/1828","number":1828,"state":"open","locked":false,"title":"yt-4.0 adding \"gather\" approach to arbitrary_grid and slice SPH pixelization routines","user":{"login":"AshKelly","id":30047498,"node_id":"MDQ6VXNlcjMwMDQ3NDk4","avatar_url":"https://avatars3.githubusercontent.com/u/30047498?v=4","gravatar_id":"","url":"https://api.github.com/users/AshKelly","html_url":"https://github.com/AshKelly","followers_url":"https://api.github.com/users/AshKelly/followers","following_url":"https://api.github.com/users/AshKelly/following{/other_user}","gists_url":"https://api.github.com/users/AshKelly/gists{/gist_id}","starred_url":"https://api.github.com/users/AshKelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AshKelly/subscriptions","organizations_url":"https://api.github.com/users/AshKelly/orgs","repos_url":"https://api.github.com/users/AshKelly/repos","events_url":"https://api.github.com/users/AshKelly/events{/privacy}","received_events_url":"https://api.github.com/users/AshKelly/received_events","type":"User","site_admin":false},"body":"## PR Summary\r\n\r\nI just need to add some tests and this is ready to go\r\n\r\nThis is a PR to add the ability to use the \"gather\" approach with the `arbtrary_grid` and `sliceplot`pixelization functions for SPH data. This requires the following:\r\n- [x] modification to the `BoundedPriorityQueue` to store a particle ID (pid) as well as distance\r\n- [x] connecting the `BoundedPriorityQueue` to the kdtree to find k nearest neighbours \r\n- [x] wire this in\r\n\r\n## PR Checklist\r\n\r\n- [x] Code passes flake8 checker\r\n- [x] New features are documented, with docstrings and narrative docs\r\n- [ ] Adds a test for any bugs fixed. Adds tests for new features.\r\n\r\n## Testing\r\n```python\r\nimport yt\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\nfrom yt.units import kpc\r\nfrom matplotlib.colors import LogNorm\r\n\r\nds = yt.load('GadgetDiskGalaxy/snapshot_200.hdf5')\r\n_, c = ds.find_max(('gas', 'density'))\r\nwidth = 50 * kpc\r\nbuff_size = 256\r\nfield = ('gas', 'density')\r\n\r\n\r\nag = ds.arbitrary_grid(c - width / 2,\r\n                       c + width / 2,\r\n                       [buff_size]*2 + [1])\r\ndens = ag[field][:, :, 0].to('g*cm**-3').d\r\n\r\nds.sph_smoothing_style = \"gather\"\r\nds._num_neighbors = 32\r\n\r\nag = ds.arbitrary_grid(c - width / 2,\r\n                       c + width / 2,\r\n                       [buff_size]*2 + [1])\r\ndens2 = ag[field][:, :, 0].to('g*cm**-3').d\r\n\r\nplt.figure()\r\n\r\nplt.subplot(121)\r\nplt.title(\"scatter\")\r\nplt.xlim(0, 1.0)\r\nplt.ylim(0, 1.0)\r\nplt.imshow(dens.T, extent=[0, 1, 0, 1], origin='lower',\r\n           aspect=\"auto\", norm=LogNorm())\r\n\r\nplt.subplot(122)\r\nplt.title(\"gather - 32 neigh\")\r\nplt.xlim(0, 1.0)\r\nplt.ylim(0, 1.0)\r\nplt.imshow(dens2.T, extent=[0, 1, 0, 1], origin='lower',\r\n           aspect=\"auto\", norm=LogNorm())\r\nplt.show()\r\n```\r\nproduces\r\n![gather_scatter](https://user-images.githubusercontent.com/30047498/41997029-b4824508-7a4e-11e8-93db-690c539a1b72.png)\r\n\r\n## Details\r\n\r\nThe modification to the bounded priority queue has been done using name mangling. The idea is that in the case where the extra information (namely, particle ids) is not required it will not add any extra cpu or memory overhead.\r\n\r\n`m = BoundedPriorityQueue(5)` should not allocate memory for pid's or ever interact with them. Whereas,\r\n`m = BoundedPriorityQueue(5, True)` or  `m = BoundedPriorityQueue(5, 1)` will allocate memory for the pid's and add some CPU overhead for every member function.","created_at":"2018-06-10T17:12:53Z","updated_at":"2018-07-18T16:01:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd4e14ad5bfd4678cb1ea6a725876a35e524ff2c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/yt-project/yt/pulls/1828/commits","review_comments_url":"https://api.github.com/repos/yt-project/yt/pulls/1828/comments","review_comment_url":"https://api.github.com/repos/yt-project/yt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yt-project/yt/issues/1828/comments","statuses_url":"https://api.github.com/repos/yt-project/yt/statuses/dbd85fdfef046a36e8434349bb8e4b4a518068bd","head":{"label":"AshKelly:yt-4.0-nn-list","ref":"yt-4.0-nn-list","sha":"dbd85fdfef046a36e8434349bb8e4b4a518068bd","user":{"login":"AshKelly","id":30047498,"node_id":"MDQ6VXNlcjMwMDQ3NDk4","avatar_url":"https://avatars3.githubusercontent.com/u/30047498?v=4","gravatar_id":"","url":"https://api.github.com/users/AshKelly","html_url":"https://github.com/AshKelly","followers_url":"https://api.github.com/users/AshKelly/followers","following_url":"https://api.github.com/users/AshKelly/following{/other_user}","gists_url":"https://api.github.com/users/AshKelly/gists{/gist_id}","starred_url":"https://api.github.com/users/AshKelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AshKelly/subscriptions","organizations_url":"https://api.github.com/users/AshKelly/orgs","repos_url":"https://api.github.com/users/AshKelly/repos","events_url":"https://api.github.com/users/AshKelly/events{/privacy}","received_events_url":"https://api.github.com/users/AshKelly/received_events","type":"User","site_admin":false},"repo":{"id":122186227,"node_id":"MDEwOlJlcG9zaXRvcnkxMjIxODYyMjc=","name":"yt","full_name":"AshKelly/yt","owner":{"login":"AshKelly","id":30047498,"node_id":"MDQ6VXNlcjMwMDQ3NDk4","avatar_url":"https://avatars3.githubusercontent.com/u/30047498?v=4","gravatar_id":"","url":"https://api.github.com/users/AshKelly","html_url":"https://github.com/AshKelly","followers_url":"https://api.github.com/users/AshKelly/followers","following_url":"https://api.github.com/users/AshKelly/following{/other_user}","gists_url":"https://api.github.com/users/AshKelly/gists{/gist_id}","starred_url":"https://api.github.com/users/AshKelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AshKelly/subscriptions","organizations_url":"https://api.github.com/users/AshKelly/orgs","repos_url":"https://api.github.com/users/AshKelly/repos","events_url":"https://api.github.com/users/AshKelly/events{/privacy}","received_events_url":"https://api.github.com/users/AshKelly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AshKelly/yt","description":"Main yt repository","fork":true,"url":"https://api.github.com/repos/AshKelly/yt","forks_url":"https://api.github.com/repos/AshKelly/yt/forks","keys_url":"https://api.github.com/repos/AshKelly/yt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AshKelly/yt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AshKelly/yt/teams","hooks_url":"https://api.github.com/repos/AshKelly/yt/hooks","issue_events_url":"https://api.github.com/repos/AshKelly/yt/issues/events{/number}","events_url":"https://api.github.com/repos/AshKelly/yt/events","assignees_url":"https://api.github.com/repos/AshKelly/yt/assignees{/user}","branches_url":"https://api.github.com/repos/AshKelly/yt/branches{/branch}","tags_url":"https://api.github.com/repos/AshKelly/yt/tags","blobs_url":"https://api.github.com/repos/AshKelly/yt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AshKelly/yt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AshKelly/yt/git/refs{/sha}","trees_url":"https://api.github.com/repos/AshKelly/yt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AshKelly/yt/statuses/{sha}","languages_url":"https://api.github.com/repos/AshKelly/yt/languages","stargazers_url":"https://api.github.com/repos/AshKelly/yt/stargazers","contributors_url":"https://api.github.com/repos/AshKelly/yt/contributors","subscribers_url":"https://api.github.com/repos/AshKelly/yt/subscribers","subscription_url":"https://api.github.com/repos/AshKelly/yt/subscription","commits_url":"https://api.github.com/repos/AshKelly/yt/commits{/sha}","git_commits_url":"https://api.github.com/repos/AshKelly/yt/git/commits{/sha}","comments_url":"https://api.github.com/repos/AshKelly/yt/comments{/number}","issue_comment_url":"https://api.github.com/repos/AshKelly/yt/issues/comments{/number}","contents_url":"https://api.github.com/repos/AshKelly/yt/contents/{+path}","compare_url":"https://api.github.com/repos/AshKelly/yt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AshKelly/yt/merges","archive_url":"https://api.github.com/repos/AshKelly/yt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AshKelly/yt/downloads","issues_url":"https://api.github.com/repos/AshKelly/yt/issues{/number}","pulls_url":"https://api.github.com/repos/AshKelly/yt/pulls{/number}","milestones_url":"https://api.github.com/repos/AshKelly/yt/milestones{/number}","notifications_url":"https://api.github.com/repos/AshKelly/yt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AshKelly/yt/labels{/name}","releases_url":"https://api.github.com/repos/AshKelly/yt/releases{/id}","deployments_url":"https://api.github.com/repos/AshKelly/yt/deployments","created_at":"2018-02-20T10:51:19Z","updated_at":"2018-06-19T12:53:20Z","pushed_at":"2018-07-18T15:49:34Z","git_url":"git://github.com/AshKelly/yt.git","ssh_url":"git@github.com:AshKelly/yt.git","clone_url":"https://github.com/AshKelly/yt.git","svn_url":"https://github.com/AshKelly/yt","homepage":"http://yt-project.org","size":268080,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yt-project:yt-4.0","ref":"yt-4.0","sha":"d1ee53a9b66a5576e5d299e979b6ad18882f9690","user":{"login":"yt-project","id":20566579,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNTY2NTc5","avatar_url":"https://avatars0.githubusercontent.com/u/20566579?v=4","gravatar_id":"","url":"https://api.github.com/users/yt-project","html_url":"https://github.com/yt-project","followers_url":"https://api.github.com/users/yt-project/followers","following_url":"https://api.github.com/users/yt-project/following{/other_user}","gists_url":"https://api.github.com/users/yt-project/gists{/gist_id}","starred_url":"https://api.github.com/users/yt-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yt-project/subscriptions","organizations_url":"https://api.github.com/users/yt-project/orgs","repos_url":"https://api.github.com/users/yt-project/repos","events_url":"https://api.github.com/users/yt-project/events{/privacy}","received_events_url":"https://api.github.com/users/yt-project/received_events","type":"Organization","site_admin":false},"repo":{"id":88776493,"node_id":"MDEwOlJlcG9zaXRvcnk4ODc3NjQ5Mw==","name":"yt","full_name":"yt-project/yt","owner":{"login":"yt-project","id":20566579,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNTY2NTc5","avatar_url":"https://avatars0.githubusercontent.com/u/20566579?v=4","gravatar_id":"","url":"https://api.github.com/users/yt-project","html_url":"https://github.com/yt-project","followers_url":"https://api.github.com/users/yt-project/followers","following_url":"https://api.github.com/users/yt-project/following{/other_user}","gists_url":"https://api.github.com/users/yt-project/gists{/gist_id}","starred_url":"https://api.github.com/users/yt-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yt-project/subscriptions","organizations_url":"https://api.github.com/users/yt-project/orgs","repos_url":"https://api.github.com/users/yt-project/repos","events_url":"https://api.github.com/users/yt-project/events{/privacy}","received_events_url":"https://api.github.com/users/yt-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yt-project/yt","description":"Main yt repository","fork":false,"url":"https://api.github.com/repos/yt-project/yt","forks_url":"https://api.github.com/repos/yt-project/yt/forks","keys_url":"https://api.github.com/repos/yt-project/yt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yt-project/yt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yt-project/yt/teams","hooks_url":"https://api.github.com/repos/yt-project/yt/hooks","issue_events_url":"https://api.github.com/repos/yt-project/yt/issues/events{/number}","events_url":"https://api.github.com/repos/yt-project/yt/events","assignees_url":"https://api.github.com/repos/yt-project/yt/assignees{/user}","branches_url":"https://api.github.com/repos/yt-project/yt/branches{/branch}","tags_url":"https://api.github.com/repos/yt-project/yt/tags","blobs_url":"https://api.github.com/repos/yt-project/yt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yt-project/yt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yt-project/yt/git/refs{/sha}","trees_url":"https://api.github.com/repos/yt-project/yt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yt-project/yt/statuses/{sha}","languages_url":"https://api.github.com/repos/yt-project/yt/languages","stargazers_url":"https://api.github.com/repos/yt-project/yt/stargazers","contributors_url":"https://api.github.com/repos/yt-project/yt/contributors","subscribers_url":"https://api.github.com/repos/yt-project/yt/subscribers","subscription_url":"https://api.github.com/repos/yt-project/yt/subscription","commits_url":"https://api.github.com/repos/yt-project/yt/commits{/sha}","git_commits_url":"https://api.github.com/repos/yt-project/yt/git/commits{/sha}","comments_url":"https://api.github.com/repos/yt-project/yt/comments{/number}","issue_comment_url":"https://api.github.com/repos/yt-project/yt/issues/comments{/number}","contents_url":"https://api.github.com/repos/yt-project/yt/contents/{+path}","compare_url":"https://api.github.com/repos/yt-project/yt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yt-project/yt/merges","archive_url":"https://api.github.com/repos/yt-project/yt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yt-project/yt/downloads","issues_url":"https://api.github.com/repos/yt-project/yt/issues{/number}","pulls_url":"https://api.github.com/repos/yt-project/yt/pulls{/number}","milestones_url":"https://api.github.com/repos/yt-project/yt/milestones{/number}","notifications_url":"https://api.github.com/repos/yt-project/yt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yt-project/yt/labels{/name}","releases_url":"https://api.github.com/repos/yt-project/yt/releases{/id}","deployments_url":"https://api.github.com/repos/yt-project/yt/deployments","created_at":"2017-04-19T18:16:11Z","updated_at":"2018-07-16T13:44:39Z","pushed_at":"2018-07-18T15:49:36Z","git_url":"git://github.com/yt-project/yt.git","ssh_url":"git@github.com:yt-project/yt.git","clone_url":"https://github.com/yt-project/yt.git","svn_url":"https://github.com/yt-project/yt","homepage":"http://yt-project.org","size":267659,"stargazers_count":120,"watchers_count":120,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":98,"mirror_url":null,"archived":false,"open_issues_count":171,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":98,"open_issues":171,"watchers":120,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yt-project/yt/pulls/1828"},"html":{"href":"https://github.com/yt-project/yt/pull/1828"},"issue":{"href":"https://api.github.com/repos/yt-project/yt/issues/1828"},"comments":{"href":"https://api.github.com/repos/yt-project/yt/issues/1828/comments"},"review_comments":{"href":"https://api.github.com/repos/yt-project/yt/pulls/1828/comments"},"review_comment":{"href":"https://api.github.com/repos/yt-project/yt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yt-project/yt/pulls/1828/commits"},"statuses":{"href":"https://api.github.com/repos/yt-project/yt/statuses/dbd85fdfef046a36e8434349bb8e4b4a518068bd"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"AshKelly"}}