no need to hide, just add suffix to avoid clash with string argument
This commit is contained in:
parent
711a42565c
commit
545a085c93
|
@ -14,6 +14,7 @@ from . import tensor # noqa
|
||||||
from . import mechanics # noqa
|
from . import mechanics # noqa
|
||||||
from . import solver # noqa
|
from . import solver # noqa
|
||||||
from . import grid_filters # noqa
|
from . import grid_filters # noqa
|
||||||
|
from . import lattice # noqa
|
||||||
#Modules that contain only one class (of the same name), are prefixed by a '_'.
|
#Modules that contain only one class (of the same name), are prefixed by a '_'.
|
||||||
#For example, '_colormap' containsa class called 'Colormap' which is imported as 'damask.Colormap'.
|
#For example, '_colormap' containsa class called 'Colormap' which is imported as 'damask.Colormap'.
|
||||||
from ._rotation import Rotation # noqa
|
from ._rotation import Rotation # noqa
|
||||||
|
|
|
@ -5,16 +5,16 @@ import numpy as np
|
||||||
from . import Rotation
|
from . import Rotation
|
||||||
from . import util
|
from . import util
|
||||||
from . import tensor
|
from . import tensor
|
||||||
from . import _lattice
|
from . import lattice as lattice_
|
||||||
|
|
||||||
_crystal_families = ['triclinic',
|
crystal_families = ['triclinic',
|
||||||
'monoclinic',
|
'monoclinic',
|
||||||
'orthorhombic',
|
'orthorhombic',
|
||||||
'tetragonal',
|
'tetragonal',
|
||||||
'hexagonal',
|
'hexagonal',
|
||||||
'cubic']
|
'cubic']
|
||||||
|
|
||||||
_lattice_symmetries = {
|
lattice_symmetries = {
|
||||||
'aP': 'triclinic',
|
'aP': 'triclinic',
|
||||||
|
|
||||||
'mP': 'monoclinic',
|
'mP': 'monoclinic',
|
||||||
|
@ -136,8 +136,8 @@ class Orientation(Rotation):
|
||||||
|
|
||||||
self.kinematics = None
|
self.kinematics = None
|
||||||
|
|
||||||
if lattice in _lattice_symmetries:
|
if lattice in lattice_symmetries:
|
||||||
self.family = _lattice_symmetries[lattice]
|
self.family = lattice_symmetries[lattice]
|
||||||
self.lattice = lattice
|
self.lattice = lattice
|
||||||
|
|
||||||
self.a = 1 if a is None else a
|
self.a = 1 if a is None else a
|
||||||
|
@ -177,15 +177,15 @@ class Orientation(Rotation):
|
||||||
> np.sum(np.roll([self.alpha,self.beta,self.gamma],r)[1:]) for r in range(3)]):
|
> np.sum(np.roll([self.alpha,self.beta,self.gamma],r)[1:]) for r in range(3)]):
|
||||||
raise ValueError ('Each lattice angle must be less than sum of others')
|
raise ValueError ('Each lattice angle must be less than sum of others')
|
||||||
|
|
||||||
if self.lattice in _lattice.kinematics:
|
if self.lattice in lattice_.kinematics:
|
||||||
master = _lattice.kinematics[self.lattice]
|
master = lattice_.kinematics[self.lattice]
|
||||||
self.kinematics = {}
|
self.kinematics = {}
|
||||||
for m in master:
|
for m in master:
|
||||||
self.kinematics[m] = {'direction':master[m][:,0:3],'plane':master[m][:,3:6]} \
|
self.kinematics[m] = {'direction':master[m][:,0:3],'plane':master[m][:,3:6]} \
|
||||||
if master[m].shape[-1] == 6 else \
|
if master[m].shape[-1] == 6 else \
|
||||||
{'direction':self.Bravais_to_Miller(uvtw=master[m][:,0:4]),
|
{'direction':self.Bravais_to_Miller(uvtw=master[m][:,0:4]),
|
||||||
'plane': self.Bravais_to_Miller(hkil=master[m][:,4:8])}
|
'plane': self.Bravais_to_Miller(hkil=master[m][:,4:8])}
|
||||||
elif lattice in _crystal_families:
|
elif lattice in crystal_families:
|
||||||
self.family = lattice
|
self.family = lattice
|
||||||
self.lattice = None
|
self.lattice = None
|
||||||
|
|
||||||
|
@ -669,9 +669,9 @@ class Orientation(Rotation):
|
||||||
https://doi.org/10.1016/j.actamat.2004.11.021
|
https://doi.org/10.1016/j.actamat.2004.11.021
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if model not in _lattice.relations:
|
if model not in lattice_.relations:
|
||||||
raise KeyError(f'Orientation relationship "{model}" is unknown')
|
raise KeyError(f'Orientation relationship "{model}" is unknown')
|
||||||
r = _lattice.relations[model]
|
r = lattice_.relations[model]
|
||||||
|
|
||||||
if self.lattice not in r:
|
if self.lattice not in r:
|
||||||
raise KeyError(f'Relationship "{model}" not supported for lattice "{self.lattice}"')
|
raise KeyError(f'Relationship "{model}" not supported for lattice "{self.lattice}"')
|
||||||
|
|
|
@ -7,8 +7,8 @@ from damask import Orientation
|
||||||
from damask import Table
|
from damask import Table
|
||||||
from damask import util
|
from damask import util
|
||||||
from damask import grid_filters
|
from damask import grid_filters
|
||||||
from damask import _lattice as lattice
|
from damask import lattice
|
||||||
from damask._orientation import _crystal_families as crystal_families
|
from damask._orientation import crystal_families
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
Loading…
Reference in New Issue