diff --git a/processing/pre/geom_fromImage.py b/processing/pre/geom_fromImage.py index 4fd8247ef..9b8e69c37 100755 --- a/processing/pre/geom_fromImage.py +++ b/processing/pre/geom_fromImage.py @@ -36,7 +36,8 @@ if filenames == []: filenames = [None] for name in filenames: try: - table = damask.ASCIItable(name = name, outname = os.path.splitext(name)[0] +'.geom', + table = damask.ASCIItable(name = name, + outname = os.path.splitext(name)[0]+'.geom' if name else name, buffered = False, labeled = False) except: continue table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) diff --git a/processing/pre/geom_fromTable.py b/processing/pre/geom_fromTable.py index 27405522d..429e6383e 100755 --- a/processing/pre/geom_fromTable.py +++ b/processing/pre/geom_fromTable.py @@ -117,7 +117,8 @@ if filenames == []: filenames = [None] for name in filenames: try: - table = damask.ASCIItable(name = name, outname = os.path.splitext(name)[0] + '.geom', + table = damask.ASCIItable(name = name, + outname = os.path.splitext(name)[0]+'.geom' if name else name, buffered = False) except: continue table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) diff --git a/processing/pre/geom_toTable.py b/processing/pre/geom_toTable.py index 03ddfc20d..25909a1f4 100755 --- a/processing/pre/geom_toTable.py +++ b/processing/pre/geom_toTable.py @@ -34,10 +34,12 @@ parser.set_defaults(position = 'pos', if filenames == []: filenames = ['STDIN'] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = os.path.splitext(name)[0]+'.txt', - buffered = False, labeled = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, + outname = os.path.splitext(name)[0]+'.txt' if name else name, + buffered = False, labeled = False) + except: continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # --- interpret header ---------------------------------------------------------------------------- diff --git a/processing/pre/seeds_fromGeom.py b/processing/pre/seeds_fromGeom.py index 4951bcf8b..0b87c3310 100755 --- a/processing/pre/seeds_fromGeom.py +++ b/processing/pre/seeds_fromGeom.py @@ -47,7 +47,8 @@ if filenames == []: filenames = [None] for name in filenames: try: - table = damask.ASCIItable(name = name, outname = os.path.splitext(name)[0]+'.seeds', + table = damask.ASCIItable(name = name, + outname = os.path.splitext(name)[0]+'.seeds' if name else name, buffered = False, labeled = False) except: continue diff --git a/processing/pre/seeds_fromTable.py b/processing/pre/seeds_fromTable.py index 33ef98e35..d35b17c29 100755 --- a/processing/pre/seeds_fromTable.py +++ b/processing/pre/seeds_fromTable.py @@ -59,10 +59,12 @@ if options.blacklist != None: options.blacklist = map(int,options.blacklist) if filenames == []: filenames = ['STDIN'] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = os.path.splitext(name)[0]+'.seeds', - buffered = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, + outname = os.path.splitext(name)[0]+'.seeds' if name else name, + buffered = False) + except: continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) table.head_read() # read ASCII header info @@ -98,7 +100,6 @@ for name in filenames: table.data[:,0:3] -= boundingBox[0,:] table.data[:,0:3] /= boundingBox[1,:]-boundingBox[0,:] - # --- filtering of grain voxels -------------------------------------------------------------------- mask = np.logical_and(\ @@ -111,8 +112,6 @@ for name in filenames: ) table.data = table.data[mask] -# ------------------------------------------ output result --------------------------------------- - # ------------------------------------------ assemble header --------------------------------------- table.info = [ @@ -124,5 +123,7 @@ for name in filenames: table.labels_append(['1_pos','2_pos','3_pos','microstructure']) # implicitly switching label processing/writing on table.head_write() +# ------------------------------------------ output result --------------------------------------- + table.data_writeArray() table.close() # close ASCII tables