phasing out python shell scripts
This commit is contained in:
parent
8186be6293
commit
816e86ae5f
|
@ -55,20 +55,9 @@ for name in filenames:
|
|||
np.array([o*float(n.lower().replace('x','')) if n.lower().endswith('x') \
|
||||
else float(n) for o,n in zip(size,options.size)],dtype=float)
|
||||
|
||||
damask.util.croak(geom.update(microstructure =
|
||||
ndimage.interpolation.zoom(
|
||||
geom.microstructure,
|
||||
new_grid/grid,
|
||||
output=geom.microstructure.dtype,
|
||||
order=0,
|
||||
mode='nearest',
|
||||
prefilter=False,
|
||||
) if np.any(new_grid != grid) \
|
||||
else None,
|
||||
geom.scale(new_grid)
|
||||
damask.util.croak(geom.update(microstructure = None,
|
||||
size = new_size))
|
||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||
|
||||
if name is None:
|
||||
sys.stdout.write(str(geom.show()))
|
||||
else:
|
||||
geom.to_file(name)
|
||||
geom.to_file(sys.stdout if name is None else name)
|
||||
|
|
|
@ -467,6 +467,29 @@ class Geom():
|
|||
#self.add_comments('tbd')
|
||||
|
||||
|
||||
def scale(self,grid):
|
||||
"""
|
||||
Scale microstructure to new grid
|
||||
|
||||
Parameters
|
||||
----------
|
||||
grid : iterable of int
|
||||
new grid dimension
|
||||
|
||||
"""
|
||||
return self.update(
|
||||
ndimage.interpolation.zoom(
|
||||
self.microstructure,
|
||||
grid/self.get_grid(),
|
||||
output=self.microstructure.dtype,
|
||||
order=0,
|
||||
mode='nearest',
|
||||
prefilter=False
|
||||
)
|
||||
)
|
||||
#self.add_comments('tbd')
|
||||
|
||||
|
||||
def clean(self,stencil=3):
|
||||
"""
|
||||
Smooth microstructure by selecting most frequent index within given stencil at each location.
|
||||
|
|
Loading…
Reference in New Issue