Skip to content

Commit 0e0fd3f

Browse files
authored
Merge pull request #49 from epfl-lts2/fix/fix-ci
Fix ci
2 parents 7cb5b9c + bb0d973 commit 0e0fd3f

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

examples/test_deconv_sv_psf.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,40 @@
66
"""
77

88
import numpy as np
9-
import pyunlocbox as plx
109
from scipy.signal import fftconvolve
1110

11+
import pyunlocbox as plx
12+
1213
###############################################################################
1314
# Sample data
1415
im = np.random.randn(2748, 3840)
1516
W = np.random.randn(20, np.prod(im.shape))
1617
U = np.random.randn(np.prod(im.shape), 20)
1718

19+
1820
# Setup Forward and Adjoint Models and Create Solver
1921
def forward(im):
2022
im_sim = np.zeros_like(im)
2123
for i in range(15):
22-
weight = W[i,:].reshape(*im.shape)
23-
psf_mode = U[:,i].reshape(*im.shape)
24-
im_sim += fftconvolve(im* weight, psf_mode, mode='same')
24+
weight = W[i, :].reshape(*im.shape)
25+
psf_mode = U[:, i].reshape(*im.shape)
26+
im_sim += fftconvolve(im * weight, psf_mode, mode="same")
2527
return im_sim
2628

29+
2730
def forward_adj(im):
2831
im_sim = np.zeros_like(im)
2932
for i in range(15):
30-
weight = W[i,:].reshape(*im.shape)
31-
psf_mode = U[:,i].reshape(*im.shape)
32-
im_sim += fftconvolve(im, np.flipud(np.fliplr(psf_mode)), mode='same')* weight
33+
weight = W[i, :].reshape(*im.shape)
34+
psf_mode = U[:, i].reshape(*im.shape)
35+
im_sim += fftconvolve(im, np.flipud(np.fliplr(psf_mode)), mode="same") * weight
3336
return im_sim
3437

35-
tau=10
38+
39+
tau = 10
3640
f1 = plx.functions.norm_l2(y=im, A=forward, At=forward_adj, lambda_=tau)
3741
f2 = plx.functions.norm_tv(maxit=50, dim=2)
38-
solver = plx.solvers.forward_backward(step=0.5/tau, accel=plx.acceleration.fista())
39-
ret = plx.solvers.solve([f1, f2], x0=im.copy(), solver=solver, maxit=10, verbosity='ALL')
42+
solver = plx.solvers.forward_backward(step=0.5 / tau, accel=plx.acceleration.fista())
43+
ret = plx.solvers.solve(
44+
[f1, f2], x0=im.copy(), solver=solver, maxit=10, verbosity="ALL"
45+
)

0 commit comments

Comments
 (0)