From 43702a00c888b4d3f60362ee56bd65de85594ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Wed, 17 May 2017 13:34:54 +0300 Subject: [PATCH] Cosmetics Former-commit-id: f7a02a39ae67af4fb835892be4ff8356f3e91c9d --- misc/finitesqlatzsym-scatter.py | 13 +++++-------- qpms/lattices.py | 4 ++++ setup.py | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/misc/finitesqlatzsym-scatter.py b/misc/finitesqlatzsym-scatter.py index b7e9d28..7715e67 100755 --- a/misc/finitesqlatzsym-scatter.py +++ b/misc/finitesqlatzsym-scatter.py @@ -75,7 +75,8 @@ for i in unitcell_indices: parser.add_argument('--frequency_multiplier', action='store', type=float, default=1., help='Multiplies the frequencies in the TMatrix file by a given factor.') # TODO enable more flexible per-sublattice specification pargs=parser.parse_args() -print(pargs) +if pargs.verbose: + print(pargs, file = sys.stderr) maxlayer=pargs.maxlayer eVfreq = pargs.eVfreq @@ -104,7 +105,8 @@ for oparg in pargs.ops: ops.append(((opm.group(2),) if opm.group(2) else unitcell_indices, opm.group(1), oparg[1])) else: raise # should not happen -print(ops) +if(verbose): + print(ops, file = sys.stderr) # -----------------finished basic CLI parsing (except for op arguments) ------------------ @@ -129,12 +131,9 @@ if pargs.lMax: lMax = pargs.lMax if pargs.lMax else lMaxTM my, ny = qpms.get_mn_y(lMax) nelem = len(my) -print(TMatrices_orig.shape) if pargs.lMax: #force commandline specified lMax TMatrices_orig = TMatrices_orig[...,0:nelem,:,0:nelem] -print(TMatrices_orig.shape) TMatrices = np.array(np.broadcast_to(TMatrices_orig[:,nx,:,:,:,:],(len(freqs_orig),unitcell_size,2,nelem,2,nelem)) ) -print(TMatrices.shape) xfl = qpms.xflip_tyty(lMax) yfl = qpms.yflip_tyty(lMax) zfl = qpms.zflip_tyty(lMax) @@ -221,7 +220,6 @@ for op in ops: else: raise #unknown operation; should not happen -print(TMatrices.shape) TMatrices_interp = interpolate.interp1d(freqs_orig*interpfreqfactor, TMatrices, axis=0, kind='linear',fill_value="extrapolate") @@ -241,12 +239,11 @@ kz = np.sqrt(k_0 - (kx ** 2 + ky ** 2)) klist_full = np.stack((kx,ky,kz), axis=-1).reshape((-1,3)) TMatrices_om = TMatrices_interp(freq) -print(TMatrices_om.shape) chunkn = math.ceil(klist_full.size / 3 / chunklen) if verbose: - print('Evaluating %d k-points in %d chunks' % (klist_full.size / 3, chunkn), file = sys.stderr) + print('Evaluating %d k-points' % klist_full.size + ('in %d chunks'%chunkn) if chunkn>1 else '' , file = sys.stderr) sys.stderr.flush() try: diff --git a/qpms/lattices.py b/qpms/lattices.py index 80f1c12..41b428a 100644 --- a/qpms/lattices.py +++ b/qpms/lattices.py @@ -209,13 +209,17 @@ class Scattering_2D_zsym(Scattering): if not self.prepared_TE: if self.interaction_matrix_TE is None: self.build_interaction_matrix(0, verbose) + sbtime = _time_b(verbose, step = 'Calculating LU decomposition of the interaction matrix, TE part') self.lupiv_TE = scipy.linalg.lu_factor(self.interaction_matrix_TE, overwrite_a = not keep_interaction_matrix) + _time_e(sbtime, verbose, step = 'Calculating LU decomposition of the interaction matrix, TE part') self.prepared_TE = True if (TE_or_TM == 1): #TM if not self.prepared_TM: if self.interaction_matrix_TM is None: self.build_interaction_matrix(1, verbose) + sbtime = _time_b(verbose, step = 'Calculating LU decomposition of the interaction matrix, TM part') self.lupiv_TM = scipy.linalg.lu_factor(self.interaction_matrix_TM, overwrite_a = not keep_interaction_matrix) + _time_e(sbtime, verbose, step = 'Calculating LU decomposition of the interaction matrix, TM part') self.prepared_TM = True _time_e(btime, verbose) diff --git a/setup.py b/setup.py index f004452..c696a9a 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ qpms_c = Extension('qpms_c', ) setup(name='qpms', - version = "0.2.12", + version = "0.2.13", packages=['qpms'], # setup_requires=['setuptools_cython'], install_requires=['cython>=0.21','quaternion','spherical_functions','py_gmm'],