{"action":"created","comment":{"url":"https://api.github.com/repos/odlgroup/odl/pulls/comments/165783055","pull_request_review_id":74677513,"id":165783055,"diff_hunk":"@@ -0,0 +1,626 @@\n+# Copyright 2014-2017 The ODL contributors\n+#\n+# This file is part of ODL.\n+#\n+# This Source Code Form is subject to the terms of the Mozilla Public License,\n+# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n+# obtain one at https://mozilla.org/MPL/2.0/.\n+\n+\"\"\"An example of using the SPDHG algorithm to solve a PET reconstruction\n+problem with total variation prior. As we do not exploit any smoothness here\n+we only expect a 1/k convergence of the ergodic sequence in a Bregman sense.\n+\n+Note that this example uses the astra toolbox.\n+\n+Reference\n+---------\n+Chambolle, A., Ehrhardt, M. J., Richtárik, P., & Schönlieb, C.-B. (2017).\n+Stochastic Primal-Dual Hybrid Gradient Algorithm with Arbitrary Sampling and\n+Imaging Applications. Retrieved from http://arxiv.org/abs/1706.04957\n+\"\"\"\n+\n+from __future__ import print_function, division\n+import odl.contrib.solvers.spdhg as spdhg\n+import odl.contrib.datasets.images as images\n+import matplotlib.pyplot as plt\n+import matplotlib\n+import numpy as np\n+from scipy.ndimage.filters import gaussian_filter as sc_gaussian\n+from skimage.io import imsave as sk_imsave\n+import odl\n+import brewer2mpl\n+import os\n+\n+\n+folder_out = '.'  # create folder for data\n+nepochs = 300  # number of epochs\n+#nepochs = 10  # number of epochs\n+niter_target = 1000  # number of iterations for the optimal reconstruction\n+nvoxelx = 100  # set problem size\n+\n+######## not edit needed after this line ###########\n+\n+filename = 'spdhg_PET_1k_{}x{}'.format(nvoxelx, nvoxelx)\n+subfolder = '{}epochs'.format(nepochs)\n+\n+folder_main = '{}/{}'.format(folder_out, filename)\n+os.makedirs(folder_main, exist_ok=True)\n+\n+folder_today = '{}/{}'.format(folder_main, subfolder)\n+os.makedirs(folder_today, exist_ok=True)\n+\n+folder_npy = '{}/npy'.format(folder_today)\n+os.makedirs(folder_npy, exist_ok=True)\n+\n+# create geometry of operator\n+X = odl.uniform_discr(min_pt=[-20, -20], max_pt=[20, 20],\n+                      shape=[nvoxelx, nvoxelx], dtype='float32')\n+\n+geometry = odl.tomo.parallel_beam_geometry(X, num_angles=200, det_shape=200)\n+\n+G = odl.BroadcastOperator(*[odl.tomo.RayTransform(X, gi, impl='astra_cpu')\n+                            for gi in geometry])\n+\n+# create ground truth\n+Y = G.range\n+groundtruth = X.element(images.resolution_phantom(shape=X.shape))\n+clim = [0, 1]\n+tol_norm = 1.05\n+\n+# save images and data\n+file_data = '{}/data.npy'.format(folder_main)","path":"odl/contrib/solvers/spdhg/examples/spdhg_PET_1k.py","position":71,"original_position":71,"commit_id":"c1861ae49c99901e43984b56d821b163f7ca1d0e","original_commit_id":"c1861ae49c99901e43984b56d821b163f7ca1d0e","user":{"login":"adler-j","id":2202312,"avatar_url":"https://avatars2.githubusercontent.com/u/2202312?v=4","gravatar_id":"","url":"https://api.github.com/users/adler-j","html_url":"https://github.com/adler-j","followers_url":"https://api.github.com/users/adler-j/followers","following_url":"https://api.github.com/users/adler-j/following{/other_user}","gists_url":"https://api.github.com/users/adler-j/gists{/gist_id}","starred_url":"https://api.github.com/users/adler-j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adler-j/subscriptions","organizations_url":"https://api.github.com/users/adler-j/orgs","repos_url":"https://api.github.com/users/adler-j/repos","events_url":"https://api.github.com/users/adler-j/events{/privacy}","received_events_url":"https://api.github.com/users/adler-j/received_events","type":"User","site_admin":false},"body":"This should now be loadable separately, no?","created_at":"2018-02-02T23:01:38Z","updated_at":"2018-02-02T23:13:45Z","html_url":"https://github.com/odlgroup/odl/pull/1194#discussion_r165783055","pull_request_url":"https://api.github.com/repos/odlgroup/odl/pulls/1194","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/comments/165783055"},"html":{"href":"https://github.com/odlgroup/odl/pull/1194#discussion_r165783055"},"pull_request":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/1194"}}},"pull_request":{"url":"https://api.github.com/repos/odlgroup/odl/pulls/1194","id":146507460,"html_url":"https://github.com/odlgroup/odl/pull/1194","diff_url":"https://github.com/odlgroup/odl/pull/1194.diff","patch_url":"https://github.com/odlgroup/odl/pull/1194.patch","issue_url":"https://api.github.com/repos/odlgroup/odl/issues/1194","number":1194,"state":"open","locked":false,"title":"First version of SPDHG","user":{"login":"mehrhardt","id":6604653,"avatar_url":"https://avatars0.githubusercontent.com/u/6604653?v=4","gravatar_id":"","url":"https://api.github.com/users/mehrhardt","html_url":"https://github.com/mehrhardt","followers_url":"https://api.github.com/users/mehrhardt/followers","following_url":"https://api.github.com/users/mehrhardt/following{/other_user}","gists_url":"https://api.github.com/users/mehrhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/mehrhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mehrhardt/subscriptions","organizations_url":"https://api.github.com/users/mehrhardt/orgs","repos_url":"https://api.github.com/users/mehrhardt/repos","events_url":"https://api.github.com/users/mehrhardt/events{/privacy}","received_events_url":"https://api.github.com/users/mehrhardt/received_events","type":"User","site_admin":false},"body":"This is a first version of SPDHG as requested by @ozanoktem in #985. It provides a couple of algorithms that were analyzed in https://arxiv.org/abs/1706.04957 and shows their use in a similar way as in the paper. It also provides a few new tools some of which hopefully may get eventually replaced by ODL core functionality.\r\n\r\nAlthough this is part of the \"contrib\" section, I would be very grateful if you had a look and provide feedback about style but more importantly if you see that something could get implemented with other ODL functionality or just in a smarter way. ","created_at":"2017-10-13T17:05:41Z","updated_at":"2018-02-02T23:13:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a17a254d96bff7cbee0e9198c6dd430ec4f7020b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/odlgroup/odl/pulls/1194/commits","review_comments_url":"https://api.github.com/repos/odlgroup/odl/pulls/1194/comments","review_comment_url":"https://api.github.com/repos/odlgroup/odl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/odlgroup/odl/issues/1194/comments","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/c1861ae49c99901e43984b56d821b163f7ca1d0e","head":{"label":"mehrhardt:issue985_spdhg","ref":"issue985_spdhg","sha":"c1861ae49c99901e43984b56d821b163f7ca1d0e","user":{"login":"mehrhardt","id":6604653,"avatar_url":"https://avatars0.githubusercontent.com/u/6604653?v=4","gravatar_id":"","url":"https://api.github.com/users/mehrhardt","html_url":"https://github.com/mehrhardt","followers_url":"https://api.github.com/users/mehrhardt/followers","following_url":"https://api.github.com/users/mehrhardt/following{/other_user}","gists_url":"https://api.github.com/users/mehrhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/mehrhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mehrhardt/subscriptions","organizations_url":"https://api.github.com/users/mehrhardt/orgs","repos_url":"https://api.github.com/users/mehrhardt/repos","events_url":"https://api.github.com/users/mehrhardt/events{/privacy}","received_events_url":"https://api.github.com/users/mehrhardt/received_events","type":"User","site_admin":false},"repo":{"id":95028166,"name":"odl","full_name":"mehrhardt/odl","owner":{"login":"mehrhardt","id":6604653,"avatar_url":"https://avatars0.githubusercontent.com/u/6604653?v=4","gravatar_id":"","url":"https://api.github.com/users/mehrhardt","html_url":"https://github.com/mehrhardt","followers_url":"https://api.github.com/users/mehrhardt/followers","following_url":"https://api.github.com/users/mehrhardt/following{/other_user}","gists_url":"https://api.github.com/users/mehrhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/mehrhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mehrhardt/subscriptions","organizations_url":"https://api.github.com/users/mehrhardt/orgs","repos_url":"https://api.github.com/users/mehrhardt/repos","events_url":"https://api.github.com/users/mehrhardt/events{/privacy}","received_events_url":"https://api.github.com/users/mehrhardt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mehrhardt/odl","description":"Operator Discretization Library  --  https://odlgroup.github.io/odl/","fork":true,"url":"https://api.github.com/repos/mehrhardt/odl","forks_url":"https://api.github.com/repos/mehrhardt/odl/forks","keys_url":"https://api.github.com/repos/mehrhardt/odl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mehrhardt/odl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mehrhardt/odl/teams","hooks_url":"https://api.github.com/repos/mehrhardt/odl/hooks","issue_events_url":"https://api.github.com/repos/mehrhardt/odl/issues/events{/number}","events_url":"https://api.github.com/repos/mehrhardt/odl/events","assignees_url":"https://api.github.com/repos/mehrhardt/odl/assignees{/user}","branches_url":"https://api.github.com/repos/mehrhardt/odl/branches{/branch}","tags_url":"https://api.github.com/repos/mehrhardt/odl/tags","blobs_url":"https://api.github.com/repos/mehrhardt/odl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mehrhardt/odl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mehrhardt/odl/git/refs{/sha}","trees_url":"https://api.github.com/repos/mehrhardt/odl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mehrhardt/odl/statuses/{sha}","languages_url":"https://api.github.com/repos/mehrhardt/odl/languages","stargazers_url":"https://api.github.com/repos/mehrhardt/odl/stargazers","contributors_url":"https://api.github.com/repos/mehrhardt/odl/contributors","subscribers_url":"https://api.github.com/repos/mehrhardt/odl/subscribers","subscription_url":"https://api.github.com/repos/mehrhardt/odl/subscription","commits_url":"https://api.github.com/repos/mehrhardt/odl/commits{/sha}","git_commits_url":"https://api.github.com/repos/mehrhardt/odl/git/commits{/sha}","comments_url":"https://api.github.com/repos/mehrhardt/odl/comments{/number}","issue_comment_url":"https://api.github.com/repos/mehrhardt/odl/issues/comments{/number}","contents_url":"https://api.github.com/repos/mehrhardt/odl/contents/{+path}","compare_url":"https://api.github.com/repos/mehrhardt/odl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mehrhardt/odl/merges","archive_url":"https://api.github.com/repos/mehrhardt/odl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mehrhardt/odl/downloads","issues_url":"https://api.github.com/repos/mehrhardt/odl/issues{/number}","pulls_url":"https://api.github.com/repos/mehrhardt/odl/pulls{/number}","milestones_url":"https://api.github.com/repos/mehrhardt/odl/milestones{/number}","notifications_url":"https://api.github.com/repos/mehrhardt/odl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mehrhardt/odl/labels{/name}","releases_url":"https://api.github.com/repos/mehrhardt/odl/releases{/id}","deployments_url":"https://api.github.com/repos/mehrhardt/odl/deployments","created_at":"2017-06-21T17:17:04Z","updated_at":"2017-06-21T17:17:06Z","pushed_at":"2017-11-07T16:42:59Z","git_url":"git://github.com/mehrhardt/odl.git","ssh_url":"git@github.com:mehrhardt/odl.git","clone_url":"https://github.com/mehrhardt/odl.git","svn_url":"https://github.com/mehrhardt/odl","homepage":"","size":29867,"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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"odlgroup:master","ref":"master","sha":"ff6a96dbb811b2fe1ccbfcc860100da1d1f5cdc3","user":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars1.githubusercontent.com/u/15667171?v=4","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":45596393,"name":"odl","full_name":"odlgroup/odl","owner":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars1.githubusercontent.com/u/15667171?v=4","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odlgroup/odl","description":"Operator Discretization Library","fork":false,"url":"https://api.github.com/repos/odlgroup/odl","forks_url":"https://api.github.com/repos/odlgroup/odl/forks","keys_url":"https://api.github.com/repos/odlgroup/odl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odlgroup/odl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odlgroup/odl/teams","hooks_url":"https://api.github.com/repos/odlgroup/odl/hooks","issue_events_url":"https://api.github.com/repos/odlgroup/odl/issues/events{/number}","events_url":"https://api.github.com/repos/odlgroup/odl/events","assignees_url":"https://api.github.com/repos/odlgroup/odl/assignees{/user}","branches_url":"https://api.github.com/repos/odlgroup/odl/branches{/branch}","tags_url":"https://api.github.com/repos/odlgroup/odl/tags","blobs_url":"https://api.github.com/repos/odlgroup/odl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odlgroup/odl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odlgroup/odl/git/refs{/sha}","trees_url":"https://api.github.com/repos/odlgroup/odl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/{sha}","languages_url":"https://api.github.com/repos/odlgroup/odl/languages","stargazers_url":"https://api.github.com/repos/odlgroup/odl/stargazers","contributors_url":"https://api.github.com/repos/odlgroup/odl/contributors","subscribers_url":"https://api.github.com/repos/odlgroup/odl/subscribers","subscription_url":"https://api.github.com/repos/odlgroup/odl/subscription","commits_url":"https://api.github.com/repos/odlgroup/odl/commits{/sha}","git_commits_url":"https://api.github.com/repos/odlgroup/odl/git/commits{/sha}","comments_url":"https://api.github.com/repos/odlgroup/odl/comments{/number}","issue_comment_url":"https://api.github.com/repos/odlgroup/odl/issues/comments{/number}","contents_url":"https://api.github.com/repos/odlgroup/odl/contents/{+path}","compare_url":"https://api.github.com/repos/odlgroup/odl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odlgroup/odl/merges","archive_url":"https://api.github.com/repos/odlgroup/odl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odlgroup/odl/downloads","issues_url":"https://api.github.com/repos/odlgroup/odl/issues{/number}","pulls_url":"https://api.github.com/repos/odlgroup/odl/pulls{/number}","milestones_url":"https://api.github.com/repos/odlgroup/odl/milestones{/number}","notifications_url":"https://api.github.com/repos/odlgroup/odl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odlgroup/odl/labels{/name}","releases_url":"https://api.github.com/repos/odlgroup/odl/releases{/id}","deployments_url":"https://api.github.com/repos/odlgroup/odl/deployments","created_at":"2015-11-05T07:57:55Z","updated_at":"2018-02-01T15:41:00Z","pushed_at":"2018-02-02T16:10:15Z","git_url":"git://github.com/odlgroup/odl.git","ssh_url":"git@github.com:odlgroup/odl.git","clone_url":"https://github.com/odlgroup/odl.git","svn_url":"https://github.com/odlgroup/odl","homepage":"","size":33057,"stargazers_count":48,"watchers_count":48,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":29,"mirror_url":null,"archived":false,"open_issues_count":184,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":29,"open_issues":184,"watchers":48,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/1194"},"html":{"href":"https://github.com/odlgroup/odl/pull/1194"},"issue":{"href":"https://api.github.com/repos/odlgroup/odl/issues/1194"},"comments":{"href":"https://api.github.com/repos/odlgroup/odl/issues/1194/comments"},"review_comments":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/1194/comments"},"review_comment":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/1194/commits"},"statuses":{"href":"https://api.github.com/repos/odlgroup/odl/statuses/c1861ae49c99901e43984b56d821b163f7ca1d0e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"adler-j"}}