##// END OF EJS Templates
Fixed erros in sfb, idualtree, irls_dn, and irls_dn2
yamaro -
r20:21
parent child
Show More
@@ -310,30 +310,32
310 chi2 = np.sum((es/sigma)**2); No newline at end of file
310 chi2 = np.sum((es/sigma)**2);
311 No newline at end of file
311
312
312
No newline at end of file
313 # --------- CS inversion using Iteratively Reweighted Least Squares (IRLS) ------------- No newline at end of file
313 # CS inversion using Iteratively Reweighted Least Squares (IRLS)------------- No newline at end of file
314 No newline at end of file
314
315 # (Use Nr, thetar, gnz, and Hr from MaxEnt above) No newline at end of file
315 # (Use Nr, thetar, gnz, and Hr from MaxEnt above)
316
316
No newline at end of file
317 Psi = deb4_basis(Nr);
317 Psi = deb4_basis(Nr); ###### REPLACED BY LINEs BELOW (?)
No newline at end of file
No newline at end of file
318
318
No newline at end of file
No newline at end of file
319 # REMOVE THIS-------------------------------- No newline at end of file
319 print 'FINALLY!'
No newline at end of file
320 print Psi.shape
No newline at end of file
321
No newline at end of file
322 # REMOVE THIS?-------------------------------- No newline at end of file
323 #wavelet1 = pywt.Wavelet('db4') No newline at end of file
320 #wavelet1 = pywt.Wavelet('db4')
324 #Phi, Psi, x = wavelet1.wavefun(level=3) No newline at end of file
321 #Phi, Psi, x = wavelet1.wavefun(level=3)
325 # -------------------------------------------- No newline at end of file
322 # --------------------------------------------
326 No newline at end of file
323
327 # add "sum to 1" constraint
324 # add "sum to 1" constraint
No newline at end of file
325 H2 = np.concatenate( (Hr, np.ones(shape=(1,Nr))), axis=0 );
328 # H2 = np.concatenate( (Hr, np.ones(shape=(1,Nr))), axis=0 );
No newline at end of file
No newline at end of file
326 N_temp = np.array([[Nr/Nt]]);
329 # N_temp = np.array([[Nr/Nt]]);
No newline at end of file
No newline at end of file
327 g2 = np.concatenate( (gnz, N_temp), axis=0 );
330 # g2 = np.concatenate( (gnz, N_temp), axis=0 );
No newline at end of file
No newline at end of file
328
331 # H2 = H2.T.conj();
No newline at end of file
No newline at end of file
329 #H2 = H2.T.conj();
332 #
No newline at end of file
No newline at end of file
330
333 # print 'H2 shape', H2.shape
No newline at end of file
No newline at end of file
331 #Psi = Psi.T.conj(); # to align matrices
334 # print 'Psi shape', Psi.shape
No newline at end of file
No newline at end of file
332
335 #
No newline at end of file
No newline at end of file
333 ####print 'H2 shape', H2.shape
336 # s = irls_dn2(np.dot(H2,Psi),g2,0.5,G); No newline at end of file
No newline at end of file
334 #####print 'Psi shape', Psi.shape
No newline at end of file
335
No newline at end of file
336 A = np.dot(H2,Psi);
No newline at end of file
337
No newline at end of file
338 s = irls_dn2(np.dot(H2,Psi),g2,0.5,G); No newline at end of file
337 # f_cs = Psi*s; No newline at end of file
339 # f_cs = Psi*s;
338 # No newline at end of file
340 #
339 # # plot No newline at end of file
341 # # plot
@@ -26,8 +26,6
26 n = np.arange(N); No newline at end of file
26 n = np.arange(N);
27 n = np.mod(n-m, N); No newline at end of file
27 n = np.mod(n-m, N);
28
28
No newline at end of file
29 print x.shape
No newline at end of file
30 No newline at end of file
31 y = x[0,n]; No newline at end of file
29 y = x[0,n];
32 No newline at end of file
30
33 No newline at end of file
31
@@ -13,8 +13,7
13 def deb4_basis(N): No newline at end of file
13 def deb4_basis(N):
14 No newline at end of file
14
15 Psi = np.zeros(shape=(N,2*N+1));
15 Psi = np.zeros(shape=(N,2*N+1));
No newline at end of file
16 idx = 0; No newline at end of file
16 idx = 1;
No newline at end of file
17 No newline at end of file
18 J = 4; No newline at end of file
17 J = 4;
19 [Faf, Fsf] = FSfarras(); No newline at end of file
18 [Faf, Fsf] = FSfarras();
20 [af, sf] = dualfilt1(); No newline at end of file
19 [af, sf] = dualfilt1();
@@ -36,7 +36,7
36 y2 = w[J][1]; No newline at end of file
36 y2 = w[J][1];
37 No newline at end of file
37
38 for j in range (J-1, 0, -1):
38 for j in range (J-1, 0, -1):
No newline at end of file
39 y2 = sfb(y2, w[j][1], sf[0,1]); No newline at end of file
39 y2 = sfb(y2, w[j][2], sf[0,1]); No newline at end of file
40 No newline at end of file
40
41 y2 = sfb(y2, w[0][1], Fsf[0,1]); No newline at end of file
41 y2 = sfb(y2, w[0][1], Fsf[0,1]);
42 No newline at end of file
42
@@ -22,12 +22,12
22 [M,N] = A.shape; No newline at end of file
22 [M,N] = A.shape;
23 # Initialize and precompute: No newline at end of file
23 # Initialize and precompute:
24 eps = 1e-2; # damping parameter
24 eps = 1e-2; # damping parameter
No newline at end of file
25
25 [Q,R] = linalg.qr(A.T.conj(),0);
No newline at end of file
No newline at end of file
26 [Q,R] = linalg.qr(A.T.conj(), mode='economic');
26 print A.shape
No newline at end of file
No newline at end of file
27
27 print R.shape
No newline at end of file
No newline at end of file
28 No newline at end of file
28 print b.shape No newline at end of file
29 c = linalg.solve(R.T.conj(),b); # will be used later also
29 c = linalg.solve(R.T.conj(),b); # will be used later also
No newline at end of file
30 u = np.dot(Q,c); # minimum 2-norm solution No newline at end of file
30 u = Q*c; # minimum 2-norm solution No newline at end of file
31 I = sps.eye(M); No newline at end of file
31 I = sps.eye(M);
32 No newline at end of file
32
33 #---------- not needed, defined above-------------- No newline at end of file
33 #---------- not needed, defined above--------------
@@ -6,6 +6,8
6 No newline at end of file
6
7 from irls_dn import * No newline at end of file
7 from irls_dn import *
8 from scipy.optimize import fsolve No newline at end of file
8 from scipy.optimize import fsolve
9 import numpy as np
No newline at end of file
10 from scipy.optimize import root No newline at end of file
9 No newline at end of file
11
10 def irls_dn2(A,b,p,G): No newline at end of file
12 def irls_dn2(A,b,p,G):
11 No newline at end of file
13
@@ -29,21 +29,12
29 No newline at end of file
29
30 N = 2*lo.size; No newline at end of file
30 N = 2*lo.size;
31 L = sf.size/2;
31 L = sf.size/2;
No newline at end of file
32 #print 'N', N
No newline at end of file
33 #print 'sf', sf
No newline at end of file
34
No newline at end of file
35
No newline at end of file
36 #print 'sf[:,0]', sf[:,0].shape
No newline at end of file
37 #print 'sf[:,1]', sf[:,1].shape
No newline at end of file
38 #print 'sbf hi', hi.shape
No newline at end of file
39
No newline at end of file
40 No newline at end of file
41 No newline at end of file
32
42 # Need to change format for upfirdn funct: No newline at end of file
33 # Need to change format for upfirdn funct:
43 lo = lo.T.conj() No newline at end of file
34 lo = lo.T.conj()
44 lo = lo.reshape(lo.size) No newline at end of file
35 lo = lo.reshape(lo.size)
45
36
No newline at end of file
37 #print 'sfb hi', hi No newline at end of file
46 print 'sfb hi', hi No newline at end of file
47 No newline at end of file
38
48 # Need to change format for upfirdn funct: No newline at end of file
39 # Need to change format for upfirdn funct:
49 hi = hi.T.conj() No newline at end of file
40 hi = hi.T.conj()
General Comments 0
You need to be logged in to leave comments. Login now