flake8 code cleanups.

这个提交包含在:
Craig Warren
2016-11-18 11:03:03 +00:00
父节点 d72ee36ebb
当前提交 b918f91663
共有 10 个文件被更改,包括 91 次插入103 次删除

查看文件

@@ -391,7 +391,7 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
if all(value == 0 for value in G.pmlthickness.values()):
if G.messages:
print('PML boundaries: switched off')
pass # If all the PMLs are switched off don't need to build anything
pass # If all the PMLs are switched off don't need to build anything
else:
if G.messages:
if all(value == G.pmlthickness['xminus'] for value in G.pmlthickness.values()):

查看文件

@@ -79,7 +79,7 @@ class FDTDGrid(Grid):
self.messages = True
self.tqdmdisable = False
# Threshold (dB) down from maximum power (0dB) of main frequency used to calculate highest frequency for disperion analysis
# Threshold (dB) down from maximum power (0dB) of main frequency used to calculate highest frequency for disperion analysis
self.highestfreqthres = 60
# Maximum allowable percentage physical phase-velocity phase error
self.maxnumericaldisp = 2

查看文件

@@ -277,7 +277,6 @@ def edge(xs, ys, zs, xf, yf, zf, material, rotate90origin=()):
polarisation = 'x '
xs, ys, xf, yf = rotate90_edge(xs, ys, xf, yf, polarisation, rotate90origin)
s = Coordinate(xs, ys, zs)
f = Coordinate(xf, yf, zf)
command('edge', s, f, material)

查看文件

@@ -181,23 +181,23 @@ def process_materials(G):
materialtext.append('{:g}'.format(material.se))
if Material.maxpoles > 0:
if 'debye' in material.type:
materialtext.append(', '.join('{:g}'.format(deltaer) for deltaer in material.deltaer))
materialtext.append(', '.join('{:g}'.format(tau) for tau in material.tau))
materialtext.append(', '.join('{:g}'.format(deltaer for deltaer in material.deltaer)))
materialtext.append(', '.join('{:g}'.format(tau for tau in material.tau)))
materialtext.append('')
materialtext.append('')
materialtext.append('')
elif 'lorentz' in material.type:
materialtext.append(', '.join('{:g}'.format(deltaer) for deltaer in material.deltaer))
materialtext.append(', '.join('{:g}'.format(deltaer for deltaer in material.deltaer)))
materialtext.append('')
materialtext.append(', '.join('{:g}'.format(tau) for tau in material.tau))
materialtext.append(', '.join('{:g}'.format(alpha) for alpha in material.alpha))
materialtext.append(', '.join('{:g}'.format(tau for tau in material.tau)))
materialtext.append(', '.join('{:g}'.format(alpha for alpha in material.alpha)))
materialtext.append('')
elif 'drude' in material.type:
materialtext.append('')
materialtext.append('')
materialtext.append(', '.join('{:g}'.format(tau) for tau in material.tau))
materialtext.append(', '.join('{:g}'.format(tau for tau in material.tau)))
materialtext.append('')
materialtext.append(', '.join('{:g}'.format(alpha) for tau in material.alpha))
materialtext.append(', '.join('{:g}'.format(alpha for alpha in material.alpha)))
else:
materialtext.append('')
materialtext.append('')

查看文件

@@ -374,11 +374,11 @@ class PlaneWave(Source):
self.zf = 0
# Spherical coordinates defining incident unit wavevector (k)
self.theta = 0 # 0 <= theta <= 180
self.phi = 0 # 0 <= phi <= 360
self.theta = 0 # 0 <= theta <= 180
self.phi = 0 # 0 <= phi <= 360
# Angle that incident electric field makes with k cross z
self.psi = 0 # 0 <= psi <= 360
self.psi = 0 # 0 <= psi <= 360
def calculate_origin(self, G):
"""Calculate origin of TF/SF interface with incident wavefront."""
@@ -433,25 +433,14 @@ class PlaneWave(Source):
self.psi = np.deg2rad(self.psi)
# Components of incident unit wavevector
self.kx = np.sin(theta) * np.cos(phi)
self.ky = np.sin(theta) * np.sin(phi)
self.kz = np.cos(theta)
self.kx = np.sin(self.theta) * np.cos(self.phi)
self.ky = np.sin(self.theta) * np.sin(self.phi)
self.kz = np.cos(self.theta)
# Components of incident field vectors
self.Exinc = np.cos(psi) * np.sin(phi) - np.sin(psi) * np.cos(theta) * np.cos(phi)
self.Eyinc = -np.cos(psi) * np.cos(phi) - np.sin(psi) * np.cos(theta) * np.sin(phi)
self.Ezinc = np.sin(psi) * np.sin(theta)
self.Hxinc = np.sin(psi) * np.sin(phi) + np.cos(psi) * np.cos(theta) * np.cos(phi)
self.Hyinc = -np.sin(psi) * np.cos(phi) + np.cos(psi) * np.cos(theta) * np.sin(phi)
self.Hzinc = -np.cos(psi) * np.sin(theta)
self.Exinc = np.cos(self.psi) * np.sin(self.phi) - np.sin(self.psi) * np.cos(self.theta) * np.cos(self.phi)
self.Eyinc = -np.cos(self.psi) * np.cos(self.phi) - np.sin(self.psi) * np.cos(self.theta) * np.sin(self.phi)
self.Ezinc = np.sin(self.psi) * np.sin(self.theta)
self.Hxinc = np.sin(self.psi) * np.sin(self.phi) + np.cos(self.psi) * np.cos(self.theta) * np.cos(self.phi)
self.Hyinc = -np.sin(self.psi) * np.cos(self.phi) + np.cos(self.psi) * np.cos(self.theta) * np.sin(self.phi)
self.Hzinc = -np.cos(self.psi) * np.sin(self.theta)