next round
This commit is contained in:
parent
5d7e138a9b
commit
e89923d6d3
|
@ -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,7 +131,6 @@ 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
|
||||
if options.dimension != []: table.data = table.data.reshape(options.dimension[1],options.dimension[0])
|
||||
if options.abs: table.data = np.abs(table.data)
|
||||
|
@ -139,7 +138,8 @@ for name in filenames:
|
|||
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")
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -86,7 +86,7 @@ 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.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]\
|
||||
+'.'+writer.GetDefaultFileExtension()))
|
||||
else:
|
||||
writer = vtk.vtkDataSetWriter()
|
||||
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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,7 +101,7 @@ 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.SetFileName(os.path.join(directory,os.path.splitext(filename)[0]\
|
||||
+'.'+writer.GetDefaultFileExtension()))
|
||||
else:
|
||||
writer = vtk.vtkDataSetWriter()
|
||||
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue