{"action":"created","comment":{"url":"https://api.github.com/repos/root-project/root/pulls/comments/182735064","pull_request_review_id":113590998,"id":182735064,"diff_hunk":"@@ -0,0 +1,46 @@\n+## \\file\n+## \\ingroup tutorial_pyroot\n+## \\notebook -nodraw\n+## This tutorial illustrates the conversion of TVec vectors to numpy arrays\n+## without copying the data.\n+## The memory-adoption is achieved by the dictionary __array_interface__, which\n+## is added dynamically to the Python objects by PyROOT.\n+##\n+## \\macro_code\n+##\n+## \\date April 2018\n+## \\author Stefan Wunsch\n+\n+import ROOT\n+from sys import exit\n+\n+\n+def main():\n+    # Create a TVec ROOT object and assign values\n+    tvec = ROOT.Experimental.VecOps.TVec(\"float\")(2)\n+    tvec[0] = 1\n+    tvec[1] = 2\n+    print(\"Content of the TVec ROOT object: {}\".format([x for x in tvec]))\n+\n+    # Interface TVec with a numpy array\n+    array = np.asarray(tvec)\n+    print(\"Content of the associated numpy array: {}\".format(\n+        [x for x in array]))\n+\n+    # The numpy array adopts the memory of the TVec without copying the content.\n+    # Note that the first entry of the numpy array changes when assigning a new\n+    # value to the first entry of the tvec.\n+    tvec[0] = 42\n+    print(\"Content of the numpy array after changing an entry of the TVec: {}\".\n+          format([x for x in array]))\n+\n+    # Use numpy features on data of ROOT objects\n+    print(\"Mean of the numpy array entries: {}\".format(np.mean(array)))\n+\n+\n+if __name__ == \"__main__\":","path":"tutorials/pyroot/pyroot001_arrayInterface.py","position":41,"original_position":41,"commit_id":"8a60b2e6f14400c8276918b33c23049c634505ef","original_commit_id":"8a60b2e6f14400c8276918b33c23049c634505ef","user":{"login":"dpiparo","id":7850302,"avatar_url":"https://avatars2.githubusercontent.com/u/7850302?v=4","gravatar_id":"","url":"https://api.github.com/users/dpiparo","html_url":"https://github.com/dpiparo","followers_url":"https://api.github.com/users/dpiparo/followers","following_url":"https://api.github.com/users/dpiparo/following{/other_user}","gists_url":"https://api.github.com/users/dpiparo/gists{/gist_id}","starred_url":"https://api.github.com/users/dpiparo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpiparo/subscriptions","organizations_url":"https://api.github.com/users/dpiparo/orgs","repos_url":"https://api.github.com/users/dpiparo/repos","events_url":"https://api.github.com/users/dpiparo/events{/privacy}","received_events_url":"https://api.github.com/users/dpiparo/received_events","type":"User","site_admin":false},"body":"Does it make sense to have this? Should the tutorial be flat? @etejedor ","created_at":"2018-04-19T12:55:41Z","updated_at":"2018-04-19T12:58:24Z","html_url":"https://github.com/root-project/root/pull/1889#discussion_r182735064","pull_request_url":"https://api.github.com/repos/root-project/root/pulls/1889","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/root-project/root/pulls/comments/182735064"},"html":{"href":"https://github.com/root-project/root/pull/1889#discussion_r182735064"},"pull_request":{"href":"https://api.github.com/repos/root-project/root/pulls/1889"}}},"pull_request":{"url":"https://api.github.com/repos/root-project/root/pulls/1889","id":182764297,"html_url":"https://github.com/root-project/root/pull/1889","diff_url":"https://github.com/root-project/root/pull/1889.diff","patch_url":"https://github.com/root-project/root/pull/1889.patch","issue_url":"https://api.github.com/repos/root-project/root/issues/1889","number":1889,"state":"open","locked":false,"title":"[PyROOT][WIP] Add tutorials for array interface and TTree.AsMatrix features","user":{"login":"stwunsch","id":6951222,"avatar_url":"https://avatars1.githubusercontent.com/u/6951222?v=4","gravatar_id":"","url":"https://api.github.com/users/stwunsch","html_url":"https://github.com/stwunsch","followers_url":"https://api.github.com/users/stwunsch/followers","following_url":"https://api.github.com/users/stwunsch/following{/other_user}","gists_url":"https://api.github.com/users/stwunsch/gists{/gist_id}","starred_url":"https://api.github.com/users/stwunsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stwunsch/subscriptions","organizations_url":"https://api.github.com/users/stwunsch/orgs","repos_url":"https://api.github.com/users/stwunsch/repos","events_url":"https://api.github.com/users/stwunsch/events{/privacy}","received_events_url":"https://api.github.com/users/stwunsch/received_events","type":"User","site_admin":false},"body":"Examples for the mentioned features. Dependent on PR #1872.","created_at":"2018-04-19T12:45:56Z","updated_at":"2018-04-19T12:58:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5f9bb1550f0158b711cf42f47354acb2735aa30","assignee":null,"assignees":[],"requested_reviewers":[{"login":"couet","id":4697738,"avatar_url":"https://avatars1.githubusercontent.com/u/4697738?v=4","gravatar_id":"","url":"https://api.github.com/users/couet","html_url":"https://github.com/couet","followers_url":"https://api.github.com/users/couet/followers","following_url":"https://api.github.com/users/couet/following{/other_user}","gists_url":"https://api.github.com/users/couet/gists{/gist_id}","starred_url":"https://api.github.com/users/couet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/couet/subscriptions","organizations_url":"https://api.github.com/users/couet/orgs","repos_url":"https://api.github.com/users/couet/repos","events_url":"https://api.github.com/users/couet/events{/privacy}","received_events_url":"https://api.github.com/users/couet/received_events","type":"User","site_admin":false},{"login":"etejedor","id":8089558,"avatar_url":"https://avatars0.githubusercontent.com/u/8089558?v=4","gravatar_id":"","url":"https://api.github.com/users/etejedor","html_url":"https://github.com/etejedor","followers_url":"https://api.github.com/users/etejedor/followers","following_url":"https://api.github.com/users/etejedor/following{/other_user}","gists_url":"https://api.github.com/users/etejedor/gists{/gist_id}","starred_url":"https://api.github.com/users/etejedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etejedor/subscriptions","organizations_url":"https://api.github.com/users/etejedor/orgs","repos_url":"https://api.github.com/users/etejedor/repos","events_url":"https://api.github.com/users/etejedor/events{/privacy}","received_events_url":"https://api.github.com/users/etejedor/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/root-project/root/pulls/1889/commits","review_comments_url":"https://api.github.com/repos/root-project/root/pulls/1889/comments","review_comment_url":"https://api.github.com/repos/root-project/root/pulls/comments{/number}","comments_url":"https://api.github.com/repos/root-project/root/issues/1889/comments","statuses_url":"https://api.github.com/repos/root-project/root/statuses/8a60b2e6f14400c8276918b33c23049c634505ef","head":{"label":"stwunsch:pyroot_tutorials","ref":"pyroot_tutorials","sha":"8a60b2e6f14400c8276918b33c23049c634505ef","user":{"login":"stwunsch","id":6951222,"avatar_url":"https://avatars1.githubusercontent.com/u/6951222?v=4","gravatar_id":"","url":"https://api.github.com/users/stwunsch","html_url":"https://github.com/stwunsch","followers_url":"https://api.github.com/users/stwunsch/followers","following_url":"https://api.github.com/users/stwunsch/following{/other_user}","gists_url":"https://api.github.com/users/stwunsch/gists{/gist_id}","starred_url":"https://api.github.com/users/stwunsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stwunsch/subscriptions","organizations_url":"https://api.github.com/users/stwunsch/orgs","repos_url":"https://api.github.com/users/stwunsch/repos","events_url":"https://api.github.com/users/stwunsch/events{/privacy}","received_events_url":"https://api.github.com/users/stwunsch/received_events","type":"User","site_admin":false},"repo":{"id":120255771,"name":"root","full_name":"stwunsch/root","owner":{"login":"stwunsch","id":6951222,"avatar_url":"https://avatars1.githubusercontent.com/u/6951222?v=4","gravatar_id":"","url":"https://api.github.com/users/stwunsch","html_url":"https://github.com/stwunsch","followers_url":"https://api.github.com/users/stwunsch/followers","following_url":"https://api.github.com/users/stwunsch/following{/other_user}","gists_url":"https://api.github.com/users/stwunsch/gists{/gist_id}","starred_url":"https://api.github.com/users/stwunsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stwunsch/subscriptions","organizations_url":"https://api.github.com/users/stwunsch/orgs","repos_url":"https://api.github.com/users/stwunsch/repos","events_url":"https://api.github.com/users/stwunsch/events{/privacy}","received_events_url":"https://api.github.com/users/stwunsch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stwunsch/root","description":"The official ROOT repository","fork":true,"url":"https://api.github.com/repos/stwunsch/root","forks_url":"https://api.github.com/repos/stwunsch/root/forks","keys_url":"https://api.github.com/repos/stwunsch/root/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stwunsch/root/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stwunsch/root/teams","hooks_url":"https://api.github.com/repos/stwunsch/root/hooks","issue_events_url":"https://api.github.com/repos/stwunsch/root/issues/events{/number}","events_url":"https://api.github.com/repos/stwunsch/root/events","assignees_url":"https://api.github.com/repos/stwunsch/root/assignees{/user}","branches_url":"https://api.github.com/repos/stwunsch/root/branches{/branch}","tags_url":"https://api.github.com/repos/stwunsch/root/tags","blobs_url":"https://api.github.com/repos/stwunsch/root/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stwunsch/root/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stwunsch/root/git/refs{/sha}","trees_url":"https://api.github.com/repos/stwunsch/root/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stwunsch/root/statuses/{sha}","languages_url":"https://api.github.com/repos/stwunsch/root/languages","stargazers_url":"https://api.github.com/repos/stwunsch/root/stargazers","contributors_url":"https://api.github.com/repos/stwunsch/root/contributors","subscribers_url":"https://api.github.com/repos/stwunsch/root/subscribers","subscription_url":"https://api.github.com/repos/stwunsch/root/subscription","commits_url":"https://api.github.com/repos/stwunsch/root/commits{/sha}","git_commits_url":"https://api.github.com/repos/stwunsch/root/git/commits{/sha}","comments_url":"https://api.github.com/repos/stwunsch/root/comments{/number}","issue_comment_url":"https://api.github.com/repos/stwunsch/root/issues/comments{/number}","contents_url":"https://api.github.com/repos/stwunsch/root/contents/{+path}","compare_url":"https://api.github.com/repos/stwunsch/root/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stwunsch/root/merges","archive_url":"https://api.github.com/repos/stwunsch/root/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stwunsch/root/downloads","issues_url":"https://api.github.com/repos/stwunsch/root/issues{/number}","pulls_url":"https://api.github.com/repos/stwunsch/root/pulls{/number}","milestones_url":"https://api.github.com/repos/stwunsch/root/milestones{/number}","notifications_url":"https://api.github.com/repos/stwunsch/root/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stwunsch/root/labels{/name}","releases_url":"https://api.github.com/repos/stwunsch/root/releases{/id}","deployments_url":"https://api.github.com/repos/stwunsch/root/deployments","created_at":"2018-02-05T04:42:26Z","updated_at":"2018-04-19T12:34:32Z","pushed_at":"2018-04-19T12:44:41Z","git_url":"git://github.com/stwunsch/root.git","ssh_url":"git@github.com:stwunsch/root.git","clone_url":"https://github.com/stwunsch/root.git","svn_url":"https://github.com/stwunsch/root","homepage":"","size":686788,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"root-project:master","ref":"master","sha":"e86c0807e225926315f2e7e13088cc0c1d44b37f","user":{"login":"root-project","id":6450093,"avatar_url":"https://avatars1.githubusercontent.com/u/6450093?v=4","gravatar_id":"","url":"https://api.github.com/users/root-project","html_url":"https://github.com/root-project","followers_url":"https://api.github.com/users/root-project/followers","following_url":"https://api.github.com/users/root-project/following{/other_user}","gists_url":"https://api.github.com/users/root-project/gists{/gist_id}","starred_url":"https://api.github.com/users/root-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/root-project/subscriptions","organizations_url":"https://api.github.com/users/root-project/orgs","repos_url":"https://api.github.com/users/root-project/repos","events_url":"https://api.github.com/users/root-project/events{/privacy}","received_events_url":"https://api.github.com/users/root-project/received_events","type":"Organization","site_admin":false},"repo":{"id":10994345,"name":"root","full_name":"root-project/root","owner":{"login":"root-project","id":6450093,"avatar_url":"https://avatars1.githubusercontent.com/u/6450093?v=4","gravatar_id":"","url":"https://api.github.com/users/root-project","html_url":"https://github.com/root-project","followers_url":"https://api.github.com/users/root-project/followers","following_url":"https://api.github.com/users/root-project/following{/other_user}","gists_url":"https://api.github.com/users/root-project/gists{/gist_id}","starred_url":"https://api.github.com/users/root-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/root-project/subscriptions","organizations_url":"https://api.github.com/users/root-project/orgs","repos_url":"https://api.github.com/users/root-project/repos","events_url":"https://api.github.com/users/root-project/events{/privacy}","received_events_url":"https://api.github.com/users/root-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/root-project/root","description":"The official ROOT repository","fork":false,"url":"https://api.github.com/repos/root-project/root","forks_url":"https://api.github.com/repos/root-project/root/forks","keys_url":"https://api.github.com/repos/root-project/root/keys{/key_id}","collaborators_url":"https://api.github.com/repos/root-project/root/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/root-project/root/teams","hooks_url":"https://api.github.com/repos/root-project/root/hooks","issue_events_url":"https://api.github.com/repos/root-project/root/issues/events{/number}","events_url":"https://api.github.com/repos/root-project/root/events","assignees_url":"https://api.github.com/repos/root-project/root/assignees{/user}","branches_url":"https://api.github.com/repos/root-project/root/branches{/branch}","tags_url":"https://api.github.com/repos/root-project/root/tags","blobs_url":"https://api.github.com/repos/root-project/root/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/root-project/root/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/root-project/root/git/refs{/sha}","trees_url":"https://api.github.com/repos/root-project/root/git/trees{/sha}","statuses_url":"https://api.github.com/repos/root-project/root/statuses/{sha}","languages_url":"https://api.github.com/repos/root-project/root/languages","stargazers_url":"https://api.github.com/repos/root-project/root/stargazers","contributors_url":"https://api.github.com/repos/root-project/root/contributors","subscribers_url":"https://api.github.com/repos/root-project/root/subscribers","subscription_url":"https://api.github.com/repos/root-project/root/subscription","commits_url":"https://api.github.com/repos/root-project/root/commits{/sha}","git_commits_url":"https://api.github.com/repos/root-project/root/git/commits{/sha}","comments_url":"https://api.github.com/repos/root-project/root/comments{/number}","issue_comment_url":"https://api.github.com/repos/root-project/root/issues/comments{/number}","contents_url":"https://api.github.com/repos/root-project/root/contents/{+path}","compare_url":"https://api.github.com/repos/root-project/root/compare/{base}...{head}","merges_url":"https://api.github.com/repos/root-project/root/merges","archive_url":"https://api.github.com/repos/root-project/root/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/root-project/root/downloads","issues_url":"https://api.github.com/repos/root-project/root/issues{/number}","pulls_url":"https://api.github.com/repos/root-project/root/pulls{/number}","milestones_url":"https://api.github.com/repos/root-project/root/milestones{/number}","notifications_url":"https://api.github.com/repos/root-project/root/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/root-project/root/labels{/name}","releases_url":"https://api.github.com/repos/root-project/root/releases{/id}","deployments_url":"https://api.github.com/repos/root-project/root/deployments","created_at":"2013-06-27T10:46:59Z","updated_at":"2018-04-19T12:57:21Z","pushed_at":"2018-04-19T12:57:07Z","git_url":"git://github.com/root-project/root.git","ssh_url":"git@github.com:root-project/root.git","clone_url":"https://github.com/root-project/root.git","svn_url":"https://github.com/root-project/root","homepage":"https://root.cern","size":686971,"stargazers_count":561,"watchers_count":561,"language":"C++","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":411,"mirror_url":null,"archived":false,"open_issues_count":56,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":411,"open_issues":56,"watchers":561,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/root-project/root/pulls/1889"},"html":{"href":"https://github.com/root-project/root/pull/1889"},"issue":{"href":"https://api.github.com/repos/root-project/root/issues/1889"},"comments":{"href":"https://api.github.com/repos/root-project/root/issues/1889/comments"},"review_comments":{"href":"https://api.github.com/repos/root-project/root/pulls/1889/comments"},"review_comment":{"href":"https://api.github.com/repos/root-project/root/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/root-project/root/pulls/1889/commits"},"statuses":{"href":"https://api.github.com/repos/root-project/root/statuses/8a60b2e6f14400c8276918b33c23049c634505ef"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dpiparo"}}