From 4970f22e13bfa3954017846ee79420685adb5603 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 2 Mar 2020 23:05:35 +0100 Subject: [PATCH] better name damask.Result is more appropriate then damask.DADF5 --- python/damask/__init__.py | 4 +- python/damask/{dadf5.py => result.py} | 38 +++++++++--------- .../{DADF5 => Result}/12grains6x7x8.geom | 0 .../12grains6x7x8_tensionY.hdf5 | Bin .../{DADF5 => Result}/material.config | 0 .../reference/{DADF5 => Result}/tensionY.load | 0 .../tests/{test_DADF5.py => test_Result.py} | 10 ++--- 7 files changed, 26 insertions(+), 26 deletions(-) rename python/damask/{dadf5.py => result.py} (96%) rename python/tests/reference/{DADF5 => Result}/12grains6x7x8.geom (100%) rename python/tests/reference/{DADF5 => Result}/12grains6x7x8_tensionY.hdf5 (100%) rename python/tests/reference/{DADF5 => Result}/material.config (100%) rename python/tests/reference/{DADF5 => Result}/tensionY.load (100%) rename python/tests/{test_DADF5.py => test_Result.py} (97%) diff --git a/python/damask/__init__.py b/python/damask/__init__.py index 2961ba6e3..f062a7797 100644 --- a/python/damask/__init__.py +++ b/python/damask/__init__.py @@ -14,8 +14,8 @@ from .asciitable import ASCIItable # noqa from .config import Material # noqa from .colormaps import Colormap, Color # noqa from .orientation import Symmetry, Lattice, Rotation, Orientation # noqa -from .dadf5 import DADF5 # noqa -from .dadf5 import DADF5 as Result # noqa +from .result import Result # noqa +from .result import Result as DADF5 # noqa from .geom import Geom # noqa from .solver import Solver # noqa diff --git a/python/damask/dadf5.py b/python/damask/result.py similarity index 96% rename from python/damask/dadf5.py rename to python/damask/result.py index 24d0c1708..a2d7e1094 100644 --- a/python/damask/dadf5.py +++ b/python/damask/result.py @@ -17,11 +17,11 @@ from . import Orientation from . import Environment from . import grid_filters -class DADF5(): +class Result(): """ Read and write to DADF5 files. - DADF5 files contain DAMASK results. + DADF5 (DAKMASK HDF5) files contain DAMASK results. """ def __init__(self,fname): @@ -454,7 +454,7 @@ class DADF5(): 'meta': { 'Unit': x['meta']['Unit'], 'Description': 'Absolute value of {} ({})'.format(x['label'],x['meta']['Description']), - 'Creator': 'dadf5.py:add_abs v{}'.format(version) + 'Creator': 'result.py:add_abs v{}'.format(version) } } def add_absolute(self,x): @@ -482,7 +482,7 @@ class DADF5(): 'meta': { 'Unit': kwargs['unit'], 'Description': '{} (formula: {})'.format(kwargs['description'],kwargs['formula']), - 'Creator': 'dadf5.py:add_calculation v{}'.format(version) + 'Creator': 'result.py:add_calculation v{}'.format(version) } } def add_calculation(self,label,formula,unit='n/a',description=None,vectorized=True): @@ -521,7 +521,7 @@ class DADF5(): 'Description': 'Cauchy stress calculated from {} ({}) '.format(P['label'], P['meta']['Description'])+\ 'and {} ({})'.format(F['label'],F['meta']['Description']), - 'Creator': 'dadf5.py:add_Cauchy v{}'.format(version) + 'Creator': 'result.py:add_Cauchy v{}'.format(version) } } def add_Cauchy(self,P='P',F='F'): @@ -547,7 +547,7 @@ class DADF5(): 'meta': { 'Unit': T['meta']['Unit'], 'Description': 'Determinant of tensor {} ({})'.format(T['label'],T['meta']['Description']), - 'Creator': 'dadf5.py:add_determinant v{}'.format(version) + 'Creator': 'result.py:add_determinant v{}'.format(version) } } def add_determinant(self,T): @@ -574,7 +574,7 @@ class DADF5(): 'meta': { 'Unit': T['meta']['Unit'], 'Description': 'Deviator of tensor {} ({})'.format(T['label'],T['meta']['Description']), - 'Creator': 'dadf5.py:add_deviator v{}'.format(version) + 'Creator': 'result.py:add_deviator v{}'.format(version) } } def add_deviator(self,T): @@ -598,7 +598,7 @@ class DADF5(): 'meta' : { 'Unit': S['meta']['Unit'], 'Description': 'Eigenvalues of {} ({})'.format(S['label'],S['meta']['Description']), - 'Creator': 'dadf5.py:add_eigenvalues v{}'.format(version) + 'Creator': 'result.py:add_eigenvalues v{}'.format(version) } } def add_eigenvalues(self,S): @@ -622,7 +622,7 @@ class DADF5(): 'meta' : { 'Unit': '1', 'Description': 'Eigenvectors of {} ({})'.format(S['label'],S['meta']['Description']), - 'Creator': 'dadf5.py:add_eigenvectors v{}'.format(version) + 'Creator': 'result.py:add_eigenvectors v{}'.format(version) } } def add_eigenvectors(self,S): @@ -658,7 +658,7 @@ class DADF5(): 'Unit': 'RGB (8bit)', 'Lattice': lattice, 'Description': 'Inverse Pole Figure (IPF) colors for direction/plane [{} {} {})'.format(*m), - 'Creator': 'dadf5.py:add_IPFcolor v{}'.format(version) + 'Creator': 'result.py:add_IPFcolor v{}'.format(version) } } def add_IPFcolor(self,q,l): @@ -684,7 +684,7 @@ class DADF5(): 'meta': { 'Unit': S['meta']['Unit'], 'Description': 'Maximum shear component of {} ({})'.format(S['label'],S['meta']['Description']), - 'Creator': 'dadf5.py:add_maximum_shear v{}'.format(version) + 'Creator': 'result.py:add_maximum_shear v{}'.format(version) } } def add_maximum_shear(self,S): @@ -711,7 +711,7 @@ class DADF5(): 'meta': { 'Unit': S['meta']['Unit'], 'Description': 'Mises equivalent {} of {} ({})'.format(t,S['label'],S['meta']['Description']), - 'Creator': 'dadf5.py:add_Mises v{}'.format(version) + 'Creator': 'result.py:add_Mises v{}'.format(version) } } def add_Mises(self,S): @@ -747,7 +747,7 @@ class DADF5(): 'meta': { 'Unit': x['meta']['Unit'], 'Description': '{}-norm of {} {} ({})'.format(o,t,x['label'],x['meta']['Description']), - 'Creator': 'dadf5.py:add_norm v{}'.format(version) + 'Creator': 'result.py:add_norm v{}'.format(version) } } def add_norm(self,x,ord=None): @@ -775,7 +775,7 @@ class DADF5(): 'Description': '2. Kirchhoff stress calculated from {} ({}) '.format(P['label'], P['meta']['Description'])+\ 'and {} ({})'.format(F['label'],F['meta']['Description']), - 'Creator': 'dadf5.py:add_PK2 v{}'.format(version) + 'Creator': 'result.py:add_PK2 v{}'.format(version) } } def add_PK2(self,P='P',F='F'): @@ -813,7 +813,7 @@ class DADF5(): 'Unit': '1', 'Description': '{} coordinates of stereographic projection of pole (direction/plane) in crystal frame'\ .format('Polar' if polar else 'Cartesian'), - 'Creator' : 'dadf5.py:add_pole v{}'.format(version) + 'Creator' : 'result.py:add_pole v{}'.format(version) } } def add_pole(self,q,p,polar=False): @@ -843,7 +843,7 @@ class DADF5(): 'meta': { 'Unit': F['meta']['Unit'], 'Description': 'Rotational part of {} ({})'.format(F['label'],F['meta']['Description']), - 'Creator': 'dadf5.py:add_rotational_part v{}'.format(version) + 'Creator': 'result.py:add_rotational_part v{}'.format(version) } } def add_rotational_part(self,F): @@ -870,7 +870,7 @@ class DADF5(): 'meta': { 'Unit': T['meta']['Unit'], 'Description': 'Spherical component of tensor {} ({})'.format(T['label'],T['meta']['Description']), - 'Creator': 'dadf5.py:add_spherical v{}'.format(version) + 'Creator': 'result.py:add_spherical v{}'.format(version) } } def add_spherical(self,T): @@ -897,7 +897,7 @@ class DADF5(): 'meta': { 'Unit': F['meta']['Unit'], 'Description': 'Strain tensor of {} ({})'.format(F['label'],F['meta']['Description']), - 'Creator': 'dadf5.py:add_strain_tensor v{}'.format(version) + 'Creator': 'result.py:add_strain_tensor v{}'.format(version) } } def add_strain_tensor(self,F='F',t='V',m=0.0): @@ -932,7 +932,7 @@ class DADF5(): 'Unit': F['meta']['Unit'], 'Description': '{} stretch tensor of {} ({})'.format('Left' if t == 'V' else 'Right', F['label'],F['meta']['Description']), - 'Creator': 'dadf5.py:add_stretch_tensor v{}'.format(version) + 'Creator': 'result.py:add_stretch_tensor v{}'.format(version) } } def add_stretch_tensor(self,F='F',t='V'): diff --git a/python/tests/reference/DADF5/12grains6x7x8.geom b/python/tests/reference/Result/12grains6x7x8.geom similarity index 100% rename from python/tests/reference/DADF5/12grains6x7x8.geom rename to python/tests/reference/Result/12grains6x7x8.geom diff --git a/python/tests/reference/DADF5/12grains6x7x8_tensionY.hdf5 b/python/tests/reference/Result/12grains6x7x8_tensionY.hdf5 similarity index 100% rename from python/tests/reference/DADF5/12grains6x7x8_tensionY.hdf5 rename to python/tests/reference/Result/12grains6x7x8_tensionY.hdf5 diff --git a/python/tests/reference/DADF5/material.config b/python/tests/reference/Result/material.config similarity index 100% rename from python/tests/reference/DADF5/material.config rename to python/tests/reference/Result/material.config diff --git a/python/tests/reference/DADF5/tensionY.load b/python/tests/reference/Result/tensionY.load similarity index 100% rename from python/tests/reference/DADF5/tensionY.load rename to python/tests/reference/Result/tensionY.load diff --git a/python/tests/test_DADF5.py b/python/tests/test_Result.py similarity index 97% rename from python/tests/test_DADF5.py rename to python/tests/test_Result.py index 4cf3c4e2b..33c1e2842 100644 --- a/python/tests/test_DADF5.py +++ b/python/tests/test_Result.py @@ -4,25 +4,25 @@ import os import pytest import numpy as np -from damask import DADF5 +from damask import Result from damask import mechanics @pytest.fixture def default(tmp_path,reference_dir): - """Small DADF5 file in temp location for modification.""" + """Small Result file in temp location for modification.""" fname = '12grains6x7x8_tensionY.hdf5' shutil.copy(os.path.join(reference_dir,fname),tmp_path) - f = DADF5(os.path.join(tmp_path,fname)) + f = Result(os.path.join(tmp_path,fname)) f.set_by_time(20.0,20.0) return f @pytest.fixture def reference_dir(reference_dir_base): """Directory containing reference results.""" - return os.path.join(reference_dir_base,'DADF5') + return os.path.join(reference_dir_base,'Result') -class TestDADF5: +class TestResult: def test_time_increments(self,default): shape = default.read_dataset(default.get_dataset_location('F'),0).shape