next round
This commit is contained in:
parent
5d7e138a9b
commit
e89923d6d3
|
@ -115,7 +115,7 @@ for name in filenames:
|
||||||
try:
|
try:
|
||||||
table = damask.ASCIItable(name = name,
|
table = damask.ASCIItable(name = name,
|
||||||
buffered = False,
|
buffered = False,
|
||||||
labeled = options.label != None,
|
labeled = options.label is not None,
|
||||||
readonly = True)
|
readonly = True)
|
||||||
except: continue
|
except: continue
|
||||||
damask.util.report(scriptName,name)
|
damask.util.report(scriptName,name)
|
||||||
|
@ -131,15 +131,15 @@ for name in filenames:
|
||||||
damask.util.croak('column {} not found.'.format(options.label))
|
damask.util.croak('column {} not found.'.format(options.label))
|
||||||
table.close(dismiss = True) # close ASCIItable and remove empty file
|
table.close(dismiss = True) # close ASCIItable and remove empty file
|
||||||
continue
|
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.dimension != []: table.data = table.data.reshape(options.dimension[1],options.dimension[0])
|
||||||
if options.abs: table.data = np.abs(table.data)
|
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.log: table.data = np.log10(table.data);options.range = np.log10(options.range)
|
||||||
if options.flipLR: table.data = np.fliplr(table.data)
|
if options.flipLR: table.data = np.fliplr(table.data)
|
||||||
if options.flipUD: table.data = np.flipud(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):
|
if np.all(np.array(options.range) == 0.0):
|
||||||
options.range = [table.data[mask].min(),
|
options.range = [table.data[mask].min(),
|
||||||
table.data[mask].max()]
|
table.data[mask].max()]
|
||||||
|
@ -176,7 +176,7 @@ for name in filenames:
|
||||||
|
|
||||||
im.save(sys.stdout if not name else
|
im.save(sys.stdout if not name else
|
||||||
os.path.splitext(name)[0]+ \
|
os.path.splitext(name)[0]+ \
|
||||||
('' if options.label == None else '_'+options.label)+ \
|
('' if options.label is None else '_'+options.label)+ \
|
||||||
'.png',
|
'.png',
|
||||||
format = "PNG")
|
format = "PNG")
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
||||||
scriptID = ' '.join([scriptName,damask.version])
|
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.
|
#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).
|
#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).')
|
parser.error('invalid trim range (-1 +1).')
|
||||||
|
|
||||||
|
|
||||||
name = options.format if options.basename == None else options.basename
|
name = options.format if options.basename is None else options.basename
|
||||||
output = sys.stdout if options.basename == None else open(os.path.basename(options.basename)+extensions[outtypes.index(options.format)],'w')
|
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))
|
colorLeft = damask.Color(options.colormodel.upper(), list(options.left))
|
||||||
colorRight = damask.Color(options.colormodel.upper(), list(options.right))
|
colorRight = damask.Color(options.colormodel.upper(), list(options.right))
|
||||||
|
|
|
@ -32,7 +32,7 @@ parser.set_defaults(scalar = [],
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
(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')
|
parser.error('VTK file does not exist')
|
||||||
|
|
||||||
if os.path.splitext(options.vtk)[1] == '.vtu':
|
if os.path.splitext(options.vtk)[1] == '.vtu':
|
||||||
|
|
|
@ -86,8 +86,8 @@ for name in filenames:
|
||||||
(directory,filename) = os.path.split(name)
|
(directory,filename) = os.path.split(name)
|
||||||
writer.SetDataModeToBinary()
|
writer.SetDataModeToBinary()
|
||||||
writer.SetCompressorTypeToZLib()
|
writer.SetCompressorTypeToZLib()
|
||||||
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]
|
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]\
|
||||||
+'.'+writer.GetDefaultFileExtension()))
|
+'.'+writer.GetDefaultFileExtension()))
|
||||||
else:
|
else:
|
||||||
writer = vtk.vtkDataSetWriter()
|
writer = vtk.vtkDataSetWriter()
|
||||||
writer.WriteToOutputStringOn()
|
writer.WriteToOutputStringOn()
|
||||||
|
@ -96,6 +96,6 @@ for name in filenames:
|
||||||
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(Polydata)
|
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(Polydata)
|
||||||
else: writer.SetInputData(Polydata)
|
else: writer.SetInputData(Polydata)
|
||||||
writer.Write()
|
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()
|
table.close()
|
||||||
|
|
|
@ -111,6 +111,6 @@ for name in filenames:
|
||||||
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(rGrid)
|
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(rGrid)
|
||||||
else: writer.SetInputData(rGrid)
|
else: writer.SetInputData(rGrid)
|
||||||
writer.Write()
|
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()
|
table.close()
|
||||||
|
|
|
@ -66,7 +66,7 @@ for name in filenames:
|
||||||
max(map(float,coords[2].keys()))-min(map(float,coords[2].keys())),\
|
max(map(float,coords[2].keys()))-min(map(float,coords[2].keys())),\
|
||||||
],'d') # size from bounding box, corrected for cell-centeredness
|
],'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 ---------------------------------------
|
# ------------------------------------------ process data ---------------------------------------
|
||||||
hexPoints = np.array([[-1,-1,-1],
|
hexPoints = np.array([[-1,-1,-1],
|
||||||
|
@ -101,8 +101,8 @@ for name in filenames:
|
||||||
(directory,filename) = os.path.split(name)
|
(directory,filename) = os.path.split(name)
|
||||||
writer.SetDataModeToBinary()
|
writer.SetDataModeToBinary()
|
||||||
writer.SetCompressorTypeToZLib()
|
writer.SetCompressorTypeToZLib()
|
||||||
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]
|
writer.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]\
|
||||||
+'.'+writer.GetDefaultFileExtension()))
|
+'.'+writer.GetDefaultFileExtension()))
|
||||||
else:
|
else:
|
||||||
writer = vtk.vtkDataSetWriter()
|
writer = vtk.vtkDataSetWriter()
|
||||||
writer.WriteToOutputStringOn()
|
writer.WriteToOutputStringOn()
|
||||||
|
@ -111,7 +111,7 @@ for name in filenames:
|
||||||
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(uGrid)
|
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(uGrid)
|
||||||
else: writer.SetInputData(uGrid)
|
else: writer.SetInputData(uGrid)
|
||||||
writer.Write()
|
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
|
table.close() # close input ASCII table
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue