diff --git a/processing/pre/geom_clean.py b/processing/pre/geom_clean.py index 7ee87fe0a..50f3657b2 100755 --- a/processing/pre/geom_clean.py +++ b/processing/pre/geom_clean.py @@ -5,9 +5,6 @@ import sys from io import StringIO from optparse import OptionParser -from scipy import ndimage -import numpy as np - import damask diff --git a/processing/pre/geom_mirror.py b/processing/pre/geom_mirror.py index 3f9755818..77ec1f4d7 100755 --- a/processing/pre/geom_mirror.py +++ b/processing/pre/geom_mirror.py @@ -5,8 +5,6 @@ import sys from io import StringIO from optparse import OptionParser -import numpy as np - import damask diff --git a/python/damask/geom.py b/python/damask/geom.py index 6fb9af5a5..6dfcda013 100644 --- a/python/damask/geom.py +++ b/python/damask/geom.py @@ -311,8 +311,8 @@ class Geom(): """ header = self.get_header() grid = self.get_grid() - format_string = '%{}i'.format(1+int(np.floor(np.log10(np.nanmax(self.microstructure))))) if self.microstructure.dtype == int \ - else '%g' + format_string = '%g' if self.microstructure in np.sctypes['float'] else \ + '%{}i'.format(1+int(np.floor(np.log10(np.nanmax(self.microstructure))))) np.savetxt(fname, self.microstructure.reshape([grid[0],np.prod(grid[1:])],order='F').T, header='\n'.join(header), fmt=format_string, comments='') @@ -390,12 +390,14 @@ class Geom(): def mirror(self,directions,reflect=False): """ Mirror microstructure along given directions. + Parameters ---------- directions : iterable containing str direction(s) along which the microstructure is mirrored. Valid entries are 'x', 'y', 'z'. reflect : bool, optional reflect (include) outermost layers. + """ valid = {'x','y','z'} if not all(isinstance(d, str) for d in directions): @@ -420,10 +422,12 @@ class Geom(): def clean(self,stencil=3): """ Smooth microstructure by selecting most frequent index within given stencil at each location. + Parameters ---------- stencil : int, optional size of smoothing stencil. + """ def mostFrequent(arr): unique, inverse = np.unique(arr, return_inverse=True)