better readable

This commit is contained in:
Martin Diehl 2022-02-10 22:57:23 +01:00
parent 1e3780b069
commit 1364441703
1 changed files with 7 additions and 7 deletions

View File

@ -334,10 +334,10 @@ class Crystal():
"""
if (direction is not None) ^ (plane is None):
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 \
(np.array(plane),self.basis_real.T)
return np.einsum('il,...l',basis,axis)
(self.basis_real,np.array(plane))
return np.einsum('li,...l',basis,axis)
def to_frame(self, *,
@ -359,9 +359,9 @@ class Crystal():
"""
if (uvw is not None) ^ (hkl is None):
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 \
(np.array(hkl),self.basis_reciprocal)
(self.basis_reciprocal,np.array(hkl))
return np.einsum('il,...l',basis,axis)