From 80dc23d93d432c7c14b811c391c11527a2739519 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 1 Mar 2016 21:11:43 +0100 Subject: [PATCH] following "prospector -t pep8 -t pyflakes -t dodgy -t profile-validator -t pep257" --- processing/post/addIPFcolor.py | 12 ++++++------ processing/post/addMapped.py | 6 +++--- processing/post/addNorm.py | 2 +- processing/post/addOrientations.py | 12 ++++++------ processing/post/addPole.py | 14 +++++++------- processing/post/addQuaternions.py | 4 ++-- processing/post/addSchmidfactors.py | 6 +++--- processing/post/addSpectralDecomposition.py | 2 +- processing/post/addStrainTensors.py | 4 ++-- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/processing/post/addIPFcolor.py b/processing/post/addIPFcolor.py index a66f55290..24aeb3fa0 100755 --- a/processing/post/addIPFcolor.py +++ b/processing/post/addIPFcolor.py @@ -62,12 +62,12 @@ parser.set_defaults(pole = (0.0,0.0,1.0), (options, filenames) = parser.parse_args() -input = [options.eulers != None, - options.a != None and \ - options.b != None and \ - options.c != None, - options.matrix != None, - options.quaternion != None, +input = [options.eulers is not None, + options.a is not None and \ + options.b is not None and \ + options.c is not None, + options.matrix is not None, + options.quaternion is not None, ] if np.sum(input) != 1: parser.error('needs exactly one input format.') diff --git a/processing/post/addMapped.py b/processing/post/addMapped.py index f2dc966ab..2ce84959c 100755 --- a/processing/post/addMapped.py +++ b/processing/post/addMapped.py @@ -39,14 +39,14 @@ parser.set_defaults(offset = 0, (options,filenames) = parser.parse_args() -if options.label == None: +if options.label is None: parser.error('no data columns specified.') -if options.map == None: +if options.map is None: parser.error('no mapping column given.') # ------------------------------------------ process mapping ASCIItable --------------------------- -if options.asciitable != None and os.path.isfile(options.asciitable): +if options.asciitable is not None and os.path.isfile(options.asciitable): mappedTable = damask.ASCIItable(name = options.asciitable, buffered = False, readonly = True) diff --git a/processing/post/addNorm.py b/processing/post/addNorm.py index 725321953..3aa9e8c04 100755 --- a/processing/post/addNorm.py +++ b/processing/post/addNorm.py @@ -43,7 +43,7 @@ parser.set_defaults(norm = 'frobenius', (options,filenames) = parser.parse_args() -if options.label == None: +if options.label is None: parser.error('no data column specified.') # --- loop over input files ------------------------------------------------------------------------- diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index 1f5ce14e7..912497d95 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -74,12 +74,12 @@ options.output = map(lambda x: x.lower(), options.output) if options.output == [] or (not set(options.output).issubset(set(outputChoices))): parser.error('output must be chosen from {}.'.format(', '.join(outputChoices))) -input = [options.eulers != None, - options.a != None and \ - options.b != None and \ - options.c != None, - options.matrix != None, - options.quaternion != None, +input = [options.eulers is not None, + options.a is not None and \ + options.b is not None and \ + options.c is not None, + options.matrix is not None, + options.quaternion is not None, ] if np.sum(input) != 1: parser.error('needs exactly one input format.') diff --git a/processing/post/addPole.py b/processing/post/addPole.py index f7d64f4a5..c8e3991ee 100755 --- a/processing/post/addPole.py +++ b/processing/post/addPole.py @@ -62,12 +62,12 @@ parser.set_defaults(pole = (1.0,0.0,0.0), (options, filenames) = parser.parse_args() -input = [options.eulers != None, - options.a != None and \ - options.b != None and \ - options.c != None, - options.matrix != None, - options.quaternion != None, +input = [options.eulers is not None, + options.a is not None and \ + options.b is not None and \ + options.c is not None, + options.matrix is not None, + options.quaternion is not None, ] if np.sum(input) != 1: parser.error('needs exactly one input format.') @@ -133,7 +133,7 @@ for name in filenames: rotatedPole = o.quaternion*pole # rotate pole according to crystal orientation (x,y) = rotatedPole[0:2]/(1.+abs(pole[2])) # stereographic projection - table.data_append([np.sqrt(x*x+y*y),np.arctan2(y,x)] if options.polar else [x,y]) # cartesian coordinates + table.data_append([np.sqrt(x*x+y*y),np.arctan2(y,x)] if options.polar else [x,y]) # cartesian coordinates outputAlive = table.data_write() # output processed line diff --git a/processing/post/addQuaternions.py b/processing/post/addQuaternions.py index a35ab62a9..db6276fc5 100755 --- a/processing/post/addQuaternions.py +++ b/processing/post/addQuaternions.py @@ -26,14 +26,14 @@ parser.set_defaults(frame = None) (options,filenames) = parser.parse_args() -if options.frame == None: +if options.frame is None: parser.error('no data column specified...') datainfo = {'len':4, 'label':[] } -if options.frame != None: datainfo['label'] += options.frame +if options.frame is not None: datainfo['label'] += options.frame # --- loop over input files ------------------------------------------------------------------------- diff --git a/processing/post/addSchmidfactors.py b/processing/post/addSchmidfactors.py index c3656a9b8..c61bb6cee 100755 --- a/processing/post/addSchmidfactors.py +++ b/processing/post/addSchmidfactors.py @@ -203,7 +203,7 @@ slipdirection = { \ } def applyEulers(phi1,Phi,phi2,x): - """ transform x given in crystal coordinates to xbar returned in lab coordinates for Euler angles phi1,Phi,phi2 """ + """transform x given in crystal coordinates to xbar returned in lab coordinates for Euler angles phi1,Phi,phi2""" eulerRot = [[ math.cos(phi1)*math.cos(phi2) - math.cos(Phi)*math.sin(phi1)*math.sin(phi2), -math.cos(phi1)*math.sin(phi2) - math.cos(Phi)*math.cos(phi2)*math.sin(phi1), @@ -285,8 +285,8 @@ datainfo = { datainfo['vector']['label'] += [options.eulers] toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians - -if options.lattice=='hex': # Convert 4 Miller indices notation of hex to orthogonal 3 Miller indices notation +# Convert 4 Miller indices notation of hex to orthogonal 3 Miller indices notation +if options.lattice=='hex': for i in range(Nslipsystems[options.lattice]): slipnormal[options.lattice][i][0]=slipnormal_temp[i][0] slipnormal[options.lattice][i][1]=(slipnormal_temp[i][0]+2.0*slipnormal_temp[i][1])/math.sqrt(3.0) diff --git a/processing/post/addSpectralDecomposition.py b/processing/post/addSpectralDecomposition.py index cc9bbe181..0555bb5bc 100755 --- a/processing/post/addSpectralDecomposition.py +++ b/processing/post/addSpectralDecomposition.py @@ -25,7 +25,7 @@ parser.add_option('-t','--tensor', (options,filenames) = parser.parse_args() -if options.tensor == None: +if options.tensor is None: parser.error('no data column specified.') # --- loop over input files ------------------------------------------------------------------------- diff --git a/processing/post/addStrainTensors.py b/processing/post/addStrainTensors.py index 8cccdb2f2..bd5d7fccf 100755 --- a/processing/post/addStrainTensors.py +++ b/processing/post/addStrainTensors.py @@ -10,7 +10,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) def operator(stretch,strain,eigenvalues): - ''' Albrecht Bertram: Elasticity and Plasticity of Large Deformations An Introduction (3rd Edition, 2012), p. 102 ''' + """Albrecht Bertram: Elasticity and Plasticity of Large Deformations An Introduction (3rd Edition, 2012), p. 102""" return { 'V#ln': np.log(eigenvalues) , 'U#ln': np.log(eigenvalues) , @@ -75,7 +75,7 @@ if options.logarithmic: strains.append('ln') if options.biot: strains.append('Biot') if options.green: strains.append('Green') -if options.defgrad == None: +if options.defgrad is None: parser.error('no data column specified.') # --- loop over input files -------------------------------------------------------------------------