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)
|
geom = damask.Geom.from_file(virt_file)
|
||||||
else:
|
else:
|
||||||
geom = damask.Geom.from_file(name)
|
geom = damask.Geom.from_file(name)
|
||||||
damask.util.croak(geom)
|
|
||||||
microstructure = geom.get_microstructure()
|
microstructure = geom.get_microstructure()
|
||||||
|
|
||||||
fill = options.fill if options.fill is not None else np.nanmax(microstructure)+1
|
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)
|
geom = damask.Geom.from_file(virt_file)
|
||||||
else:
|
else:
|
||||||
geom = damask.Geom.from_file(name)
|
geom = damask.Geom.from_file(name)
|
||||||
damask.util.croak(geom)
|
|
||||||
microstructure = geom.get_microstructure()
|
microstructure = geom.get_microstructure()
|
||||||
|
|
||||||
grid = geom.get_grid()
|
grid = geom.get_grid()
|
||||||
|
|
|
@ -49,7 +49,6 @@ for name in filenames:
|
||||||
geom = damask.Geom.from_file(virt_file)
|
geom = damask.Geom.from_file(virt_file)
|
||||||
else:
|
else:
|
||||||
geom = damask.Geom.from_file(name)
|
geom = damask.Geom.from_file(name)
|
||||||
damask.util.croak(geom)
|
|
||||||
microstructure = geom.get_microstructure()
|
microstructure = geom.get_microstructure()
|
||||||
|
|
||||||
microstructure = ndimage.filters.generic_filter(microstructure,mostFrequent,
|
microstructure = ndimage.filters.generic_filter(microstructure,mostFrequent,
|
||||||
|
|
|
@ -55,7 +55,6 @@ for name in filenames:
|
||||||
geom = damask.Geom.from_file(virt_file)
|
geom = damask.Geom.from_file(virt_file)
|
||||||
else:
|
else:
|
||||||
geom = damask.Geom.from_file(name)
|
geom = damask.Geom.from_file(name)
|
||||||
damask.util.croak(geom)
|
|
||||||
microstructure = geom.microstructure
|
microstructure = geom.microstructure
|
||||||
|
|
||||||
if 'z' in options.directions:
|
if 'z' in options.directions:
|
||||||
|
|
|
@ -36,7 +36,6 @@ for name in filenames:
|
||||||
geom = damask.Geom.from_file(virt_file)
|
geom = damask.Geom.from_file(virt_file)
|
||||||
else:
|
else:
|
||||||
geom = damask.Geom.from_file(name)
|
geom = damask.Geom.from_file(name)
|
||||||
damask.util.croak(geom)
|
|
||||||
microstructure = geom.get_microstructure()
|
microstructure = geom.get_microstructure()
|
||||||
|
|
||||||
renumbered = np.copy(microstructure)
|
renumbered = np.copy(microstructure)
|
||||||
|
|
|
@ -46,7 +46,6 @@ for name in filenames:
|
||||||
geom = damask.Geom.from_file(virt_file)
|
geom = damask.Geom.from_file(virt_file)
|
||||||
else:
|
else:
|
||||||
geom = damask.Geom.from_file(name)
|
geom = damask.Geom.from_file(name)
|
||||||
damask.util.croak(geom)
|
|
||||||
microstructure = geom.get_microstructure()
|
microstructure = geom.get_microstructure()
|
||||||
|
|
||||||
scale = geom.get_grid().astype('float')
|
scale = geom.get_grid().astype('float')
|
||||||
|
|
|
@ -78,7 +78,6 @@ for name in filenames:
|
||||||
geom = damask.Geom.from_file(virt_file)
|
geom = damask.Geom.from_file(virt_file)
|
||||||
else:
|
else:
|
||||||
geom = damask.Geom.from_file(name)
|
geom = damask.Geom.from_file(name)
|
||||||
damask.util.croak(geom)
|
|
||||||
microstructure = geom.get_microstructure()
|
microstructure = geom.get_microstructure()
|
||||||
|
|
||||||
fill = options.fill if options.fill is not None else np.nanmax(microstructure)+1
|
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])
|
zz = np.repeat(z,grid[0]*grid[1])
|
||||||
|
|
||||||
# ------------------------------------------ finalize output ---------------------------------------
|
# ------------------------------------------ finalize output ---------------------------------------
|
||||||
|
|
||||||
table = damask.ASCIItable(outname = os.path.splitext(name)[0]+'.txt' if name else name)
|
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.info_append([scriptID + '\t' + ' '.join(sys.argv[1:])] + geom.get_comments())
|
||||||
table.labels_append(['{}_{}'.format(1+i,'pos') for i in range(3)]+['microstructure'])
|
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)
|
geom = damask.Geom.from_file(virt_file)
|
||||||
else:
|
else:
|
||||||
geom = damask.Geom.from_file(name)
|
geom = damask.Geom.from_file(name)
|
||||||
damask.util.croak(geom)
|
|
||||||
microstructure = geom.get_microstructure()
|
microstructure = geom.get_microstructure()
|
||||||
new = np.copy(microstructure)
|
new = np.copy(microstructure)
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,6 @@ for name in filenames:
|
||||||
geom = damask.Geom.from_file(virt_file)
|
geom = damask.Geom.from_file(virt_file)
|
||||||
else:
|
else:
|
||||||
geom = damask.Geom.from_file(name)
|
geom = damask.Geom.from_file(name)
|
||||||
damask.util.croak(geom)
|
|
||||||
microstructure = geom.get_microstructure()
|
microstructure = geom.get_microstructure()
|
||||||
|
|
||||||
offset = options.offset if options.offset is not None else np.nanmax(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
|
import numpy as np
|
||||||
|
|
||||||
|
from . import util
|
||||||
|
|
||||||
|
|
||||||
class Geom():
|
class Geom():
|
||||||
"""Geometry definition for grid solvers"""
|
"""Geometry definition for grid solvers"""
|
||||||
|
@ -67,17 +69,29 @@ class Geom():
|
||||||
if rescale:
|
if rescale:
|
||||||
self.size = self.size * self.get_grid()/grid_old
|
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()):
|
if np.any(grid_old != self.get_grid()):
|
||||||
message += 'grid a b c: {}\n'.format(' x '.join(map(str,self.get_grid())))
|
message[-1] = util.bcolors.CROSSOUT+message[-1]+util.bcolors.ENDC
|
||||||
if np.any(size_old != self.size):
|
message.append('grid a b c: {}'.format(' x '.join(map(str,self.get_grid()))))
|
||||||
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))
|
|
||||||
|
|
||||||
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):
|
def add_comment(self,comment):
|
||||||
|
|
|
@ -20,6 +20,7 @@ class bcolors:
|
||||||
BOLD = '\033[1m'
|
BOLD = '\033[1m'
|
||||||
DIM = '\033[2m'
|
DIM = '\033[2m'
|
||||||
UNDERLINE = '\033[4m'
|
UNDERLINE = '\033[4m'
|
||||||
|
CROSSOUT = '\033[9m'
|
||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
self.HEADER = ''
|
self.HEADER = ''
|
||||||
|
@ -30,6 +31,7 @@ class bcolors:
|
||||||
self.ENDC = ''
|
self.ENDC = ''
|
||||||
self.BOLD = ''
|
self.BOLD = ''
|
||||||
self.UNDERLINE = ''
|
self.UNDERLINE = ''
|
||||||
|
self.CROSSOUT = ''
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|
Loading…
Reference in New Issue