Merge branch 'fix-mypy-no-implicit-optional' into 'development'
PEP 484 compatibility (no-implicit-optional in mypy) See merge request damask/DAMASK!664
This commit is contained in:
commit
92ae86b636
|
@ -2,7 +2,7 @@ import os
|
||||||
import json
|
import json
|
||||||
import functools
|
import functools
|
||||||
import colorsys
|
import colorsys
|
||||||
from typing import Union, TextIO
|
from typing import Optional, Union, TextIO
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -275,8 +275,8 @@ class Colormap(mpl.colors.ListedColormap):
|
||||||
|
|
||||||
def shade(self,
|
def shade(self,
|
||||||
field: np.ndarray,
|
field: np.ndarray,
|
||||||
bounds: FloatSequence = None,
|
bounds: Optional[FloatSequence] = None,
|
||||||
gap: float = None) -> Image:
|
gap: Optional[float] = None) -> Image:
|
||||||
"""
|
"""
|
||||||
Generate PIL image of 2D field using colormap.
|
Generate PIL image of 2D field using colormap.
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ class Colormap(mpl.colors.ListedColormap):
|
||||||
|
|
||||||
|
|
||||||
def reversed(self,
|
def reversed(self,
|
||||||
name: str = None) -> 'Colormap':
|
name: Optional[str] = None) -> 'Colormap':
|
||||||
"""
|
"""
|
||||||
Reverse.
|
Reverse.
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ class Colormap(mpl.colors.ListedColormap):
|
||||||
|
|
||||||
|
|
||||||
def save_paraview(self,
|
def save_paraview(self,
|
||||||
fname: FileHandle = None):
|
fname: Optional[FileHandle] = None):
|
||||||
"""
|
"""
|
||||||
Save as JSON file for use in Paraview.
|
Save as JSON file for use in Paraview.
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ class Colormap(mpl.colors.ListedColormap):
|
||||||
|
|
||||||
|
|
||||||
def save_ASCII(self,
|
def save_ASCII(self,
|
||||||
fname: FileHandle = None):
|
fname: Optional[FileHandle] = None):
|
||||||
"""
|
"""
|
||||||
Save as ASCII file.
|
Save as ASCII file.
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ class Colormap(mpl.colors.ListedColormap):
|
||||||
t.save(self._get_file_handle(fname,'.txt'))
|
t.save(self._get_file_handle(fname,'.txt'))
|
||||||
|
|
||||||
|
|
||||||
def save_GOM(self, fname: FileHandle = None):
|
def save_GOM(self, fname: Optional[FileHandle] = None):
|
||||||
"""
|
"""
|
||||||
Save as ASCII file for use in GOM Aramis.
|
Save as ASCII file for use in GOM Aramis.
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ class Colormap(mpl.colors.ListedColormap):
|
||||||
|
|
||||||
|
|
||||||
def save_gmsh(self,
|
def save_gmsh(self,
|
||||||
fname: FileHandle = None):
|
fname: Optional[FileHandle] = None):
|
||||||
"""
|
"""
|
||||||
Save as ASCII file for use in gmsh.
|
Save as ASCII file for use in gmsh.
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import copy
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
import abc
|
import abc
|
||||||
from typing import Union, Dict, Any, Type, TypeVar
|
from typing import Optional, Union, Dict, Any, Type, TypeVar
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import yaml
|
import yaml
|
||||||
|
@ -21,7 +21,7 @@ class NiceDumper(yaml.SafeDumper):
|
||||||
"""Make YAML readable for humans."""
|
"""Make YAML readable for humans."""
|
||||||
|
|
||||||
def write_line_break(self,
|
def write_line_break(self,
|
||||||
data: str = None):
|
data: Optional[str] = None):
|
||||||
super().write_line_break(data)
|
super().write_line_break(data)
|
||||||
|
|
||||||
if len(self.indents) == 1:
|
if len(self.indents) == 1:
|
||||||
|
@ -53,7 +53,7 @@ class Config(dict):
|
||||||
"""YAML-based configuration."""
|
"""YAML-based configuration."""
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
yml: Union[str, Dict[str, Any]] = None,
|
yml: Union[None, str, Dict[str, Any]] = None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""Initialize from YAML, dict, or key=value pairs."""
|
"""Initialize from YAML, dict, or key=value pairs."""
|
||||||
if isinstance(yml,str):
|
if isinstance(yml,str):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import h5py
|
import h5py
|
||||||
from typing import Union, Sequence, Dict, Any, Collection
|
from typing import Optional, Union, Sequence, Dict, Any, Collection
|
||||||
|
|
||||||
from ._typehints import FileHandle
|
from ._typehints import FileHandle
|
||||||
from . import Config
|
from . import Config
|
||||||
|
@ -22,7 +22,7 @@ class ConfigMaterial(Config):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
d: Dict[str, Any] = None,
|
d: Optional[Dict[str, Any]] = None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""
|
"""
|
||||||
New material configuration.
|
New material configuration.
|
||||||
|
@ -83,13 +83,13 @@ class ConfigMaterial(Config):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load_DREAM3D(fname: str,
|
def load_DREAM3D(fname: str,
|
||||||
grain_data: str = None,
|
grain_data: Optional[str] = None,
|
||||||
cell_data: str = None,
|
cell_data: Optional[str] = None,
|
||||||
cell_ensemble_data: str = 'CellEnsembleData',
|
cell_ensemble_data: str = 'CellEnsembleData',
|
||||||
phases: str = 'Phases',
|
phases: str = 'Phases',
|
||||||
Euler_angles: str = 'EulerAngles',
|
Euler_angles: str = 'EulerAngles',
|
||||||
phase_names: str = 'PhaseName',
|
phase_names: str = 'PhaseName',
|
||||||
base_group: str = None) -> 'ConfigMaterial':
|
base_group: Optional[str] = None) -> 'ConfigMaterial':
|
||||||
"""
|
"""
|
||||||
Load DREAM.3D (HDF5) file.
|
Load DREAM.3D (HDF5) file.
|
||||||
|
|
||||||
|
@ -354,8 +354,8 @@ class ConfigMaterial(Config):
|
||||||
|
|
||||||
def material_rename_phase(self,
|
def material_rename_phase(self,
|
||||||
mapping: Dict[str, str],
|
mapping: Dict[str, str],
|
||||||
ID: Sequence[int] = None,
|
ID: Optional[Sequence[int]] = None,
|
||||||
constituent: Sequence[int] = None) -> 'ConfigMaterial':
|
constituent: Optional[Sequence[int]] = None) -> 'ConfigMaterial':
|
||||||
"""
|
"""
|
||||||
Change phase name in material.
|
Change phase name in material.
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ class ConfigMaterial(Config):
|
||||||
|
|
||||||
def material_rename_homogenization(self,
|
def material_rename_homogenization(self,
|
||||||
mapping: Dict[str, str],
|
mapping: Dict[str, str],
|
||||||
ID: Sequence[int] = None) -> 'ConfigMaterial':
|
ID: Optional[Sequence[int]] = None) -> 'ConfigMaterial':
|
||||||
"""
|
"""
|
||||||
Change homogenization name in material.
|
Change homogenization name in material.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Union, Dict, List, Tuple
|
from typing import Optional, Union, Dict, List, Tuple
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
@ -324,10 +324,10 @@ class Crystal():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *,
|
def __init__(self, *,
|
||||||
family: CrystalFamily = None,
|
family: Optional[CrystalFamily] = None,
|
||||||
lattice: CrystalLattice = None,
|
lattice: Optional[CrystalLattice] = None,
|
||||||
a: float = None, b: float = None, c: float = None,
|
a: Optional[float] = None, b: Optional[float] = None, c: Optional[float] = None,
|
||||||
alpha: float = None, beta: float = None, gamma: float = None,
|
alpha: Optional[float] = None, beta: Optional[float] = None, gamma: Optional[float] = None,
|
||||||
degrees: bool = False):
|
degrees: bool = False):
|
||||||
"""
|
"""
|
||||||
New representation of a crystal.
|
New representation of a crystal.
|
||||||
|
@ -690,8 +690,8 @@ class Crystal():
|
||||||
self.lattice[-1],None),dtype=float)
|
self.lattice[-1],None),dtype=float)
|
||||||
|
|
||||||
def to_lattice(self, *,
|
def to_lattice(self, *,
|
||||||
direction: FloatSequence = None,
|
direction: Optional[FloatSequence] = None,
|
||||||
plane: FloatSequence = None) -> np.ndarray:
|
plane: Optional[FloatSequence] = 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.
|
||||||
|
|
||||||
|
@ -717,8 +717,8 @@ class Crystal():
|
||||||
|
|
||||||
|
|
||||||
def to_frame(self, *,
|
def to_frame(self, *,
|
||||||
uvw: FloatSequence = None,
|
uvw: Optional[FloatSequence] = None,
|
||||||
hkl: FloatSequence = None) -> np.ndarray:
|
hkl: Optional[FloatSequence] = None) -> np.ndarray:
|
||||||
"""
|
"""
|
||||||
Calculate crystal frame vector corresponding to lattice direction [uvw] or plane normal (hkl).
|
Calculate crystal frame vector corresponding to lattice direction [uvw] or plane normal (hkl).
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import warnings
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import typing
|
import typing
|
||||||
from typing import Union, Optional, TextIO, List, Sequence, Dict
|
from typing import Optional, Union, TextIO, List, Sequence, Dict
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -34,8 +34,8 @@ class Grid:
|
||||||
material: np.ndarray,
|
material: np.ndarray,
|
||||||
size: FloatSequence,
|
size: FloatSequence,
|
||||||
origin: FloatSequence = np.zeros(3),
|
origin: FloatSequence = np.zeros(3),
|
||||||
initial_conditions: Dict[str,np.ndarray] = None,
|
initial_conditions: Optional[Dict[str,np.ndarray]] = None,
|
||||||
comments: Union[str, Sequence[str]] = None):
|
comments: Union[None, str, Sequence[str]] = None):
|
||||||
"""
|
"""
|
||||||
New geometry definition for grid solvers.
|
New geometry definition for grid solvers.
|
||||||
|
|
||||||
|
@ -348,9 +348,11 @@ class Grid:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load_DREAM3D(fname: Union[str, Path],
|
def load_DREAM3D(fname: Union[str, Path],
|
||||||
feature_IDs: str = None, cell_data: str = None,
|
feature_IDs: Optional[str] = None,
|
||||||
phases: str = 'Phases', Euler_angles: str = 'EulerAngles',
|
cell_data: Optional[str] = None,
|
||||||
base_group: str = None) -> 'Grid':
|
phases: str = 'Phases',
|
||||||
|
Euler_angles: str = 'EulerAngles',
|
||||||
|
base_group: Optional[str] = None) -> 'Grid':
|
||||||
"""
|
"""
|
||||||
Load DREAM.3D (HDF5) file.
|
Load DREAM.3D (HDF5) file.
|
||||||
|
|
||||||
|
@ -463,7 +465,7 @@ class Grid:
|
||||||
size: FloatSequence,
|
size: FloatSequence,
|
||||||
seeds: np.ndarray,
|
seeds: np.ndarray,
|
||||||
weights: FloatSequence,
|
weights: FloatSequence,
|
||||||
material: IntSequence = None,
|
material: Optional[IntSequence] = None,
|
||||||
periodic: bool = True):
|
periodic: bool = True):
|
||||||
"""
|
"""
|
||||||
Create grid from Laguerre tessellation.
|
Create grid from Laguerre tessellation.
|
||||||
|
@ -520,7 +522,7 @@ class Grid:
|
||||||
def from_Voronoi_tessellation(cells: IntSequence,
|
def from_Voronoi_tessellation(cells: IntSequence,
|
||||||
size: FloatSequence,
|
size: FloatSequence,
|
||||||
seeds: np.ndarray,
|
seeds: np.ndarray,
|
||||||
material: IntSequence = None,
|
material: Optional[IntSequence] = None,
|
||||||
periodic: bool = True) -> 'Grid':
|
periodic: bool = True) -> 'Grid':
|
||||||
"""
|
"""
|
||||||
Create grid from Voronoi tessellation.
|
Create grid from Voronoi tessellation.
|
||||||
|
@ -763,9 +765,9 @@ class Grid:
|
||||||
|
|
||||||
|
|
||||||
def canvas(self,
|
def canvas(self,
|
||||||
cells: IntSequence = None,
|
cells: Optional[IntSequence] = None,
|
||||||
offset: IntSequence = None,
|
offset: Optional[IntSequence] = None,
|
||||||
fill: int = None) -> 'Grid':
|
fill: Optional[int] = None) -> 'Grid':
|
||||||
"""
|
"""
|
||||||
Crop or enlarge/pad grid.
|
Crop or enlarge/pad grid.
|
||||||
|
|
||||||
|
@ -901,7 +903,7 @@ class Grid:
|
||||||
|
|
||||||
def rotate(self,
|
def rotate(self,
|
||||||
R: Rotation,
|
R: Rotation,
|
||||||
fill: int = None) -> 'Grid':
|
fill: Optional[int] = None) -> 'Grid':
|
||||||
"""
|
"""
|
||||||
Rotate grid (and pad if required).
|
Rotate grid (and pad if required).
|
||||||
|
|
||||||
|
@ -1093,10 +1095,10 @@ class Grid:
|
||||||
|
|
||||||
def clean(self,
|
def clean(self,
|
||||||
distance: float = np.sqrt(3),
|
distance: float = np.sqrt(3),
|
||||||
selection: IntCollection = None,
|
selection: Optional[IntCollection] = None,
|
||||||
invert_selection: bool = False,
|
invert_selection: bool = False,
|
||||||
periodic: bool = True,
|
periodic: bool = True,
|
||||||
rng_seed: NumpyRngSeed = None) -> 'Grid':
|
rng_seed: Optional[NumpyRngSeed] = None) -> 'Grid':
|
||||||
"""
|
"""
|
||||||
Smooth grid by selecting most frequent material ID within given stencil at each location.
|
Smooth grid by selecting most frequent material ID within given stencil at each location.
|
||||||
|
|
||||||
|
@ -1163,7 +1165,7 @@ class Grid:
|
||||||
dimension: Union[FloatSequence, IntSequence],
|
dimension: Union[FloatSequence, IntSequence],
|
||||||
center: Union[FloatSequence, IntSequence],
|
center: Union[FloatSequence, IntSequence],
|
||||||
exponent: Union[FloatSequence, float],
|
exponent: Union[FloatSequence, float],
|
||||||
fill: int = None,
|
fill: Optional[int] = None,
|
||||||
R: Rotation = Rotation(),
|
R: Rotation = Rotation(),
|
||||||
inverse: bool = False,
|
inverse: bool = False,
|
||||||
periodic: bool = True) -> 'Grid':
|
periodic: bool = True) -> 'Grid':
|
||||||
|
@ -1254,8 +1256,8 @@ class Grid:
|
||||||
|
|
||||||
def vicinity_offset(self,
|
def vicinity_offset(self,
|
||||||
distance: float = np.sqrt(3),
|
distance: float = np.sqrt(3),
|
||||||
offset: int = None,
|
offset: Optional[int] = None,
|
||||||
selection: IntCollection = None,
|
selection: Optional[IntCollection] = None,
|
||||||
invert_selection: bool = False,
|
invert_selection: bool = False,
|
||||||
periodic: bool = True) -> 'Grid':
|
periodic: bool = True) -> 'Grid':
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import inspect
|
import inspect
|
||||||
import copy
|
import copy
|
||||||
from typing import Union, Callable, Dict, Any, Tuple, TypeVar
|
from typing import Optional, Union, Callable, Dict, Any, Tuple, TypeVar
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
@ -98,10 +98,10 @@ class Orientation(Rotation,Crystal):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
rotation: Union[FloatSequence, Rotation] = np.array([1.,0.,0.,0.]),
|
rotation: Union[FloatSequence, Rotation] = np.array([1.,0.,0.,0.]),
|
||||||
*,
|
*,
|
||||||
family: CrystalFamily = None,
|
family: Optional[CrystalFamily] = None,
|
||||||
lattice: CrystalLattice = None,
|
lattice: Optional[CrystalLattice] = None,
|
||||||
a: float = None, b: float = None, c: float = None,
|
a: Optional[float] = None, b: Optional[float] = None, c: Optional[float] = None,
|
||||||
alpha: float = None, beta: float = None, gamma: float = None,
|
alpha: Optional[float] = None, beta: Optional[float] = None, gamma: Optional[float] = None,
|
||||||
degrees: bool = False):
|
degrees: bool = False):
|
||||||
"""
|
"""
|
||||||
New orientation.
|
New orientation.
|
||||||
|
@ -131,7 +131,7 @@ class Orientation(Rotation,Crystal):
|
||||||
|
|
||||||
|
|
||||||
def __copy__(self: MyType,
|
def __copy__(self: MyType,
|
||||||
rotation: Union[FloatSequence, Rotation] = None) -> MyType:
|
rotation: Union[None, FloatSequence, Rotation] = None) -> MyType:
|
||||||
"""
|
"""
|
||||||
Return deepcopy(self).
|
Return deepcopy(self).
|
||||||
|
|
||||||
|
@ -617,7 +617,7 @@ class Orientation(Rotation,Crystal):
|
||||||
|
|
||||||
|
|
||||||
def average(self,
|
def average(self,
|
||||||
weights: FloatSequence = None,
|
weights: Optional[FloatSequence] = None,
|
||||||
return_cloud: bool = False):
|
return_cloud: bool = False):
|
||||||
"""
|
"""
|
||||||
Return orientation average over last dimension.
|
Return orientation average over last dimension.
|
||||||
|
@ -819,8 +819,8 @@ class Orientation(Rotation,Crystal):
|
||||||
# functions that require lattice, not just family
|
# functions that require lattice, not just family
|
||||||
|
|
||||||
def to_pole(self, *,
|
def to_pole(self, *,
|
||||||
uvw: FloatSequence = None,
|
uvw: Optional[FloatSequence] = None,
|
||||||
hkl: FloatSequence = None,
|
hkl: Optional[FloatSequence] = None,
|
||||||
with_symmetry: bool = False,
|
with_symmetry: bool = False,
|
||||||
normalize: bool = True) -> np.ndarray:
|
normalize: bool = True) -> np.ndarray:
|
||||||
"""
|
"""
|
||||||
|
@ -861,8 +861,8 @@ class Orientation(Rotation,Crystal):
|
||||||
|
|
||||||
|
|
||||||
def Schmid(self, *,
|
def Schmid(self, *,
|
||||||
N_slip: IntSequence = None,
|
N_slip: Optional[IntSequence] = None,
|
||||||
N_twin: IntSequence = None) -> np.ndarray:
|
N_twin: Optional[IntSequence] = None) -> np.ndarray:
|
||||||
u"""
|
u"""
|
||||||
Calculate Schmid matrix P = d ⨂ n in the lab frame for selected deformation systems.
|
Calculate Schmid matrix P = d ⨂ n in the lab frame for selected deformation systems.
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ from pathlib import Path
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from typing import Union, Callable, Any, Sequence, Literal, Dict, List, Tuple, Optional
|
from typing import Optional, Union, Callable, Any, Sequence, Literal, Dict, List, Tuple
|
||||||
|
|
||||||
import h5py
|
import h5py
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -189,11 +189,11 @@ class Result:
|
||||||
|
|
||||||
def _manage_view(self,
|
def _manage_view(self,
|
||||||
action: Literal['set', 'add', 'del'],
|
action: Literal['set', 'add', 'del'],
|
||||||
increments: Union[int, Sequence[int], str, Sequence[str], bool] = None,
|
increments: Union[None, int, Sequence[int], str, Sequence[str], bool] = None,
|
||||||
times: Union[float, Sequence[float], str, Sequence[str], bool] = None,
|
times: Union[None, float, Sequence[float], str, Sequence[str], bool] = None,
|
||||||
phases: Union[str, Sequence[str], bool] = None,
|
phases: Union[None, str, Sequence[str], bool] = None,
|
||||||
homogenizations: Union[str, Sequence[str], bool] = None,
|
homogenizations: Union[None, str, Sequence[str], bool] = None,
|
||||||
fields: Union[str, Sequence[str], bool] = None) -> "Result":
|
fields: Union[None, str, Sequence[str], bool] = None) -> "Result":
|
||||||
"""
|
"""
|
||||||
Manages the visibility of the groups.
|
Manages the visibility of the groups.
|
||||||
|
|
||||||
|
@ -256,8 +256,8 @@ class Result:
|
||||||
|
|
||||||
|
|
||||||
def increments_in_range(self,
|
def increments_in_range(self,
|
||||||
start: Union[str, int] = None,
|
start: Union[None, str, int] = None,
|
||||||
end: Union[str, int] = None) -> Sequence[int]:
|
end: Union[None, str, int] = None) -> Sequence[int]:
|
||||||
"""
|
"""
|
||||||
Get all increments within a given range.
|
Get all increments within a given range.
|
||||||
|
|
||||||
|
@ -280,8 +280,8 @@ class Result:
|
||||||
return [i for i in self.incs if s <= i <= e]
|
return [i for i in self.incs if s <= i <= e]
|
||||||
|
|
||||||
def times_in_range(self,
|
def times_in_range(self,
|
||||||
start: float = None,
|
start: Optional[float] = None,
|
||||||
end: float = None) -> Sequence[float]:
|
end: Optional[float] = None) -> Sequence[float]:
|
||||||
"""
|
"""
|
||||||
Get times of all increments within a given time range.
|
Get times of all increments within a given time range.
|
||||||
|
|
||||||
|
@ -304,12 +304,12 @@ class Result:
|
||||||
|
|
||||||
|
|
||||||
def view(self,*,
|
def view(self,*,
|
||||||
increments: Union[int, Sequence[int], str, Sequence[str], bool] = None,
|
increments: Union[None, int, Sequence[int], str, Sequence[str], bool] = None,
|
||||||
times: Union[float, Sequence[float], str, Sequence[str], bool] = None,
|
times: Union[None, float, Sequence[float], str, Sequence[str], bool] = None,
|
||||||
phases: Union[str, Sequence[str], bool] = None,
|
phases: Union[None, str, Sequence[str], bool] = None,
|
||||||
homogenizations: Union[str, Sequence[str], bool] = None,
|
homogenizations: Union[None, str, Sequence[str], bool] = None,
|
||||||
fields: Union[str, Sequence[str], bool] = None,
|
fields: Union[None, str, Sequence[str], bool] = None,
|
||||||
protected: bool = None) -> "Result":
|
protected: Optional[bool] = None) -> "Result":
|
||||||
"""
|
"""
|
||||||
Set view.
|
Set view.
|
||||||
|
|
||||||
|
@ -361,11 +361,11 @@ class Result:
|
||||||
|
|
||||||
|
|
||||||
def view_more(self,*,
|
def view_more(self,*,
|
||||||
increments: Union[int, Sequence[int], str, Sequence[str], bool] = None,
|
increments: Union[None, int, Sequence[int], str, Sequence[str], bool] = None,
|
||||||
times: Union[float, Sequence[float], str, Sequence[str], bool] = None,
|
times: Union[None, float, Sequence[float], str, Sequence[str], bool] = None,
|
||||||
phases: Union[str, Sequence[str], bool] = None,
|
phases: Union[None, str, Sequence[str], bool] = None,
|
||||||
homogenizations: Union[str, Sequence[str], bool] = None,
|
homogenizations: Union[None, str, Sequence[str], bool] = None,
|
||||||
fields: Union[str, Sequence[str], bool] = None) -> "Result":
|
fields: Union[None, str, Sequence[str], bool] = None) -> "Result":
|
||||||
"""
|
"""
|
||||||
Add to view.
|
Add to view.
|
||||||
|
|
||||||
|
@ -404,11 +404,11 @@ class Result:
|
||||||
|
|
||||||
|
|
||||||
def view_less(self,*,
|
def view_less(self,*,
|
||||||
increments: Union[int, Sequence[int], str, Sequence[str], bool] = None,
|
increments: Union[None, int, Sequence[int], str, Sequence[str], bool] = None,
|
||||||
times: Union[float, Sequence[float], str, Sequence[str], bool] = None,
|
times: Union[None, float, Sequence[float], str, Sequence[str], bool] = None,
|
||||||
phases: Union[str, Sequence[str], bool] = None,
|
phases: Union[None, str, Sequence[str], bool] = None,
|
||||||
homogenizations: Union[str, Sequence[str], bool] = None,
|
homogenizations: Union[None, str, Sequence[str], bool] = None,
|
||||||
fields: Union[str, Sequence[str], bool] = None) -> "Result":
|
fields: Union[None, str, Sequence[str], bool] = None) -> "Result":
|
||||||
"""
|
"""
|
||||||
Remove from view.
|
Remove from view.
|
||||||
|
|
||||||
|
@ -650,7 +650,7 @@ class Result:
|
||||||
formula: str,
|
formula: str,
|
||||||
name: str,
|
name: str,
|
||||||
unit: str = 'n/a',
|
unit: str = 'n/a',
|
||||||
description: str = None):
|
description: Optional[str] = None):
|
||||||
"""
|
"""
|
||||||
Add result of a general formula.
|
Add result of a general formula.
|
||||||
|
|
||||||
|
@ -966,7 +966,7 @@ class Result:
|
||||||
}
|
}
|
||||||
def add_equivalent_Mises(self,
|
def add_equivalent_Mises(self,
|
||||||
T_sym: str,
|
T_sym: str,
|
||||||
kind: str = None):
|
kind: Optional[str] = None):
|
||||||
"""
|
"""
|
||||||
Add the equivalent Mises stress or strain of a symmetric tensor.
|
Add the equivalent Mises stress or strain of a symmetric tensor.
|
||||||
|
|
||||||
|
@ -1021,7 +1021,7 @@ class Result:
|
||||||
}
|
}
|
||||||
def add_norm(self,
|
def add_norm(self,
|
||||||
x: str,
|
x: str,
|
||||||
ord: Union[int, float, Literal['fro', 'nuc']] = None):
|
ord: Union[None, int, float, Literal['fro', 'nuc']] = None):
|
||||||
"""
|
"""
|
||||||
Add the norm of vector or tensor.
|
Add the norm of vector or tensor.
|
||||||
|
|
||||||
|
@ -1101,8 +1101,8 @@ class Result:
|
||||||
def add_pole(self,
|
def add_pole(self,
|
||||||
q: str = 'O',
|
q: str = 'O',
|
||||||
*,
|
*,
|
||||||
uvw: FloatSequence = None,
|
uvw: Optional[FloatSequence] = None,
|
||||||
hkl: FloatSequence = None,
|
hkl: Optional[FloatSequence] = None,
|
||||||
with_symmetry: bool = False,
|
with_symmetry: bool = False,
|
||||||
normalize: bool = True):
|
normalize: bool = True):
|
||||||
"""
|
"""
|
||||||
|
@ -1593,7 +1593,7 @@ class Result:
|
||||||
output: Union[str, List[str]] = '*',
|
output: Union[str, List[str]] = '*',
|
||||||
flatten: bool = True,
|
flatten: bool = True,
|
||||||
prune: bool = True,
|
prune: bool = True,
|
||||||
constituents: IntSequence = None,
|
constituents: Optional[IntSequence] = None,
|
||||||
fill_float: float = np.nan,
|
fill_float: float = np.nan,
|
||||||
fill_int: int = 0) -> Optional[Dict[str,Any]]:
|
fill_int: int = 0) -> Optional[Dict[str,Any]]:
|
||||||
"""
|
"""
|
||||||
|
@ -1683,7 +1683,7 @@ class Result:
|
||||||
|
|
||||||
def export_XDMF(self,
|
def export_XDMF(self,
|
||||||
output: Union[str, List[str]] = '*',
|
output: Union[str, List[str]] = '*',
|
||||||
target_dir: Union[str, Path] = None,
|
target_dir: Union[None, str, Path] = None,
|
||||||
absolute_path: bool = False):
|
absolute_path: bool = False):
|
||||||
"""
|
"""
|
||||||
Write XDMF file to directly visualize data from DADF5 file.
|
Write XDMF file to directly visualize data from DADF5 file.
|
||||||
|
@ -1811,8 +1811,8 @@ class Result:
|
||||||
def export_VTK(self,
|
def export_VTK(self,
|
||||||
output: Union[str,List[str]] = '*',
|
output: Union[str,List[str]] = '*',
|
||||||
mode: str = 'cell',
|
mode: str = 'cell',
|
||||||
constituents: IntSequence = None,
|
constituents: Optional[IntSequence] = None,
|
||||||
target_dir: Union[str, Path] = None,
|
target_dir: Union[None, str, Path] = None,
|
||||||
fill_float: float = np.nan,
|
fill_float: float = np.nan,
|
||||||
fill_int: int = 0,
|
fill_int: int = 0,
|
||||||
parallel: bool = True):
|
parallel: bool = True):
|
||||||
|
@ -1958,7 +1958,7 @@ class Result:
|
||||||
|
|
||||||
def export_simulation_setup(self,
|
def export_simulation_setup(self,
|
||||||
output: Union[str, List[str]] = '*',
|
output: Union[str, List[str]] = '*',
|
||||||
target_dir: Union[str, Path] = None,
|
target_dir: Union[None, str, Path] = None,
|
||||||
overwrite: bool = False,
|
overwrite: bool = False,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import copy
|
import copy
|
||||||
from typing import Union, Sequence, Tuple, Literal, List, TypeVar
|
from typing import Optional, Union, Sequence, Tuple, Literal, List, TypeVar
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class Rotation:
|
||||||
|
|
||||||
|
|
||||||
def __copy__(self: MyType,
|
def __copy__(self: MyType,
|
||||||
rotation: Union[FloatSequence, 'Rotation'] = None) -> MyType:
|
rotation: Union[None, FloatSequence, 'Rotation'] = None) -> MyType:
|
||||||
"""
|
"""
|
||||||
Return deepcopy(self).
|
Return deepcopy(self).
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ class Rotation:
|
||||||
|
|
||||||
|
|
||||||
def average(self: MyType,
|
def average(self: MyType,
|
||||||
weights: FloatSequence = None) -> MyType:
|
weights: Optional[FloatSequence] = None) -> MyType:
|
||||||
"""
|
"""
|
||||||
Average along last array dimension.
|
Average along last array dimension.
|
||||||
|
|
||||||
|
@ -1044,8 +1044,8 @@ class Rotation:
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_random(shape: Union[int, IntSequence] = None,
|
def from_random(shape: Union[None, int, IntSequence] = None,
|
||||||
rng_seed: NumpyRngSeed = None) -> 'Rotation':
|
rng_seed: Optional[NumpyRngSeed] = None) -> 'Rotation':
|
||||||
"""
|
"""
|
||||||
Initialize with samples from a uniform distribution.
|
Initialize with samples from a uniform distribution.
|
||||||
|
|
||||||
|
@ -1078,10 +1078,10 @@ class Rotation:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_ODF(weights: np.ndarray,
|
def from_ODF(weights: np.ndarray,
|
||||||
phi: np.ndarray,
|
phi: np.ndarray,
|
||||||
shape: Union[int, IntSequence] = None,
|
shape: Union[None, int, IntSequence] = None,
|
||||||
degrees: bool = False,
|
degrees: bool = False,
|
||||||
fractions: bool = True,
|
fractions: bool = True,
|
||||||
rng_seed: NumpyRngSeed = None) -> 'Rotation':
|
rng_seed: Optional[NumpyRngSeed] = None) -> 'Rotation':
|
||||||
"""
|
"""
|
||||||
Initialize with samples from a binned orientation distribution function (ODF).
|
Initialize with samples from a binned orientation distribution function (ODF).
|
||||||
|
|
||||||
|
@ -1135,9 +1135,9 @@ class Rotation:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_spherical_component(center: 'Rotation',
|
def from_spherical_component(center: 'Rotation',
|
||||||
sigma: float,
|
sigma: float,
|
||||||
shape: Union[int, IntSequence] = None,
|
shape: Union[None, int, IntSequence] = None,
|
||||||
degrees: bool = False,
|
degrees: bool = False,
|
||||||
rng_seed: NumpyRngSeed = None) -> 'Rotation':
|
rng_seed: Optional[NumpyRngSeed] = None) -> 'Rotation':
|
||||||
"""
|
"""
|
||||||
Initialize with samples from a Gaussian distribution around a given center.
|
Initialize with samples from a Gaussian distribution around a given center.
|
||||||
|
|
||||||
|
@ -1188,9 +1188,9 @@ class Rotation:
|
||||||
def from_fiber_component(crystal: IntSequence,
|
def from_fiber_component(crystal: IntSequence,
|
||||||
sample: IntSequence,
|
sample: IntSequence,
|
||||||
sigma: float = 0.,
|
sigma: float = 0.,
|
||||||
shape: Union[int, IntSequence] = None,
|
shape: Union[None, int, IntSequence] = None,
|
||||||
degrees: bool = False,
|
degrees: bool = False,
|
||||||
rng_seed: NumpyRngSeed = None) -> 'Rotation':
|
rng_seed: Optional[NumpyRngSeed] = None) -> 'Rotation':
|
||||||
"""
|
"""
|
||||||
Initialize with samples from a Gaussian distribution around a given direction.
|
Initialize with samples from a Gaussian distribution around a given direction.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import re
|
import re
|
||||||
import copy
|
import copy
|
||||||
from typing import Union, Tuple, List, Iterable
|
from typing import Optional, Union, Tuple, List, Iterable
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -13,8 +13,8 @@ class Table:
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
shapes: dict = {},
|
shapes: dict = {},
|
||||||
data: np.ndarray = None,
|
data: Optional[np.ndarray] = None,
|
||||||
comments: Union[str, Iterable[str]] = None):
|
comments: Union[None, str, Iterable[str]] = None):
|
||||||
"""
|
"""
|
||||||
New spreadsheet.
|
New spreadsheet.
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class Table:
|
||||||
def _add_comment(self,
|
def _add_comment(self,
|
||||||
label: str,
|
label: str,
|
||||||
shape: Tuple[int, ...],
|
shape: Tuple[int, ...],
|
||||||
info: str = None):
|
info: Optional[str] = None):
|
||||||
if info is not None:
|
if info is not None:
|
||||||
specific = f'{label}{" "+str(shape) if np.prod(shape,dtype=np.int64) > 1 else ""}: {info}'
|
specific = f'{label}{" "+str(shape) if np.prod(shape,dtype=np.int64) > 1 else ""}: {info}'
|
||||||
general = util.execution_stamp('Table')
|
general = util.execution_stamp('Table')
|
||||||
|
@ -383,7 +383,7 @@ class Table:
|
||||||
def set(self,
|
def set(self,
|
||||||
label: str,
|
label: str,
|
||||||
data: np.ndarray,
|
data: np.ndarray,
|
||||||
info: str = None) -> 'Table':
|
info: Optional[str] = None) -> 'Table':
|
||||||
"""
|
"""
|
||||||
Add new or replace existing column data.
|
Add new or replace existing column data.
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ class Table:
|
||||||
def rename(self,
|
def rename(self,
|
||||||
old: Union[str, Iterable[str]],
|
old: Union[str, Iterable[str]],
|
||||||
new: Union[str, Iterable[str]],
|
new: Union[str, Iterable[str]],
|
||||||
info: str = None) -> 'Table':
|
info: Optional[str] = None) -> 'Table':
|
||||||
"""
|
"""
|
||||||
Rename column data.
|
Rename column data.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Union, Literal, List, Sequence
|
from typing import Optional, Union, Literal, List, Sequence
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import vtk
|
import vtk
|
||||||
|
@ -286,7 +286,7 @@ class VTK:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load(fname: Union[str, Path],
|
def load(fname: Union[str, Path],
|
||||||
dataset_type: Literal['ImageData', 'UnstructuredGrid', 'PolyData', 'RectilinearGrid'] = None) -> 'VTK':
|
dataset_type: Literal[None, 'ImageData', 'UnstructuredGrid', 'PolyData', 'RectilinearGrid'] = None) -> 'VTK':
|
||||||
"""
|
"""
|
||||||
Load from VTK file.
|
Load from VTK file.
|
||||||
|
|
||||||
|
@ -409,11 +409,11 @@ class VTK:
|
||||||
|
|
||||||
# Check https://blog.kitware.com/ghost-and-blanking-visibility-changes/ for missing data
|
# Check https://blog.kitware.com/ghost-and-blanking-visibility-changes/ for missing data
|
||||||
def set(self,
|
def set(self,
|
||||||
label: str = None,
|
label: Optional[str] = None,
|
||||||
data: Union[np.ndarray, np.ma.MaskedArray] = None,
|
data: Union[None, np.ndarray, np.ma.MaskedArray] = None,
|
||||||
info: str = None,
|
info: Optional[str] = None,
|
||||||
*,
|
*,
|
||||||
table: 'Table' = None):
|
table: Optional['Table'] = None):
|
||||||
"""
|
"""
|
||||||
Add new or replace existing point or cell data.
|
Add new or replace existing point or cell data.
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ class VTK:
|
||||||
|
|
||||||
|
|
||||||
def show(self,
|
def show(self,
|
||||||
label: str = None,
|
label: Optional[str] = None,
|
||||||
colormap: Union[Colormap, str] = 'cividis'):
|
colormap: Union[Colormap, str] = 'cividis'):
|
||||||
"""
|
"""
|
||||||
Render.
|
Render.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Functionality for generation of seed points for Voronoi or Laguerre tessellation."""
|
"""Functionality for generation of seed points for Voronoi or Laguerre tessellation."""
|
||||||
|
|
||||||
from typing import Tuple as _Tuple
|
from typing import Optional as _Optional, Tuple as _Tuple
|
||||||
|
|
||||||
from scipy import spatial as _spatial
|
from scipy import spatial as _spatial
|
||||||
import numpy as _np
|
import numpy as _np
|
||||||
|
@ -13,8 +13,8 @@ from . import grid_filters as _grid_filters
|
||||||
|
|
||||||
def from_random(size: _FloatSequence,
|
def from_random(size: _FloatSequence,
|
||||||
N_seeds: int,
|
N_seeds: int,
|
||||||
cells: _IntSequence = None,
|
cells: _Optional[_IntSequence] = None,
|
||||||
rng_seed: _NumpyRngSeed = None) -> _np.ndarray:
|
rng_seed: _Optional[_NumpyRngSeed] = None) -> _np.ndarray:
|
||||||
"""
|
"""
|
||||||
Place seeds randomly in space.
|
Place seeds randomly in space.
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ def from_Poisson_disc(size: _FloatSequence,
|
||||||
N_candidates: int,
|
N_candidates: int,
|
||||||
distance: float,
|
distance: float,
|
||||||
periodic: bool = True,
|
periodic: bool = True,
|
||||||
rng_seed: _NumpyRngSeed = None) -> _np.ndarray:
|
rng_seed: _Optional[_NumpyRngSeed] = None) -> _np.ndarray:
|
||||||
"""
|
"""
|
||||||
Place seeds according to a Poisson disc distribution.
|
Place seeds according to a Poisson disc distribution.
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ def from_Poisson_disc(size: _FloatSequence,
|
||||||
|
|
||||||
|
|
||||||
def from_grid(grid,
|
def from_grid(grid,
|
||||||
selection: _IntCollection = None,
|
selection: _Optional[_IntCollection] = None,
|
||||||
invert_selection: bool = False,
|
invert_selection: bool = False,
|
||||||
average: bool = False,
|
average: bool = False,
|
||||||
periodic: bool = True) -> _Tuple[_np.ndarray, _np.ndarray]:
|
periodic: bool = True) -> _Tuple[_np.ndarray, _np.ndarray]:
|
||||||
|
|
|
@ -10,8 +10,9 @@ import signal as _signal
|
||||||
import fractions as _fractions
|
import fractions as _fractions
|
||||||
from collections import abc as _abc
|
from collections import abc as _abc
|
||||||
from functools import reduce as _reduce, partial as _partial
|
from functools import reduce as _reduce, partial as _partial
|
||||||
from typing import Callable as _Callable, Union as _Union, Iterable as _Iterable, Sequence as _Sequence, Dict as _Dict, \
|
from typing import Optional as _Optional, Callable as _Callable, Union as _Union, Iterable as _Iterable, \
|
||||||
List as _List, Tuple as _Tuple, Literal as _Literal, Any as _Any, Collection as _Collection, TextIO as _TextIO
|
Sequence as _Sequence, Dict as _Dict, List as _List, Tuple as _Tuple, Literal as _Literal, \
|
||||||
|
Any as _Any, Collection as _Collection, TextIO as _TextIO
|
||||||
from pathlib import Path as _Path
|
from pathlib import Path as _Path
|
||||||
|
|
||||||
import numpy as _np
|
import numpy as _np
|
||||||
|
@ -140,8 +141,8 @@ def strikeout(msg) -> str:
|
||||||
|
|
||||||
def run(cmd: str,
|
def run(cmd: str,
|
||||||
wd: str = './',
|
wd: str = './',
|
||||||
env: _Dict[str, str] = None,
|
env: _Optional[_Dict[str, str]] = None,
|
||||||
timeout: int = None) -> _Tuple[str, str]:
|
timeout: _Optional[int] = None) -> _Tuple[str, str]:
|
||||||
"""
|
"""
|
||||||
Run a command.
|
Run a command.
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ def open_text(fname: _FileHandle,
|
||||||
|
|
||||||
|
|
||||||
def execution_stamp(class_name: str,
|
def execution_stamp(class_name: str,
|
||||||
function_name: str = None) -> str:
|
function_name: _Optional[str] = None) -> str:
|
||||||
"""Timestamp the execution of a (function within a) class."""
|
"""Timestamp the execution of a (function within a) class."""
|
||||||
now = _datetime.datetime.now().astimezone().strftime('%Y-%m-%d %H:%M:%S%z')
|
now = _datetime.datetime.now().astimezone().strftime('%Y-%m-%d %H:%M:%S%z')
|
||||||
_function_name = '' if function_name is None else f'.{function_name}'
|
_function_name = '' if function_name is None else f'.{function_name}'
|
||||||
|
@ -238,7 +239,7 @@ def natural_sort(key: str) -> _List[_Union[int, str]]:
|
||||||
|
|
||||||
|
|
||||||
def show_progress(iterable: _Iterable,
|
def show_progress(iterable: _Iterable,
|
||||||
N_iter: int = None,
|
N_iter: _Optional[int] = None,
|
||||||
prefix: str = '',
|
prefix: str = '',
|
||||||
bar_length: int = 50) -> _Any:
|
bar_length: int = 50) -> _Any:
|
||||||
"""
|
"""
|
||||||
|
@ -418,7 +419,7 @@ def project_equal_area(vector: _np.ndarray,
|
||||||
|
|
||||||
def hybrid_IA(dist: _FloatSequence,
|
def hybrid_IA(dist: _FloatSequence,
|
||||||
N: int,
|
N: int,
|
||||||
rng_seed: _NumpyRngSeed = None) -> _np.ndarray:
|
rng_seed: _Optional[_NumpyRngSeed] = None) -> _np.ndarray:
|
||||||
"""
|
"""
|
||||||
Hybrid integer approximation.
|
Hybrid integer approximation.
|
||||||
|
|
||||||
|
@ -540,10 +541,10 @@ def shapeblender(a: _Tuple[int, ...],
|
||||||
|
|
||||||
|
|
||||||
def _docstringer(docstring: _Union[str, _Callable],
|
def _docstringer(docstring: _Union[str, _Callable],
|
||||||
extra_parameters: str = None,
|
extra_parameters: _Optional[str] = None,
|
||||||
# extra_examples: str = None,
|
# extra_examples: _Optional[str] = None,
|
||||||
# extra_notes: str = None,
|
# extra_notes: _Optional[str] = None,
|
||||||
return_type: _Union[str, _Callable] = None) -> str:
|
return_type: _Union[None, str, _Callable] = None) -> str:
|
||||||
"""
|
"""
|
||||||
Extend a docstring.
|
Extend a docstring.
|
||||||
|
|
||||||
|
@ -593,8 +594,8 @@ def _docstringer(docstring: _Union[str, _Callable],
|
||||||
fr'\1{return_type_}\n',
|
fr'\1{return_type_}\n',
|
||||||
docstring_,flags=_re.MULTILINE)
|
docstring_,flags=_re.MULTILINE)
|
||||||
|
|
||||||
def extend_docstring(docstring: _Union[str, _Callable] = None,
|
def extend_docstring(docstring: _Union[None, str, _Callable] = None,
|
||||||
extra_parameters: str = None) -> _Callable:
|
extra_parameters: _Optional[str] = None) -> _Callable:
|
||||||
"""
|
"""
|
||||||
Decorator: Extend the function's docstring.
|
Decorator: Extend the function's docstring.
|
||||||
|
|
||||||
|
@ -678,8 +679,8 @@ def DREAM3D_cell_data_group(fname: _Union[str, _Path]) -> str:
|
||||||
|
|
||||||
|
|
||||||
def Bravais_to_Miller(*,
|
def Bravais_to_Miller(*,
|
||||||
uvtw: _np.ndarray = None,
|
uvtw: _Optional[_np.ndarray] = None,
|
||||||
hkil: _np.ndarray = None) -> _np.ndarray:
|
hkil: _Optional[_np.ndarray] = None) -> _np.ndarray:
|
||||||
"""
|
"""
|
||||||
Transform 4 Miller–Bravais indices to 3 Miller indices of crystal direction [uvw] or plane normal (hkl).
|
Transform 4 Miller–Bravais indices to 3 Miller indices of crystal direction [uvw] or plane normal (hkl).
|
||||||
|
|
||||||
|
@ -706,8 +707,8 @@ def Bravais_to_Miller(*,
|
||||||
return _np.einsum('il,...l',basis,axis)
|
return _np.einsum('il,...l',basis,axis)
|
||||||
|
|
||||||
def Miller_to_Bravais(*,
|
def Miller_to_Bravais(*,
|
||||||
uvw: _np.ndarray = None,
|
uvw: _Optional[_np.ndarray] = None,
|
||||||
hkl: _np.ndarray = None) -> _np.ndarray:
|
hkl: _Optional[_np.ndarray] = None) -> _np.ndarray:
|
||||||
"""
|
"""
|
||||||
Transform 3 Miller indices to 4 Miller–Bravais indices of crystal direction [uvtw] or plane normal (hkil).
|
Transform 3 Miller indices to 4 Miller–Bravais indices of crystal direction [uvtw] or plane normal (hkil).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue