next round

This commit is contained in:
Martin Diehl 2016-03-02 11:11:20 +01:00
parent 5d7e138a9b
commit e89923d6d3
6 changed files with 17 additions and 17 deletions

View File

@ -115,7 +115,7 @@ for name in filenames:
try:
table = damask.ASCIItable(name = name,
buffered = False,
labeled = options.label != None,
labeled = options.label is not None,
readonly = True)
except: continue
damask.util.report(scriptName,name)
@ -131,15 +131,15 @@ for name in filenames:
damask.util.croak('column {} not found.'.format(options.label))
table.close(dismiss = True) # close ASCIItable and remove empty file
continue
# convert data to values between 0 and 1 and arrange according to given options
# convert data to values between 0 and 1 and arrange according to given options
if options.dimension != []: table.data = table.data.reshape(options.dimension[1],options.dimension[0])
if options.abs: table.data = np.abs(table.data)
if options.log: table.data = np.log10(table.data);options.range = np.log10(options.range)
if options.flipLR: table.data = np.fliplr(table.data)
if options.flipUD: table.data = np.flipud(table.data)
mask = np.logical_or(table.data == options.gap, np.isnan(table.data)) if options.gap else np.logical_not(np.isnan(table.data)) # mask gap and NaN (if gap present)
mask = np.logical_or(table.data == options.gap, np.isnan(table.data))\
if options.gap else np.logical_not(np.isnan(table.data)) # mask gap and NaN (if gap present)
if np.all(np.array(options.range) == 0.0):
options.range = [table.data[mask].min(),
table.data[mask].max()]
@ -176,7 +176,7 @@ for name in filenames:
im.save(sys.stdout if not name else
os.path.splitext(name)[0]+ \
('' if options.label == None else '_'+options.label)+ \
('' if options.label is None else '_'+options.label)+ \
'.png',
format = "PNG")

View File

@ -9,7 +9,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0]
scriptID = ' '.join([scriptName,damask.version])
# --------------------------------------------------------------------
# MAIN
# MAIN
# --------------------------------------------------------------------
#Borland, D., & Taylor, R. M. (2007). Rainbow Color Map (Still) Considered Harmful. Computer Graphics and Applications, IEEE, 27(2), 14--17.
#Moreland, K. (2009). Diverging Color Maps for Scientific Visualization. In Proc. 5th Int. Symp. Visual Computing (pp. 92--103).
@ -62,8 +62,8 @@ if options.trim[0] < -1.0 or \
parser.error('invalid trim range (-1 +1).')
name = options.format if options.basename == None else options.basename
output = sys.stdout if options.basename == None else open(os.path.basename(options.basename)+extensions[outtypes.index(options.format)],'w')
name = options.format if options.basename is None else options.basename
output = sys.stdout if options.basename is None else open(os.path.basename(options.basename)+extensions[outtypes.index(options.format)],'w')
colorLeft = damask.Color(options.colormodel.upper(), list(options.left))
colorRight = damask.Color(options.colormodel.upper(), list(options.right))

View File

@ -32,7 +32,7 @@ parser.set_defaults(scalar = [],
(options, filenames) = parser.parse_args()
if options.vtk == None or not os.path.exists(options.vtk):
if options.vtk is None or not os.path.exists(options.vtk):
parser.error('VTK file does not exist')
if os.path.splitext(options.vtk)[1] == '.vtu':

View File

@ -86,8 +86,8 @@ for name in filenames:
(directory,filename) = os.path.split(name)
writer.SetDataModeToBinary()
writer.SetCompressorTypeToZLib()
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]
+'.'+writer.GetDefaultFileExtension()))
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]\
+'.'+writer.GetDefaultFileExtension()))
else:
writer = vtk.vtkDataSetWriter()
writer.WriteToOutputStringOn()
@ -96,6 +96,6 @@ for name in filenames:
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(Polydata)
else: writer.SetInputData(Polydata)
writer.Write()
if name == None: sys.stdout.write(writer.GetOutputString()[0:writer.GetOutputStringLength()])
if name is None: sys.stdout.write(writer.GetOutputString()[0:writer.GetOutputStringLength()])
table.close()

View File

@ -111,6 +111,6 @@ for name in filenames:
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(rGrid)
else: writer.SetInputData(rGrid)
writer.Write()
if name == None: sys.stdout.write(writer.GetOutputString()[0:writer.GetOutputStringLength()])
if name is None: sys.stdout.write(writer.GetOutputString()[0:writer.GetOutputStringLength()])
table.close()

View File

@ -66,7 +66,7 @@ for name in filenames:
max(map(float,coords[2].keys()))-min(map(float,coords[2].keys())),\
],'d') # size from bounding box, corrected for cell-centeredness
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 equal to smallest among other spacings
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 set to smallest among other spacings
# ------------------------------------------ process data ---------------------------------------
hexPoints = np.array([[-1,-1,-1],
@ -101,8 +101,8 @@ for name in filenames:
(directory,filename) = os.path.split(name)
writer.SetDataModeToBinary()
writer.SetCompressorTypeToZLib()
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]
+'.'+writer.GetDefaultFileExtension()))
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]\
+'.'+writer.GetDefaultFileExtension()))
else:
writer = vtk.vtkDataSetWriter()
writer.WriteToOutputStringOn()
@ -111,7 +111,7 @@ for name in filenames:
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(uGrid)
else: writer.SetInputData(uGrid)
writer.Write()
if name == None: sys.stdout.write(writer.GetOutputString()[0:writer.GetOutputStringLength()])
if name is None: sys.stdout.write(writer.GetOutputString()[0:writer.GetOutputStringLength()])
table.close() # close input ASCII table