better readable
This commit is contained in:
parent
1e3780b069
commit
1364441703
|
@ -334,10 +334,10 @@ class Crystal():
|
||||||
"""
|
"""
|
||||||
if (direction is not None) ^ (plane is None):
|
if (direction is not None) ^ (plane is None):
|
||||||
raise KeyError('specify either "direction" or "plane"')
|
raise KeyError('specify either "direction" or "plane"')
|
||||||
axis,basis = (np.array(direction),self.basis_reciprocal.T) \
|
basis,axis = (self.basis_reciprocal,np.array(direction)) \
|
||||||
if plane is None else \
|
if plane is None else \
|
||||||
(np.array(plane),self.basis_real.T)
|
(self.basis_real,np.array(plane))
|
||||||
return np.einsum('il,...l',basis,axis)
|
return np.einsum('li,...l',basis,axis)
|
||||||
|
|
||||||
|
|
||||||
def to_frame(self, *,
|
def to_frame(self, *,
|
||||||
|
@ -359,9 +359,9 @@ class Crystal():
|
||||||
"""
|
"""
|
||||||
if (uvw is not None) ^ (hkl is None):
|
if (uvw is not None) ^ (hkl is None):
|
||||||
raise KeyError('specify either "uvw" or "hkl"')
|
raise KeyError('specify either "uvw" or "hkl"')
|
||||||
axis,basis = (np.array(uvw),self.basis_real) \
|
basis,axis = (self.basis_real,np.array(uvw)) \
|
||||||
if hkl is None else \
|
if hkl is None else \
|
||||||
(np.array(hkl),self.basis_reciprocal)
|
(self.basis_reciprocal,np.array(hkl))
|
||||||
return np.einsum('il,...l',basis,axis)
|
return np.einsum('il,...l',basis,axis)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue