@@ -983,11 +983,27 @@ def from_fiber_component(crystal: IntSequence,
983
983
984
984
Ranges 0≤θ≤π and 0≤φ≤2π give a unique set of coordinates.
985
985
986
+ Notes
987
+ -----
988
+ The value for sigma should be small enough to avoid values
989
+ larger than the maximum disorientation of the crystal family
990
+ when sampling from a normal distribution.
991
+ The maximum disorientation angle d_max is 62.80°, 93.84°,
992
+ 98.43°, and 120° for cubic, hexagonal, tetragonal, and
993
+ orthorhombic crystal families, respectively.
994
+ A typically safe value is σ = d_max/5.
995
+
996
+ References
997
+ ----------
998
+ A. Heinz and P. Neumann, Acta Crystallographica Section A 47:780-789, 1991
999
+ https://doi.org/10.1107/S0108767391006864
1000
+
986
1001
"""
987
1002
return Orientation (Rotation .from_fiber_component (crystal ,sample ,sigma ,shape ,degrees ,rng_seed ),
988
1003
family = family ,lattice = lattice ,
989
1004
a = a ,b = b ,c = c , alpha = alpha ,beta = beta ,gamma = gamma ,
990
1005
degrees = degrees )
1006
+
991
1007
@staticmethod
992
1008
def from_directions (uvw : IntSequence ,
993
1009
hkl : IntSequence ,
@@ -1142,6 +1158,14 @@ def larger_or_equal(v,c):
1142
1158
else [- np .inf , - np .inf , - np .inf ]) & self .in_FZ
1143
1159
1144
1160
1161
+ @overload
1162
+ def disorientation (self : MyType , other : MyType ,
1163
+ return_operators : Literal [False ] = False ) -> MyType :
1164
+ ...
1165
+ @overload
1166
+ def disorientation (self : MyType , other : MyType ,
1167
+ return_operators : Literal [True ] = True ) -> DisorientationTuple :
1168
+ ...
1145
1169
def disorientation (self : MyType ,
1146
1170
other : MyType ,
1147
1171
return_operators : bool = False ) -> Union [MyType , DisorientationTuple ]:
@@ -1206,7 +1230,7 @@ def disorientation(self: MyType,
1206
1230
s = self .broadcast_to (s_m ).equivalent
1207
1231
o = other .broadcast_to (s_o ).equivalent
1208
1232
1209
- r_ = s [:,np .newaxis ,...].misorientation (o [np .newaxis ,:,...]) # type: ignore[index]
1233
+ r_ = s [:,np .newaxis ,...].misorientation (o [np .newaxis ,:,...])
1210
1234
_r = ~ r_
1211
1235
shp = r_ .shape [2 :]
1212
1236
@@ -1309,14 +1333,14 @@ def disorientation_angle(self: MyType,
1309
1333
trace_max = np .maximum .reduce ([trace_max ,m1 ,(m1 + m2 )* np .sqrt (2. )/ 2. ])
1310
1334
1311
1335
else :
1312
- return self .disorientation (other ).as_axis_angle (pair = True )[1 ] # type: ignore
1336
+ return self .disorientation (other ).as_axis_angle (pair = True )[1 ]
1313
1337
1314
1338
return 2. * np .arccos (np .clip (trace_max [...,0 ].round (15 ),None ,1. ))
1315
1339
1316
1340
1317
1341
def average (self : MyType , # type: ignore[override]
1318
1342
weights : Optional [FloatSequence ] = None ,
1319
- return_cloud : bool = False ) -> Union [MyType , AverageTuple ]:
1343
+ return_cloud : Optional [ bool ] = False ) -> Union [MyType , AverageTuple ]:
1320
1344
"""
1321
1345
Return orientation average over last dimension.
1322
1346
@@ -1512,7 +1536,7 @@ def IPF_color(self,
1512
1536
raise ValueError ('input is not a field of three-dimensional vectors' )
1513
1537
1514
1538
vector_ :np .ndarray = self .to_SST (vector ,proper ) if in_SST else \
1515
- self @ np .broadcast_to (vector ,self .shape + (3 ,)) #type: ignore
1539
+ self @ np .broadcast_to (vector ,self .shape + (3 ,))
1516
1540
1517
1541
if self .standard_triangle is None : # direct exit for no symmetry
1518
1542
return np .zeros_like (vector_ )
@@ -1533,7 +1557,7 @@ def IPF_color(self,
1533
1557
np .broadcast_to (self .standard_triangle ['improper' ], vector_ .shape + (3 ,)),
1534
1558
np .block ([vector_ [...,:2 ],np .abs (vector_ [...,2 :3 ])])), 12 )
1535
1559
1536
- in_SST_ = np .all (components >= 0.0 ,axis = - 1 ) #type: ignore
1560
+ in_SST_ = np .all (components >= 0.0 ,axis = - 1 )
1537
1561
1538
1562
with np .errstate (invalid = 'ignore' ,divide = 'ignore' ):
1539
1563
rgb = (components / np .linalg .norm (components ,axis = - 1 ,keepdims = True ))** (1. / 3. ) # smoothen color ramps
@@ -1719,7 +1743,7 @@ def related(self: MyType,
1719
1743
"""
1720
1744
lattice ,o = self .relation_operations (model ,target )
1721
1745
target = Crystal (lattice = lattice ) if target is None else target
1722
- return Orientation (rotation = o * Rotation (self .quaternion )[np .newaxis ,...], # type: ignore
1746
+ return Orientation (rotation = o * Rotation (self .quaternion )[np .newaxis ,...], # type: ignore[return-value]
1723
1747
lattice = target .lattice ,
1724
1748
a = target .a ,
1725
1749
b = target .b ,
0 commit comments