fixing prospector complaints

'except Exception': not really nice, but shell scripts will be remove
soon anyway
This commit is contained in:
Martin Diehl 2020-02-20 15:24:17 +01:00
parent d108d76a61
commit bc1d356d21
3 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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 []:

View File

@ -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
# --------------------------------------------------------------------