Esempio n. 1
0
 def test_03(self):
     x = np.linspace(-1, 1, 21)
     sprm, sfvl, fvmx, sidx = mpiutil.grid_search(fnv, (x, ), self.comm)
     assert np.abs(sprm[0][0] - 0.1) < 1e-14
     assert np.abs(sprm[0][1] - 0.5) < 1e-14
     assert sidx[0][0] == 11
     assert sidx[0][1] == 15
Esempio n. 2
0
 def test_02(self):
     x = np.linspace(-1, 1, 21)
     sprm, sfvl, fvmx, sidx = mpiutil.grid_search(fnv, (x,), self.comm)
     assert np.abs(sprm[0][0] - 0.1) < 1e-14
     assert np.abs(sprm[0][1] - 0.5) < 1e-14
     assert sidx[0][0] == 11
     assert sidx[0][1] == 15
Esempio n. 3
0
opt_par = comcbpdn.ComplexConvBPDN.Options({'FastSolve': True, 'Verbose': True, 'StatusHeader': False,
                                            'MaxMainIter': Maxiter,'RelStopTol': 5e-5, 'AuxVarObj': True,
                                            'RelaxParam': 1.515,'AutoRho': {'Enabled': True}})

s_clean = np.reshape(s_clean, (-1,1,1,K))
s_noise = np.reshape(s_noise, (-1,1,1,K))

s_test = s_noise[:,:,:,0].squeeze()
s_test = s_test[:,np.newaxis]

D0 = np.reshape(D0,(-1,1,1,M))
D0_d = D0.squeeze()

# Parallel evaluation of error function on lmbda grid
lrng = np.logspace(-5,3,1000)
sprm, sfvl, fvmx, sidx = mpiutil.grid_search(evalerr, (lrng,))
lmbda = sprm[0]
print('Minimum ℓ1 error: %5.2f at 𝜆 = %.2e' % (sfvl, lmbda))
fig, ax = plot.subplots(figsize=(19.5, 8))
plot.plot(fvmx, x=lrng, ptyp='semilogx',title='original 𝜆 = %.2e' % lmbda, xlbl='$\lambda$',
          ylbl='Error', fig=fig)
fig.show()

lmbda = lmbda/2
cri = cnvrep.CDU_ConvRepIndexing(D0.shape, s_noise)

optx = comcbpdn.ComplexConvBPDN.Options({'Verbose': False, 'MaxMainIter': 1,
            'rho': 8.13e+01,'AuxVarObj': False})

optd = comccmod.ComConvCnstrMODOptions({'Verbose': False, 'MaxMainIter': 1,
            'rho': 10, 'ZeroMean': True},