more general handling of precision

Anaconda on windows does not have np.float128 defined, but aliases
should work
https://numpy.org/devdocs/user/basics.types.html
This commit is contained in:
Martin Diehl 2021-02-19 16:37:02 +01:00
parent f5f993435b
commit b00b4bb0ad
3 changed files with 4 additions and 4 deletions

View File

@ -760,7 +760,7 @@ class Grid:
""" """
if fill is None: fill = np.nanmax(self.material) + 1 if fill is None: fill = np.nanmax(self.material) + 1
dtype = float if np.isnan(fill) or int(fill) != fill or self.material.dtype==np.float else int dtype = float if isinstance(fill,float) or self.material.dtype in np.sctypes['float'] else int
material = self.material material = self.material
# These rotations are always applied in the reference coordinate system, i.e. (z,x,z) not (z,x',z'') # These rotations are always applied in the reference coordinate system, i.e. (z,x,z) not (z,x',z'')

View File

@ -246,8 +246,8 @@ class VTK:
raise ValueError('No label defined for numpy.ndarray') raise ValueError('No label defined for numpy.ndarray')
N_data = data.shape[0] N_data = data.shape[0]
d = np_to_vtk((data.astype(np.float32) if data.dtype in [np.float64, np.float128] d = np_to_vtk((data.astype(np.single) if data.dtype in [np.double, np.longdouble] else
else data).reshape(N_data,-1),deep=True) # avoid large files data).reshape(N_data,-1),deep=True) # avoid large files
d.SetName(label) d.SetName(label)
if N_data == N_points: if N_data == N_points:

View File

@ -15,7 +15,7 @@ setuptools.setup(
url='https://damask.mpie.de', url='https://damask.mpie.de',
packages=setuptools.find_packages(), packages=setuptools.find_packages(),
include_package_data=True, include_package_data=True,
python_requires = '>=3.6' python_requires = '>=3.6',
install_requires = [ install_requires = [
'pandas>=0.24', # requires numpy 'pandas>=0.24', # requires numpy
'scipy>=1.2', 'scipy>=1.2',