[skip ci] changed function definition to multiline layout for crystal, seeds and tensor module

This commit is contained in:
Daniel Otto de Mentock 2022-01-27 10:45:14 +01:00
parent 4ca501c73f
commit a12135fe77
3 changed files with 29 additions and 11 deletions

View File

@ -311,7 +311,9 @@ class Crystal():
+ _lattice_points.get(self.lattice if self.lattice == 'hP' else \ + _lattice_points.get(self.lattice if self.lattice == 'hP' else \
self.lattice[-1],None),dtype=float) self.lattice[-1],None),dtype=float)
def to_lattice(self, *, direction: np.ndarray = None, plane: np.ndarray = None) -> np.ndarray: def to_lattice(self,
*, direction: np.ndarray = None,
plane: np.ndarray = None) -> np.ndarray:
""" """
Calculate lattice vector corresponding to crystal frame direction or plane normal. Calculate lattice vector corresponding to crystal frame direction or plane normal.
@ -335,7 +337,10 @@ class Crystal():
return np.einsum('il,...l',basis,axis) return np.einsum('il,...l',basis,axis)
def to_frame(self, *, uvw: np.ndarray = None, hkl: np.ndarray = None) -> np.ndarray: def to_frame(self,
*,
uvw: np.ndarray = None,
hkl: np.ndarray = None) -> np.ndarray:
""" """
Calculate crystal frame vector along lattice direction [uvw] or plane normal (hkl). Calculate crystal frame vector along lattice direction [uvw] or plane normal (hkl).
@ -358,7 +363,8 @@ class Crystal():
return np.einsum('il,...l',basis,axis) return np.einsum('il,...l',basis,axis)
def kinematics(self, mode: str) -> Dict[str, List[np.ndarray]]: def kinematics(self,
mode: str) -> Dict[str, List[np.ndarray]]:
""" """
Return crystal kinematics systems. Return crystal kinematics systems.
@ -617,7 +623,8 @@ class Crystal():
'plane': [m[:,3:6] for m in master]} 'plane': [m[:,3:6] for m in master]}
def relation_operations(self, model: str) -> Tuple[str, Rotation]: def relation_operations(self,
model: str) -> Tuple[str, Rotation]:
""" """
Crystallographic orientation relationships for phase transformations. Crystallographic orientation relationships for phase transformations.

View File

@ -10,7 +10,9 @@ from . import util as _util
from . import grid_filters as _grid_filters from . import grid_filters as _grid_filters
def from_random(size: _FloatSequence, N_seeds: int, cells: _IntSequence = None, def from_random(size: _FloatSequence,
N_seeds: int,
cells: _IntSequence = None,
rng_seed=None) -> _np.ndarray: rng_seed=None) -> _np.ndarray:
""" """
Place seeds randomly in space. Place seeds randomly in space.
@ -46,8 +48,12 @@ def from_random(size: _FloatSequence, N_seeds: int, cells: _IntSequence = None,
return coords return coords
def from_Poisson_disc(size: _FloatSequence, N_seeds: int, N_candidates: int, distance: float, def from_Poisson_disc(size: _FloatSequence,
periodic: bool = True, rng_seed=None) -> _np.ndarray: N_seeds: int,
N_candidates: int,
distance: float,
periodic: bool = True,
rng_seed=None) -> _np.ndarray:
""" """
Place seeds according to a Poisson disc distribution. Place seeds according to a Poisson disc distribution.
@ -99,8 +105,11 @@ def from_Poisson_disc(size: _FloatSequence, N_seeds: int, N_candidates: int, dis
return coords return coords
def from_grid(grid, selection: _IntSequence = None, invert_selection: bool = False, def from_grid(grid,
average: bool = False, periodic: bool = True) -> _Tuple[_np.ndarray, _np.ndarray]: selection: _IntSequence = None,
invert_selection: bool = False,
average: bool = False,
periodic: bool = True) -> _Tuple[_np.ndarray, _np.ndarray]:
""" """
Create seeds from grid description. Create seeds from grid description.

View File

@ -45,7 +45,8 @@ def eigenvalues(T_sym: _np.ndarray) -> _np.ndarray:
return _np.linalg.eigvalsh(symmetric(T_sym)) return _np.linalg.eigvalsh(symmetric(T_sym))
def eigenvectors(T_sym: _np.ndarray, RHS: bool = False) -> _np.ndarray: def eigenvectors(T_sym: _np.ndarray,
RHS: bool = False) -> _np.ndarray:
""" """
Eigenvectors of a symmetric tensor. Eigenvectors of a symmetric tensor.
@ -70,7 +71,8 @@ def eigenvectors(T_sym: _np.ndarray, RHS: bool = False) -> _np.ndarray:
return v return v
def spherical(T: _np.ndarray, tensor: bool = True) -> _np.ndarray: def spherical(T: _np.ndarray,
tensor: bool = True) -> _np.ndarray:
""" """
Calculate spherical part of a tensor. Calculate spherical part of a tensor.