decoupling Orientation and Lattice/LatticeFamily
This commit is contained in:
parent
03d3f362e6
commit
4701eea10f
|
@ -139,7 +139,6 @@ class Orientation(Rotation):
|
|||
self.structure = l = LatticeFamily(self.family) # noqa
|
||||
self.immutable = l.immutable
|
||||
self.basis = l.basis
|
||||
self.symmetry_operations = l.symmetry_operations
|
||||
|
||||
self.a = self.b = self.c = None
|
||||
self.alpha = self.beta = self.gamma = None
|
||||
|
@ -152,7 +151,6 @@ class Orientation(Rotation):
|
|||
self.structure = l = Lattice(self.lattice, a,b,c, alpha,beta,gamma, degrees) # noqa
|
||||
self.immutable = l.immutable
|
||||
self.basis = l.basis
|
||||
self.symmetry_operations = l.symmetry_operations
|
||||
|
||||
self.a = l.a
|
||||
self.b = l.b
|
||||
|
@ -178,11 +176,6 @@ class Orientation(Rotation):
|
|||
+ ([f'Crystal family {self.family}'])
|
||||
+ [super().__repr__()])
|
||||
|
||||
@property
|
||||
def parameters(self):
|
||||
"""Return lattice parameters a, b, c, alpha, beta, gamma."""
|
||||
return (self.a,self.b,self.c,self.alpha,self.beta,self.gamma)
|
||||
|
||||
|
||||
def __copy__(self,**kwargs):
|
||||
"""Create deep copy."""
|
||||
|
@ -437,7 +430,8 @@ class Orientation(Rotation):
|
|||
is added to the left of the Rotation array.
|
||||
|
||||
"""
|
||||
o = self.symmetry_operations.broadcast_to(self.symmetry_operations.shape+self.shape,mode='right')
|
||||
sym_ops = self.structure.symmetry_operations
|
||||
o = sym_ops.broadcast_to(sym_ops.shape+self.shape,mode='right')
|
||||
return self.copy(rotation=o*Rotation(self.quaternion).broadcast_to(o.shape,mode='left'))
|
||||
|
||||
|
||||
|
@ -817,11 +811,12 @@ class Orientation(Rotation):
|
|||
Lab frame vector (or vectors if with_symmetry) along [uvw] direction or (hkl) plane normal.
|
||||
|
||||
"""
|
||||
sym_ops = self.structure.symmetry_operations
|
||||
# ToDo: simplify 'with_symmetry'
|
||||
v = self.to_frame(uvw=uvw,hkl=hkl)
|
||||
if with_symmetry:
|
||||
v = self.symmetry_operations.broadcast_to(self.symmetry_operations.shape+v.shape[:-1],mode='right') \
|
||||
@ np.broadcast_to(v,self.symmetry_operations.shape+v.shape)
|
||||
v = sym_ops.broadcast_to(sym_ops.shape+v.shape[:-1],mode='right') \
|
||||
@ np.broadcast_to(v,sym_ops.shape+v.shape)
|
||||
return ~(self if self.shape+v.shape[:-1] == () else self.broadcast_to(self.shape+v.shape[:-1],mode='right')) \
|
||||
@ np.broadcast_to(v,self.shape+v.shape)
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class TestOrientation:
|
|||
])
|
||||
def test_invalid_init(self,kwargs):
|
||||
with pytest.raises(ValueError):
|
||||
Orientation(**kwargs).parameters # noqa
|
||||
Orientation(**kwargs)
|
||||
|
||||
@pytest.mark.parametrize('kwargs',[
|
||||
dict(lattice='aP',a=1.0,b=1.1,c=1.2,alpha=np.pi/4,beta=np.pi/3,gamma=np.pi/2),
|
||||
|
@ -436,7 +436,7 @@ class TestOrientation:
|
|||
a=a,b=b,c=c,
|
||||
alpha=alpha,beta=beta,gamma=gamma)
|
||||
assert o.to_pole(**{kw:vector,'with_symmetry':with_symmetry}).shape \
|
||||
== o.shape + (o.symmetry_operations.shape if with_symmetry else ()) + vector.shape
|
||||
== o.shape + (o.structure.symmetry_operations.shape if with_symmetry else ()) + vector.shape
|
||||
|
||||
@pytest.mark.parametrize('lattice',['hP','cI','cF'])
|
||||
def test_Schmid(self,update,ref_path,lattice):
|
||||
|
|
Loading…
Reference in New Issue