getting rid of shell scripts
This commit is contained in:
parent
816e86ae5f
commit
b2cdabd009
|
@ -71,7 +71,4 @@ for name in filenames:
|
||||||
damask.util.croak(geom.update(canvas,origin=origin+offset*size/old,rescale=True))
|
damask.util.croak(geom.update(canvas,origin=origin+offset*size/old,rescale=True))
|
||||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
if name is None:
|
geom.to_file(sys.stdout if name is None else name)
|
||||||
sys.stdout.write(str(geom.show()))
|
|
||||||
else:
|
|
||||||
geom.to_file(name)
|
|
||||||
|
|
|
@ -37,9 +37,6 @@ for name in filenames:
|
||||||
damask.util.report(scriptName,name)
|
damask.util.report(scriptName,name)
|
||||||
|
|
||||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||||
|
|
||||||
damask.util.croak(geom.clean(options.stencil))
|
damask.util.croak(geom.clean(options.stencil))
|
||||||
|
|
||||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
geom.to_file(sys.stdout if name is None else name)
|
geom.to_file(sys.stdout if name is None else name)
|
||||||
|
|
|
@ -42,8 +42,6 @@ for name in filenames:
|
||||||
damask.util.report(scriptName,name)
|
damask.util.report(scriptName,name)
|
||||||
|
|
||||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||||
|
|
||||||
damask.util.croak(geom.mirror(options.directions,options.reflect))
|
damask.util.croak(geom.mirror(options.directions,options.reflect))
|
||||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
geom.to_file(sys.stdout if name is None else name)
|
geom.to_file(sys.stdout if name is None else name)
|
||||||
|
|
|
@ -32,15 +32,6 @@ for name in filenames:
|
||||||
damask.util.report(scriptName,name)
|
damask.util.report(scriptName,name)
|
||||||
|
|
||||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||||
|
damask.util.croak(self.renumber)
|
||||||
renumbered = np.empty(geom.get_grid(),dtype=geom.microstructure.dtype)
|
|
||||||
for i, oldID in enumerate(np.unique(geom.microstructure)):
|
|
||||||
renumbered = np.where(geom.microstructure == oldID, i+1, renumbered)
|
|
||||||
|
|
||||||
damask.util.croak(geom.update(renumbered))
|
|
||||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||||
|
geom.to_file(sys.stdout if name is None else name)
|
||||||
if name is None:
|
|
||||||
sys.stdout.write(str(geom.show()))
|
|
||||||
else:
|
|
||||||
geom.to_file(name)
|
|
||||||
|
|
|
@ -56,8 +56,6 @@ for name in filenames:
|
||||||
else float(n) for o,n in zip(size,options.size)],dtype=float)
|
else float(n) for o,n in zip(size,options.size)],dtype=float)
|
||||||
|
|
||||||
geom.scale(new_grid)
|
geom.scale(new_grid)
|
||||||
damask.util.croak(geom.update(microstructure = None,
|
damask.util.croak(geom.update(microstructure = None,size = new_size))
|
||||||
size = new_size))
|
|
||||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
geom.to_file(sys.stdout if name is None else name)
|
geom.to_file(sys.stdout if name is None else name)
|
||||||
|
|
|
@ -95,7 +95,4 @@ for name in filenames:
|
||||||
damask.util.croak(geom.update(microstructure,origin=origin-(np.asarray(microstructure.shape)-grid)/2*size/grid,rescale=True))
|
damask.util.croak(geom.update(microstructure,origin=origin-(np.asarray(microstructure.shape)-grid)/2*size/grid,rescale=True))
|
||||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
if name is None:
|
geom.to_file(sys.stdout if name is None else name)
|
||||||
sys.stdout.write(str(geom.show()))
|
|
||||||
else:
|
|
||||||
geom.to_file(name)
|
|
||||||
|
|
|
@ -82,7 +82,4 @@ for name in filenames:
|
||||||
geom.microstructure + offset,geom.microstructure)))
|
geom.microstructure + offset,geom.microstructure)))
|
||||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
if name is None:
|
geom.to_file(sys.stdout if name is None else name)
|
||||||
sys.stdout.write(str(geom.show()))
|
|
||||||
else:
|
|
||||||
geom.to_file(name)
|
|
||||||
|
|
|
@ -504,7 +504,20 @@ class Geom():
|
||||||
unique, inverse = np.unique(arr, return_inverse=True)
|
unique, inverse = np.unique(arr, return_inverse=True)
|
||||||
return unique[np.argmax(np.bincount(inverse))]
|
return unique[np.argmax(np.bincount(inverse))]
|
||||||
|
|
||||||
return self.update(ndimage.filters.generic_filter(self.microstructure,
|
return self.update(ndimage.filters.generic_filter(
|
||||||
|
self.microstructure,
|
||||||
mostFrequent,
|
mostFrequent,
|
||||||
size=(stencil,)*3).astype(self.microstructure.dtype))
|
size=(stencil,)*3
|
||||||
|
).astype(self.microstructure.dtype)
|
||||||
|
)
|
||||||
|
#self.add_comments('tbd')
|
||||||
|
|
||||||
|
|
||||||
|
def renumber(self):
|
||||||
|
"""Renumber sorted microstructure indices to 1,...,N."""
|
||||||
|
renumbered = np.empty(self.get_grid(),dtype=self.microstructure.dtype)
|
||||||
|
for i, oldID in enumerate(np.unique(self.microstructure)):
|
||||||
|
renumbered = np.where(self.microstructure == oldID, i+1, renumbered)
|
||||||
|
|
||||||
|
return self.update(renumbered))
|
||||||
#self.add_comments('tbd')
|
#self.add_comments('tbd')
|
||||||
|
|
Loading…
Reference in New Issue