fix time watch

Former-commit-id: e5f873d940f487d69a097149578fe0f6a1f24159
This commit is contained in:
Marek Nečada 2016-07-18 16:10:50 +03:00
parent bf5d6e23a4
commit ef7b2dc66c
1 changed files with 9 additions and 3 deletions

View File

@ -1014,7 +1014,7 @@ def scatter_plane_wave_rectarray(omega, epsilon_b, xN, yN, xd, yd, TMatrices, k_
""" """
if (watch_time): if (watch_time):
timec = time.time() timec = time.time()
print('%.4f: running staccet_plane_wave_rectarray' % timec, file = sys.stderr) print('%.4f: running scatter_plane_wave_rectarray' % timec, file = sys.stderr)
nelem = TMatrices.shape[-1] nelem = TMatrices.shape[-1]
if ((nelem != TMatrices.shape[-3]) or (2 != TMatrices.shape[-2]) or (2 != TMatrices.shape[-4])): if ((nelem != TMatrices.shape[-3]) or (2 != TMatrices.shape[-2]) or (2 != TMatrices.shape[-4])):
raise ValueError('The T-matrices must be of shape (N, 2, nelem, 2, nelem) but are of shape %s' % (str(TMatrices.shape),)) raise ValueError('The T-matrices must be of shape (N, 2, nelem, 2, nelem) but are of shape %s' % (str(TMatrices.shape),))
@ -1075,7 +1075,8 @@ def scatter_plane_wave_rectarray(omega, epsilon_b, xN, yN, xd, yd, TMatrices, k_
if (watch_time): if (watch_time):
timecold = timec timecold = timec
timec = time.time() timec = time.time()
print('%4f: translation matrix filled (elapsed %.2f s)' % (timec, timec-timecold), file=sys.stderr) print('%4f: translation matrix filled (elapsed %.2f s), building the interaction matrix'
% (timec, timec-timecold), file=sys.stderr)
# Now we solve a linear problem (1 - M T) A = M P_0 where M is the T-matrix :-) # Now we solve a linear problem (1 - M T) A = M P_0 where M is the T-matrix :-)
MT = np.empty((N,2,nelem,N,2,nelem),dtype=np.complex_) MT = np.empty((N,2,nelem,N,2,nelem),dtype=np.complex_)
@ -1087,6 +1088,11 @@ def scatter_plane_wave_rectarray(omega, epsilon_b, xN, yN, xd, yd, TMatrices, k_
MT.shape = (N*2*nelem, N*2*nelem) MT.shape = (N*2*nelem, N*2*nelem)
leftmatrix = np.identity(N*2*nelem) - MT leftmatrix = np.identity(N*2*nelem) - MT
MT = None MT = None
if (watch_time):
timecold = timec
timec = time.time()
print('%.4f: interaction matrix complete (elapsed %.2f s)' % (timec, timec-timecold),
file=sys.stderr)
if ((1 == k_dirs.ndim) and (1 == E_0s.ndim)): if ((1 == k_dirs.ndim) and (1 == E_0s.ndim)):
k_cart = k_dirs * k_out # wave vector of the incident plane wave k_cart = k_dirs * k_out # wave vector of the incident plane wave
@ -1132,7 +1138,7 @@ def scatter_plane_wave_rectarray(omega, epsilon_b, xN, yN, xd, yd, TMatrices, k_
leftmatrix = None leftmatrix = None
if watch_time: if watch_time:
timec = time.time() timec = time.time()
print('%.4f: factorization complete (elapsed %.2 s)' % (timec, timec-timecold), print('%.4f: factorization complete (elapsed %.2f s)' % (timec, timec-timecold),
file = sys.stderr) file = sys.stderr)
print('%.4f: solving the scattering problem for %d incoming waves' % (timec, K), print('%.4f: solving the scattering problem for %d incoming waves' % (timec, K),
file=sys.stderr) file=sys.stderr)