fixed FZ conditions and tightened tolerance to accommodate higher precision "tfit"

This commit is contained in:
Philip Eisenlohr 2022-06-09 16:38:13 -04:00
parent b3b14e9104
commit 8fefc46f38
2 changed files with 20 additions and 12 deletions

View File

@ -448,9 +448,12 @@ class Orientation(Rotation,Crystal):
elif self.family == 'orthorhombic': elif self.family == 'orthorhombic':
return (np.prod(1. >= rho_abs,axis=-1)).astype(bool) return (np.prod(1. >= rho_abs,axis=-1)).astype(bool)
elif self.family == 'monoclinic': elif self.family == 'monoclinic':
return (1. >= rho_abs[...,1]).astype(bool) return np.logical_or( 1. >= rho_abs[...,1],
np.isnan(rho_abs[...,1]))
elif self.family == 'triclinic':
return np.ones(rho_abs.shape[:-1]).astype(bool)
else: else:
return np.all(np.isfinite(rho_abs),axis=-1) raise(TypeError, f'unknown symmetry "{self.family}"')
@property @property

View File

@ -1372,7 +1372,7 @@ class Rotation:
w[np.isclose(w[...,0],1.0+0.0j),1:] = 0. w[np.isclose(w[...,0],1.0+0.0j),1:] = 0.
w[np.isclose(w[...,1],1.0+0.0j),2:] = 0. w[np.isclose(w[...,1],1.0+0.0j),2:] = 0.
vr = np.swapaxes(vr,-1,-2) vr = np.swapaxes(vr,-1,-2)
ax = np.where(np.abs(diag_delta)<1e-12, ax = np.where(np.abs(diag_delta)<1e-13,
np.real(vr[np.isclose(w,1.0+0.0j)]).reshape(om.shape[:-2]+(3,)), np.real(vr[np.isclose(w,1.0+0.0j)]).reshape(om.shape[:-2]+(3,)),
np.abs(np.real(vr[np.isclose(w,1.0+0.0j)]).reshape(om.shape[:-2]+(3,))) \ np.abs(np.real(vr[np.isclose(w,1.0+0.0j)]).reshape(om.shape[:-2]+(3,))) \
*np.sign(diag_delta)) *np.sign(diag_delta))
@ -1581,14 +1581,19 @@ class Rotation:
@staticmethod @staticmethod
def _ho2ax(ho: np.ndarray) -> np.ndarray: def _ho2ax(ho: np.ndarray) -> np.ndarray:
"""Homochoric vector to axisangle pair.""" """Homochoric vector to axisangle pair."""
tfit = np.array([+1.0000000000018852, -0.5000000002194847, tfit = np.array([
-0.024999992127593126, -0.003928701544781374, 0.9999999999999968E0, -0.49999999999986866E0,
-0.0008152701535450438, -0.0002009500426119712, -0.025000000000632055E0, -0.003928571496460683E0,
-0.00002397986776071756, -0.00008202868926605841, -0.0008164666077062752E0, -0.00019411896443261646E0,
+0.00012448715042090092, -0.0001749114214822577, -0.00004985822229871769E0, -0.000014164962366386031E0,
+0.0001703481934140054, -0.00012062065004116828, -1.9000248160936107E-6, -5.72184549898506E-6,
+0.000059719705868660826, -0.00001980756723965647, 7.772149920658778E-6, -0.00001053483452909705E0,
+0.000003953714684212874, -0.00000036555001439719544]) 9.528014229335313E-6, -5.660288876265125E-6,
1.2844901692764126E-6, 1.1255185726258763E-6,
-1.3834391419956455E-6, 7.513691751164847E-7,
-2.401996891720091E-7, 4.386887017466388E-8,
-3.5917775353564864E-9,
])
hmag_squared = np.sum(ho**2.,axis=-1,keepdims=True) hmag_squared = np.sum(ho**2.,axis=-1,keepdims=True)
s = np.sum(tfit*hmag_squared**np.arange(len(tfit)),axis=-1,keepdims=True) s = np.sum(tfit*hmag_squared**np.arange(len(tfit)),axis=-1,keepdims=True)
with np.errstate(invalid='ignore'): with np.errstate(invalid='ignore'):
@ -1679,7 +1684,7 @@ class Rotation:
""" """
with np.errstate(invalid='ignore',divide='ignore'): with np.errstate(invalid='ignore',divide='ignore'):
# get pyramide and scale by grid parameter ratio # get pyramid and scale by grid parameter ratio
XYZ = np.take_along_axis(cu,Rotation._get_pyramid_order(cu,'forward'),-1) * _sc XYZ = np.take_along_axis(cu,Rotation._get_pyramid_order(cu,'forward'),-1) * _sc
order = np.abs(XYZ[...,1:2]) <= np.abs(XYZ[...,0:1]) order = np.abs(XYZ[...,1:2]) <= np.abs(XYZ[...,0:1])
q = np.pi/12.0 * np.where(order,XYZ[...,1:2],XYZ[...,0:1]) \ q = np.pi/12.0 * np.where(order,XYZ[...,1:2],XYZ[...,0:1]) \