Skip to content

Commit ae5ff82

Browse files
committed
doc: update doc to work with pylopsv2
1 parent 0ba9843 commit ae5ff82

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

pyproximal/proximal/TV.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def prox(self, x, tau):
8787
x = x.reshape(self.dims)
8888
sol = x
8989
if self.ndim == 1:
90-
derivOp = FirstDerivative(self.dims[0], dims=None, dir=0, edge=False,
90+
derivOp = FirstDerivative(dims=self.dims[0], axis=0, edge=False,
9191
dtype=x.dtype, kind="forward")
9292
else:
9393
gradOp = Gradient(x.shape, edge=False, dtype=x.dtype, kind="forward")

tutorials/twist.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
==============================================
44
55
In this example we want to compare three popular solvers in compressive
6-
sensing problem, namely :py:class:`pylops.optimization.sparsity.ISTA`,
7-
:py:class:`pylops.optimization.sparsity.FISTA`, and
6+
sensing problem, namely :py:class:`pylops.optimization.sparsity.ista`,
7+
:py:class:`pylops.optimization.sparsity.fista`, and
88
:py:class:`pyproximal.optimization.primal.TwIST`.
99
1010
Whilst all solvers try to solve an unconstrained problem with a L1
@@ -38,10 +38,11 @@
3838
A = np.random.randn(N, M)
3939
A = A / np.linalg.norm(A, axis=0)
4040
Aop = pylops.MatrixMult(A)
41+
Aop.explicit = False # temporary solution whilst PyLops gets updated
4142

4243
x = np.random.rand(M)
4344
x[x < 0.9] = 0
44-
y = Aop*x
45+
y = Aop * x
4546

4647
###############################################################################
4748
# We try now to recover the sparse signal with our 3 different solvers
@@ -50,13 +51,13 @@
5051

5152
# ISTA
5253
x_ista, niteri, costi = \
53-
pylops.optimization.sparsity.ISTA(Aop, y, maxit, eps=eps, tol=1e-10,
54-
show=False, returninfo=True)
54+
pylops.optimization.sparsity.ista(Aop, y, niter=maxit, eps=eps, tol=1e-10,
55+
show=False)
5556

5657
# FISTA
5758
x_fista, niterf, costf = \
58-
pylops.optimization.sparsity.FISTA(Aop, y, maxit, eps=eps,
59-
tol=1e-10, show=False, returninfo=True)
59+
pylops.optimization.sparsity.fista(Aop, y, niter=maxit, eps=eps,
60+
tol=1e-10, show=False)
6061

6162
# TWIST (Note that since the smallest eigenvalue is zero, we arbitrarily
6263
# choose a small value for the solver to converge stably)
@@ -77,10 +78,10 @@
7778
plt.setp(m, markersize=7)
7879
m, s, b = ax.stem(x_fista, linefmt='--g', basefmt='--g',
7980
markerfmt='go', label='FISTA')
80-
plt.setp(m, markersize = 7)
81+
plt.setp(m, markersize=7)
8182
m, s, b = ax.stem(x_twist, linefmt='--b', basefmt='--b',
8283
markerfmt='bo', label='TWIST')
83-
plt.setp(m, markersize = 7)
84+
plt.setp(m, markersize=7)
8485
ax.set_title('Model', size=15, fontweight='bold')
8586
ax.legend()
8687
plt.tight_layout()

0 commit comments

Comments
 (0)