improved and simplified reporting
This commit is contained in:
parent
59c6c5cfe4
commit
b69f0efbbc
|
@ -104,7 +104,6 @@ for name in filenames:
|
|||
geom = damask.Geom.from_file(virt_file)
|
||||
else:
|
||||
geom = damask.Geom.from_file(name)
|
||||
damask.util.croak(geom)
|
||||
microstructure = geom.get_microstructure()
|
||||
|
||||
fill = options.fill if options.fill is not None else np.nanmax(microstructure)+1
|
||||
|
|
|
@ -51,7 +51,6 @@ for name in filenames:
|
|||
geom = damask.Geom.from_file(virt_file)
|
||||
else:
|
||||
geom = damask.Geom.from_file(name)
|
||||
damask.util.croak(geom)
|
||||
microstructure = geom.get_microstructure()
|
||||
|
||||
grid = geom.get_grid()
|
||||
|
|
|
@ -49,7 +49,6 @@ for name in filenames:
|
|||
geom = damask.Geom.from_file(virt_file)
|
||||
else:
|
||||
geom = damask.Geom.from_file(name)
|
||||
damask.util.croak(geom)
|
||||
microstructure = geom.get_microstructure()
|
||||
|
||||
microstructure = ndimage.filters.generic_filter(microstructure,mostFrequent,
|
||||
|
|
|
@ -55,7 +55,6 @@ for name in filenames:
|
|||
geom = damask.Geom.from_file(virt_file)
|
||||
else:
|
||||
geom = damask.Geom.from_file(name)
|
||||
damask.util.croak(geom)
|
||||
microstructure = geom.microstructure
|
||||
|
||||
if 'z' in options.directions:
|
||||
|
|
|
@ -36,7 +36,6 @@ for name in filenames:
|
|||
geom = damask.Geom.from_file(virt_file)
|
||||
else:
|
||||
geom = damask.Geom.from_file(name)
|
||||
damask.util.croak(geom)
|
||||
microstructure = geom.get_microstructure()
|
||||
|
||||
renumbered = np.copy(microstructure)
|
||||
|
|
|
@ -46,7 +46,6 @@ for name in filenames:
|
|||
geom = damask.Geom.from_file(virt_file)
|
||||
else:
|
||||
geom = damask.Geom.from_file(name)
|
||||
damask.util.croak(geom)
|
||||
microstructure = geom.get_microstructure()
|
||||
|
||||
scale = geom.get_grid().astype('float')
|
||||
|
|
|
@ -78,7 +78,6 @@ for name in filenames:
|
|||
geom = damask.Geom.from_file(virt_file)
|
||||
else:
|
||||
geom = damask.Geom.from_file(name)
|
||||
damask.util.croak(geom)
|
||||
microstructure = geom.get_microstructure()
|
||||
|
||||
fill = options.fill if options.fill is not None else np.nanmax(microstructure)+1
|
||||
|
|
|
@ -56,6 +56,7 @@ for name in filenames:
|
|||
zz = np.repeat(z,grid[0]*grid[1])
|
||||
|
||||
# ------------------------------------------ finalize output ---------------------------------------
|
||||
|
||||
table = damask.ASCIItable(outname = os.path.splitext(name)[0]+'.txt' if name else name)
|
||||
table.info_append([scriptID + '\t' + ' '.join(sys.argv[1:])] + geom.get_comments())
|
||||
table.labels_append(['{}_{}'.format(1+i,'pos') for i in range(3)]+['microstructure'])
|
||||
|
|
|
@ -58,7 +58,6 @@ for name in filenames:
|
|||
geom = damask.Geom.from_file(virt_file)
|
||||
else:
|
||||
geom = damask.Geom.from_file(name)
|
||||
damask.util.croak(geom)
|
||||
microstructure = geom.get_microstructure()
|
||||
new = np.copy(microstructure)
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@ for name in filenames:
|
|||
geom = damask.Geom.from_file(virt_file)
|
||||
else:
|
||||
geom = damask.Geom.from_file(name)
|
||||
damask.util.croak(geom)
|
||||
microstructure = geom.get_microstructure()
|
||||
|
||||
offset = options.offset if options.offset is not None else np.nanmax(microstructure)
|
||||
|
|
|
@ -3,6 +3,8 @@ from io import StringIO
|
|||
|
||||
import numpy as np
|
||||
|
||||
from . import util
|
||||
|
||||
|
||||
class Geom():
|
||||
"""Geometry definition for grid solvers"""
|
||||
|
@ -67,17 +69,29 @@ class Geom():
|
|||
if rescale:
|
||||
self.size = self.size * self.get_grid()/grid_old
|
||||
|
||||
message = ''
|
||||
message = ['grid a b c: {}'.format(' x '.join(map(str,grid_old)))]
|
||||
if np.any(grid_old != self.get_grid()):
|
||||
message += 'grid a b c: {}\n'.format(' x '.join(map(str,self.get_grid())))
|
||||
if np.any(size_old != self.size):
|
||||
message += 'size x y z: {}\n'.format(' x '.join(map(str,self.size)))
|
||||
if unique_old != len(np.unique(self.microstructure)):
|
||||
message += '# microstructures: {}\n'.format(len(np.unique(self.microstructure)))
|
||||
if max_old != np.max(self.microstructure):
|
||||
message += 'max microstructures: {}\n'.format(np.max(self.microstructure))
|
||||
message[-1] = util.bcolors.CROSSOUT+message[-1]+util.bcolors.ENDC
|
||||
message.append('grid a b c: {}'.format(' x '.join(map(str,self.get_grid()))))
|
||||
|
||||
if message != '': return message
|
||||
message.append('size x y z: {}'.format(' x '.join(map(str,size_old))))
|
||||
if np.any(size_old != self.size):
|
||||
message[-1] = util.bcolors.CROSSOUT+message[-1]+util.bcolors.ENDC
|
||||
message.append('size x y z: {}'.format(' x '.join(map(str,self.size))))
|
||||
|
||||
message.append('homogenization: {}'.format(self.homogenization))
|
||||
|
||||
message.append('# microstructures: {}'.format(unique_old))
|
||||
if unique_old != len(np.unique(self.microstructure)):
|
||||
message[-1] = util.bcolors.CROSSOUT+message[-1]+util.bcolors.ENDC
|
||||
message.append('# microstructures: {}'.format(len(np.unique(self.microstructure))))
|
||||
|
||||
message.append('max microstructures: {}'.format(max_old))
|
||||
if max_old != np.max(self.microstructure):
|
||||
message[-1] = util.bcolors.CROSSOUT+message[-1]+util.bcolors.ENDC
|
||||
message.append('max microstructures: {}'.format(np.max(self.microstructure)))
|
||||
|
||||
return '\n'.join(message)
|
||||
|
||||
|
||||
def add_comment(self,comment):
|
||||
|
|
|
@ -11,15 +11,16 @@ class bcolors:
|
|||
http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python
|
||||
"""
|
||||
|
||||
HEADER = '\033[95m'
|
||||
OKBLUE = '\033[94m'
|
||||
OKGREEN = '\033[92m'
|
||||
WARNING = '\033[93m'
|
||||
FAIL = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
BOLD = '\033[1m'
|
||||
DIM = '\033[2m'
|
||||
HEADER = '\033[95m'
|
||||
OKBLUE = '\033[94m'
|
||||
OKGREEN = '\033[92m'
|
||||
WARNING = '\033[93m'
|
||||
FAIL = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
BOLD = '\033[1m'
|
||||
DIM = '\033[2m'
|
||||
UNDERLINE = '\033[4m'
|
||||
CROSSOUT = '\033[9m'
|
||||
|
||||
def disable(self):
|
||||
self.HEADER = ''
|
||||
|
@ -30,6 +31,7 @@ class bcolors:
|
|||
self.ENDC = ''
|
||||
self.BOLD = ''
|
||||
self.UNDERLINE = ''
|
||||
self.CROSSOUT = ''
|
||||
|
||||
|
||||
# -----------------------------
|
||||
|
|
Loading…
Reference in New Issue