diff --git a/processing/pre/geom_grainGrowth.py b/processing/pre/geom_grainGrowth.py index 4c8b6c8bc..479f6f6fc 100755 --- a/processing/pre/geom_grainGrowth.py +++ b/processing/pre/geom_grainGrowth.py @@ -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 --------------------------------------------------------------------- diff --git a/processing/pre/geom_mirror.py b/processing/pre/geom_mirror.py index e6b29ae5c..408eb15a8 100755 --- a/processing/pre/geom_mirror.py +++ b/processing/pre/geom_mirror.py @@ -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() - if 'z' in options.directions: microstructure = np.concatenate([microstructure,microstructure[:,:,limits[0]:limits[1]:-1]],2) if 'y' in options.directions: diff --git a/processing/pre/geom_pack.py b/processing/pre/geom_pack.py index 68045defa..2bd993770 100755 --- a/processing/pre/geom_pack.py +++ b/processing/pre/geom_pack.py @@ -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:])) diff --git a/processing/pre/geom_rotate.py b/processing/pre/geom_rotate.py index 476e26c29..852693304 100755 --- a/processing/pre/geom_rotate.py +++ b/processing/pre/geom_rotate.py @@ -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 diff --git a/processing/pre/geom_toTable.py b/processing/pre/geom_toTable.py index 7db7f8430..2b8257cfa 100755 --- a/processing/pre/geom_toTable.py +++ b/processing/pre/geom_toTable.py @@ -23,22 +23,24 @@ 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] z = (0.5 + np.arange(grid[2],dtype=float))/grid[2]*size[2]+origin[2] @@ -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:])]) diff --git a/processing/pre/geom_translate.py b/processing/pre/geom_translate.py index 59c431474..127c63bc6 100755 --- a/processing/pre/geom_translate.py +++ b/processing/pre/geom_translate.py @@ -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 diff --git a/processing/pre/geom_unpack.py b/processing/pre/geom_unpack.py index 1c9b591be..b1b12d2cc 100755 --- a/processing/pre/geom_unpack.py +++ b/processing/pre/geom_unpack.py @@ -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) - geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:])) if name is None: