polishing
This commit is contained in:
parent
49c3903cc7
commit
461611cde7
|
@ -56,14 +56,16 @@ parser.set_defaults(d = 1,
|
|||
options.immutable = list(map(int,options.immutable))
|
||||
|
||||
|
||||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
|
||||
grid_original = geom.get_grid()
|
||||
damask.util.croak(geom)
|
||||
|
||||
microstructure = np.tile(geom.microstructure,np.where(grid_original == 1, 2,1)) # make one copy along dimensions with grid == 1
|
||||
microstructure = np.tile(geom.microstructure,np.where(grid_original == 1, 2,1)) # make one copy along dimensions with grid == 1
|
||||
grid = np.array(microstructure.shape)
|
||||
|
||||
# --- initialize support data ---------------------------------------------------------------------
|
||||
|
|
|
@ -47,14 +47,15 @@ if not set(options.directions).issubset(validDirections):
|
|||
|
||||
limits = [-2,0] if options.periodic else [None,None]
|
||||
|
||||
|
||||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
microstructure = geom.get_microstructure()
|
||||
|
||||
microstructure = geom.get_microstructure()
|
||||
if 'z' in options.directions:
|
||||
microstructure = np.concatenate([microstructure,microstructure[:,:,limits[0]:limits[1]:-1]],2)
|
||||
if 'y' in options.directions:
|
||||
|
|
|
@ -30,6 +30,7 @@ for name in filenames:
|
|||
damask.util.report(scriptName,name)
|
||||
|
||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
|
||||
damask.util.croak(geom)
|
||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||
|
||||
|
|
|
@ -69,12 +69,14 @@ if options.eulers is not None:
|
|||
|
||||
eulers = rot.asEulers(degrees=True)
|
||||
|
||||
|
||||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
|
||||
microstructure = geom.get_microstructure()
|
||||
fill = np.nanmax(microstructure)+1 if options.fill is None else options.fill
|
||||
dtype = float if np.isnan(fill) or int(fill) != fill or microstructure.dtype==np.float else int
|
||||
|
|
|
@ -23,21 +23,23 @@ Translate geom description into ASCIItable containing position and microstructur
|
|||
|
||||
""", version = scriptID)
|
||||
|
||||
|
||||
(options, filenames) = parser.parse_args()
|
||||
|
||||
|
||||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
damask.util.croak(geom)
|
||||
grid = geom.get_grid()
|
||||
size = geom.get_size()
|
||||
origin = geom.get_origin()
|
||||
|
||||
#--- generate grid --------------------------------------------------------------------------------
|
||||
damask.util.croak(geom)
|
||||
|
||||
# --- generate grid --------------------------------------------------------------------------------
|
||||
|
||||
grid = geom.get_grid()
|
||||
size = geom.get_size()
|
||||
origin = geom.get_origin()
|
||||
|
||||
x = (0.5 + np.arange(grid[0],dtype=float))/grid[0]*size[0]+origin[0]
|
||||
y = (0.5 + np.arange(grid[1],dtype=float))/grid[1]*size[1]+origin[1]
|
||||
|
@ -47,7 +49,7 @@ for name in filenames:
|
|||
yy = np.tile(np.repeat(y,grid[0] ),grid[2])
|
||||
zz = np.repeat(z,grid[0]*grid[1])
|
||||
|
||||
# ------------------------------------------ finalize output ---------------------------------------
|
||||
# --- create ASCII table --------------------------------------------------------------------------
|
||||
|
||||
table = damask.ASCIItable(outname = os.path.splitext(name)[0]+'.txt' if name else name)
|
||||
table.info_append(geom.get_comments() + [scriptID + '\t' + ' '.join(sys.argv[1:])])
|
||||
|
|
|
@ -43,14 +43,15 @@ parser.set_defaults(origin = (0.0,0.0,0.0),
|
|||
|
||||
sub = list(map(int,options.substitute))
|
||||
|
||||
|
||||
if filenames == []: filenames = [None]
|
||||
|
||||
for name in filenames:
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
substituted = geom.get_microstructure()
|
||||
|
||||
substituted = geom.get_microstructure()
|
||||
for old,new in zip(sub[0::2],sub[1::2]): substituted[substituted==old] = new # substitute microstructure indices
|
||||
substituted += options.microstructure # constant shift
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ for name in filenames:
|
|||
damask.util.report(scriptName,name)
|
||||
|
||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
damask.util.croak(geom)
|
||||
|
||||
damask.util.croak(geom)
|
||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||
|
||||
if name is None:
|
||||
|
|
Loading…
Reference in New Issue