diff --git a/processing/post/filterTable.py b/processing/post/filterTable.py index c7f499aca..494257a60 100755 --- a/processing/post/filterTable.py +++ b/processing/post/filterTable.py @@ -21,7 +21,7 @@ def sortingList(labels,whitelistitems): names = [] for label in labels: - if re.match('^\d+_',label): + if re.match(r'^\d+_',label): indices.append(int(label.split('_',1)[0])) names.append(label.split('_',1)[1]) else: @@ -144,7 +144,7 @@ for name in filenames: try: table.data_readArray(positions+1) # read desired columns (indexed 1,...) table.data_writeArray() # directly write out - except: + except Exception: table.data_rewind() atOnce = False # data contains items that prevent array chunking diff --git a/processing/post/groupTable.py b/processing/post/groupTable.py index f2d1198bc..a73e7d505 100755 --- a/processing/post/groupTable.py +++ b/processing/post/groupTable.py @@ -11,11 +11,12 @@ import damask def periodicAverage(coords, limits): - """Centroid in periodic domain, see https://en.wikipedia.org/wiki/Center_of_mass#Systems_with_periodic_boundary_conditions""" + """Centroid in periodic domain, see https://en.wikipedia.org/wiki/Center_of_mass#Systems_with_periodic_boundary_conditions.""" theta = 2.0*np.pi * (coords - limits[0])/(limits[1] - limits[0]) theta_avg = np.pi + np.arctan2(-np.sin(theta).mean(axis=0), -np.cos(theta).mean(axis=0)) return limits[0] + theta_avg * (limits[1] - limits[0])/2.0/np.pi + scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) @@ -73,7 +74,7 @@ try: globals().get(funcModule) or __import__(funcModule), funcName) -except: +except Exception: mapFunction = None if options.label is []: diff --git a/processing/pre/seeds_fromRandom.py b/processing/pre/seeds_fromRandom.py index cea6a05ec..c64e6cc4f 100755 --- a/processing/pre/seeds_fromRandom.py +++ b/processing/pre/seeds_fromRandom.py @@ -14,7 +14,7 @@ scriptID = ' '.join([scriptName,damask.version]) # ------------------------------------------ aux functions --------------------------------- def kdtree_search(cloud, queryPoints): - """Find distances to nearest neighbor among cloud (N,d) for each of the queryPoints (n,d)""" + """Find distances to nearest neighbor among cloud (N,d) for each of the queryPoints (n,d).""" n = queryPoints.shape[0] distances = np.zeros(n,dtype=float) tree = spatial.cKDTree(cloud) @@ -23,7 +23,8 @@ def kdtree_search(cloud, queryPoints): distances[i], index = tree.query(queryPoints[i]) return distances - + + # -------------------------------------------------------------------- # MAIN # --------------------------------------------------------------------