1
- from typing import Optional , Union , Dict , List , Tuple , Literal
1
+ from typing import Optional , Union , Literal
2
2
3
3
import numpy as np
4
4
7
7
from . import Rotation
8
8
9
9
10
- _kinematics : Dict [BravaisLattice , Dict [CrystalKinematics , List [np .ndarray ]]] = {
10
+ _kinematics : dict [BravaisLattice , dict [CrystalKinematics , list [np .ndarray ]]] = {
11
11
'cF' : {
12
12
'slip' : [np .array ([
13
13
[ 0 ,+ 1 ,- 1 , + 1 ,+ 1 ,+ 1 ],
244
244
}
245
245
246
246
247
- lattice_symmetries : Dict [Optional [BravaisLattice ], CrystalFamily ] = {
247
+ lattice_symmetries : dict [Optional [BravaisLattice ], CrystalFamily ] = {
248
248
'aP' : 'triclinic' ,
249
249
250
250
'mP' : 'monoclinic' ,
265
265
'cF' : 'cubic' ,
266
266
}
267
267
268
- orientation_relationships : Dict [str , Dict [str ,List [np .ndarray ]]] = {
268
+ orientation_relationships : dict [str , dict [str ,list [np .ndarray ]]] = {
269
269
'KS' : { # https://doi.org/10.1016/j.jallcom.2012.02.004
270
270
'cF-->cI' : [
271
271
np .repeat (np .array ([
@@ -800,17 +800,17 @@ def __eq__(self,
800
800
self .family == other .family )
801
801
802
802
@property
803
- def parameters (self ) -> Optional [Dict ]:
803
+ def parameters (self ) -> Optional [dict ]:
804
804
"""Return lattice parameters a, b, c, alpha, beta, gamma."""
805
805
has_parameters = all ([hasattr (self ,p ) for p in ['a' ,'b' ,'c' ,'alpha' ,'beta' ,'gamma' ]])
806
806
return dict (a = self .a ,b = self .b ,c = self .c ,
807
807
alpha = self .alpha ,beta = self .beta ,gamma = self .gamma ) if has_parameters else None
808
808
809
809
@property
810
- def immutable (self ) -> Dict [str , float ]:
810
+ def immutable (self ) -> dict [str , float ]:
811
811
"""Return immutable lattice parameters."""
812
812
# ToDo: use pattern matching in Python 3.10
813
- _immutable : Dict [CrystalFamily , Dict [str ,float ]] = {
813
+ _immutable : dict [CrystalFamily , dict [str ,float ]] = {
814
814
'cubic' : {
815
815
'b' : 1.0 ,
816
816
'c' : 1.0 ,
@@ -845,13 +845,13 @@ def immutable(self) -> Dict[str, float]:
845
845
846
846
847
847
@property
848
- def orientation_relationships (self ) -> List [str ]:
848
+ def orientation_relationships (self ) -> list [str ]:
849
849
"""Return labels of orientation relationships."""
850
850
return [k for k ,v in orientation_relationships .items () if np .any ([m .startswith (str (self .lattice )) for m in v ])]
851
851
852
852
853
853
@property
854
- def standard_triangle (self ) -> Union [Dict [str , np .ndarray ], None ]:
854
+ def standard_triangle (self ) -> Union [dict [str , np .ndarray ], None ]:
855
855
"""
856
856
Corners of the standard triangle.
857
857
@@ -878,7 +878,7 @@ def standard_triangle(self) -> Union[Dict[str, np.ndarray], None]:
878
878
... [0.,1.,0.]]).T), # blue
879
879
... }
880
880
"""
881
- _basis : Dict [CrystalFamily , Dict [str , np .ndarray ]] = {
881
+ _basis : dict [CrystalFamily , dict [str , np .ndarray ]] = {
882
882
'cubic' : {'improper' :np .array ([ [- 1. , 0. , 1. ],
883
883
[ np .sqrt (2. ) , - np .sqrt (2. ) , 0. ],
884
884
[ 0. , np .sqrt (3. ) , 0. ] ]),
@@ -944,7 +944,7 @@ def symmetry_operations(self) -> Rotation:
944
944
945
945
https://en.wikipedia.org/wiki/Crystal_system#Crystal_classes
946
946
"""
947
- _symmetry_operations : Dict [CrystalFamily , List ] = {
947
+ _symmetry_operations : dict [CrystalFamily , list ] = {
948
948
'cubic' : [
949
949
[ 1.0 , 0.0 , 0.0 , 0.0 ],
950
950
[ 0.0 , 1.0 , 0.0 , 0.0 ],
@@ -1058,7 +1058,7 @@ def basis_reciprocal(self) -> np.ndarray:
1058
1058
@property
1059
1059
def lattice_points (self ) -> np .ndarray :
1060
1060
"""Return lattice points."""
1061
- _lattice_points : Dict [str , List ] = {
1061
+ _lattice_points : dict [str , list ] = {
1062
1062
'P' : [
1063
1063
],
1064
1064
'S' : [
@@ -1152,7 +1152,7 @@ def to_frame(self, *,
1152
1152
1153
1153
1154
1154
def kinematics (self ,
1155
- mode : CrystalKinematics ) -> Dict [str , List [np .ndarray ]]:
1155
+ mode : CrystalKinematics ) -> dict [str , list [np .ndarray ]]:
1156
1156
"""
1157
1157
Return crystal kinematics systems.
1158
1158
@@ -1189,7 +1189,7 @@ def kinematics(self,
1189
1189
1190
1190
1191
1191
def characteristic_shear_twin (self ,
1192
- N_twin : Union [List [int ], Literal ['*' ]] = '*' ) -> np .ndarray :
1192
+ N_twin : Union [list [int ], Literal ['*' ]] = '*' ) -> np .ndarray :
1193
1193
"""
1194
1194
Return characteristic shear for twinning.
1195
1195
@@ -1229,7 +1229,7 @@ def characteristic_shear_twin(self,
1229
1229
1230
1230
def relation_operations (self ,
1231
1231
model : str ,
1232
- target = None ) -> Tuple [BravaisLattice , Rotation ]:
1232
+ target = None ) -> tuple [BravaisLattice , Rotation ]:
1233
1233
"""
1234
1234
Crystallographic orientation relationships for phase transformations.
1235
1235
0 commit comments