docstring adjustments

This commit is contained in:
Martin Diehl 2022-01-12 23:13:38 +01:00
parent 2c1231a806
commit 3acabcdc7f
8 changed files with 41 additions and 41 deletions

View File

@ -205,7 +205,7 @@ class Colormap(mpl.colors.ListedColormap):
Returns
-------
color : np.ndarray, shape(...,4)
color : numpy.ndarray, shape(...,4)
RGBA values of interpolated color(s).
Examples

View File

@ -39,7 +39,7 @@ class Grid:
Parameters
----------
material : numpy.ndarray of shape (:,:,:)
material : numpy.ndarray, shape (:,:,:)
Material indices. The shape of the material array defines
the number of cells.
size : sequence of float, len (3)
@ -406,14 +406,14 @@ class Grid:
Number of cells in x,y,z direction.
size : sequence of float, len (3)
Physical size of the grid in meter.
seeds : numpy.ndarray of shape (:,3)
seeds : numpy.ndarray, shape (:,3)
Position of the seed points in meter. All points need to lay within the box.
weights : sequence of float, len (seeds.shape[0])
Weights of the seeds. Setting all weights to 1.0 gives a standard Voronoi tessellation.
material : sequence of int, len (seeds.shape[0]), optional
Material ID of the seeds.
Defaults to None, in which case materials are consecutively numbered.
periodic : Boolean, optional
periodic : bool, optional
Assume grid to be periodic. Defaults to True.
Returns
@ -462,12 +462,12 @@ class Grid:
Number of cells in x,y,z direction.
size : sequence of float, len (3)
Physical size of the grid in meter.
seeds : numpy.ndarray of shape (:,3)
seeds : numpy.ndarray, shape (:,3)
Position of the seed points in meter. All points need to lay within the box.
material : sequence of int, len (seeds.shape[0]), optional
Material ID of the seeds.
Defaults to None, in which case materials are consecutively numbered.
periodic : Boolean, optional
periodic : bool, optional
Assume grid to be periodic. Defaults to True.
Returns
@ -706,10 +706,10 @@ class Grid:
Fill value for primitive. Defaults to material.max()+1.
R : damask.Rotation, optional
Rotation of primitive. Defaults to no rotation.
inverse : Boolean, optional
inverse : bool, optional
Retain original materials within primitive and fill outside.
Defaults to False.
periodic : Boolean, optional
periodic : bool, optional
Assume grid to be periodic. Defaults to True.
Returns
@ -858,7 +858,7 @@ class Grid:
----------
cells : sequence of int, len (3)
Number of cells in x,y,z direction.
periodic : Boolean, optional
periodic : bool, optional
Assume grid to be periodic. Defaults to True.
Returns
@ -907,7 +907,7 @@ class Grid:
Size of smoothing stencil.
selection : sequence of int, optional
Field values that can be altered. Defaults to all.
periodic : Boolean, optional
periodic : bool, optional
Assume grid to be periodic. Defaults to True.
Returns
@ -1125,7 +1125,7 @@ class Grid:
trigger : sequence of int, optional
List of material indices that trigger a change.
Defaults to [], meaning that any different neighbor triggers a change.
periodic : Boolean, optional
periodic : bool, optional
Assume grid to be periodic. Defaults to True.
Returns
@ -1159,7 +1159,7 @@ class Grid:
Parameters
----------
periodic : Boolean, optional
periodic : bool, optional
Assume grid to be periodic. Defaults to True.
directions : (sequence of) string, optional
Direction(s) along which the boundaries are determined.

View File

@ -393,8 +393,8 @@ class Orientation(Rotation,Crystal):
Returns
-------
in : numpy.ndarray of quaternion.shape
Boolean array indicating whether Rodrigues-Frank vector falls into fundamental zone.
in : numpy.ndarray of bool, quaternion.shape
Whether Rodrigues-Frank vector falls into fundamental zone.
Notes
-----
@ -437,8 +437,8 @@ class Orientation(Rotation,Crystal):
Returns
-------
in : numpy.ndarray of quaternion.shape
Boolean array indicating whether Rodrigues-Frank vector falls into disorientation FZ.
in : numpy.ndarray of bool, quaternion.shape
Whether Rodrigues-Frank vector falls into disorientation FZ.
References
----------
@ -651,8 +651,8 @@ class Orientation(Rotation,Crystal):
Returns
-------
in : numpy.ndarray of shape (...)
Boolean array indicating whether vector falls into SST.
in : numpy.ndarray, shape (...)
Whether vector falls into SST.
"""
if not isinstance(vector,np.ndarray) or vector.shape[-1] != 3:

View File

@ -1817,7 +1817,7 @@ class Result:
output : (list of) str, optional
Names of the datasets to export to the file.
Defaults to '*', in which case all datasets are exported.
overwrite : boolean, optional
overwrite : bool, optional
Overwrite existing configuration files.
Defaults to False.

View File

@ -671,7 +671,7 @@ class Rotation:
----------
q : numpy.ndarray of shape (...,4)
Unit quaternion (q_0, q_1, q_2, q_3) in positive real hemisphere, i.e. ǀqǀ = 1, q_0 0.
accept_homomorph : boolean, optional
accept_homomorph : bool, optional
Allow homomorphic variants, i.e. q_0 < 0 (negative real hemisphere).
Defaults to False.
P : int {-1,1}, optional
@ -706,7 +706,7 @@ class Rotation:
phi : numpy.ndarray of shape (...,3)
Euler angles (φ_1 [0,2π], ϕ [0,π], φ_2 [0,2π])
or (φ_1 [0,360], ϕ [0,180], φ_2 [0,360]) if degrees == True.
degrees : boolean, optional
degrees : bool, optional
Euler angles are given in degrees. Defaults to False.
Notes
@ -737,9 +737,9 @@ class Rotation:
axis_angle : numpy.ndarray of shape (...,4)
Axis and angle (n_1, n_2, n_3, ω) with ǀnǀ = 1 and ω [0,π]
or ω [0,180] if degrees == True.
degrees : boolean, optional
degrees : bool, optional
Angle ω is given in degrees. Defaults to False.
normalize: boolean, optional
normalize: bool, optional
Allow ǀnǀ 1. Defaults to False.
P : int {-1,1}, optional
Sign convention. Defaults to -1.
@ -773,9 +773,9 @@ class Rotation:
----------
basis : numpy.ndarray of shape (...,3,3)
Three three-dimensional lattice basis vectors.
orthonormal : boolean, optional
orthonormal : bool, optional
Basis is strictly orthonormal, i.e. is free of stretch components. Defaults to True.
reciprocal : boolean, optional
reciprocal : bool, optional
Basis vectors are given in reciprocal (instead of real) space. Defaults to False.
"""
@ -851,7 +851,7 @@ class Rotation:
----------
rho : numpy.ndarray of shape (...,4)
RodriguesFrank vector (n_1, n_2, n_3, tan(ω/2)) with ǀnǀ = 1 and ω [0,π].
normalize : boolean, optional
normalize : bool, optional
Allow ǀnǀ 1. Defaults to False.
P : int {-1,1}, optional
Sign convention. Defaults to -1.
@ -977,9 +977,9 @@ class Rotation:
N : integer, optional
Number of discrete orientations to be sampled from the given ODF.
Defaults to 500.
degrees : boolean, optional
degrees : bool, optional
Euler space grid coordinates are in degrees. Defaults to True.
fractions : boolean, optional
fractions : bool, optional
ODF values correspond to volume fractions, not probability densities.
Defaults to True.
rng_seed: {None, int, array_like[ints], SeedSequence, BitGenerator, Generator}, optional
@ -1033,7 +1033,7 @@ class Rotation:
Standard deviation of (Gaussian) misorientation distribution.
N : int, optional
Number of samples. Defaults to 500.
degrees : boolean, optional
degrees : bool, optional
sigma is given in degrees. Defaults to True.
rng_seed : {None, int, array_like[ints], SeedSequence, BitGenerator, Generator}, optional
A seed to initialize the BitGenerator.
@ -1072,7 +1072,7 @@ class Rotation:
Defaults to 0.
N : int, optional
Number of samples. Defaults to 500.
degrees : boolean, optional
degrees : bool, optional
sigma, alpha, and beta are given in degrees.
rng_seed : {None, int, array_like[ints], SeedSequence, BitGenerator, Generator}, optional
A seed to initialize the BitGenerator.

View File

@ -28,8 +28,8 @@ class VTK:
----------
vtk_data : subclass of vtk.vtkDataSet
Description of geometry and topology, optionally with attached data.
Valid types are vtk.vtkRectilinearGrid, vtk.vtkUnstructuredGrid,
or vtk.vtkPolyData.
Valid types are vtk.vtkImageData, vtk.vtkUnstructuredGrid,
vtk.vtkPolyData, and vtk.vtkRectilinearGrid.
"""
self.vtk_data = vtk_data
@ -242,7 +242,7 @@ class VTK:
----------
fname : str or pathlib.Path
Filename for writing.
parallel : boolean, optional
parallel : bool, optional
Write data in parallel background process. Defaults to True.
compress : bool, optional
Compress with zlib algorithm. Defaults to True.

View File

@ -61,7 +61,7 @@ def from_Poisson_disc(size: _FloatSequence, N_seeds: int, N_candidates: int, dis
Number of candidates to consider for finding best candidate.
distance : float
Minimum acceptable distance to other seeds.
periodic : boolean, optional
periodic : bool, optional
Calculate minimum distance for periodically repeated grid.
rng_seed : {None, int, array_like[ints], SeedSequence, BitGenerator, Generator}, optional
A seed to initialize the BitGenerator. Defaults to None.
@ -99,8 +99,8 @@ def from_Poisson_disc(size: _FloatSequence, N_seeds: int, N_candidates: int, dis
return coords
def from_grid(grid, selection: _IntSequence = None,
invert: bool = False, average: bool = False, periodic: bool = True) -> _Tuple[_np.ndarray, _np.ndarray]:
def from_grid(grid, selection: _IntSequence = None, invert_selection: bool = False,
average: bool = False, periodic: bool = True) -> _Tuple[_np.ndarray, _np.ndarray]:
"""
Create seeds from grid description.
@ -110,11 +110,11 @@ def from_grid(grid, selection: _IntSequence = None,
Grid from which the material IDs are used as seeds.
selection : sequence of int, optional
Material IDs to consider.
invert : boolean, false
invert_selection : bool, optional
Consider all material IDs except those in selection. Defaults to False.
average : boolean, optional
average : bool, optional
Seed corresponds to center of gravity of material ID cloud.
periodic : boolean, optional
periodic : bool, optional
Center of gravity accounts for periodic boundaries.
Returns
@ -125,7 +125,7 @@ def from_grid(grid, selection: _IntSequence = None,
"""
material = grid.material.reshape((-1,1),order='F')
mask = _np.full(grid.cells.prod(),True,dtype=bool) if selection is None else \
_np.isin(material,selection,invert=invert).flatten()
_np.isin(material,selection,invert=invert_selection).flatten()
coords = _grid_filters.coordinates0_point(grid.cells,grid.size).reshape(-1,3,order='F')
if not average:

View File

@ -67,5 +67,5 @@ class TestSeeds:
coords = seeds.from_random(size,N_seeds,cells)
grid = Grid.from_Voronoi_tessellation(cells,size,coords)
selection=np.random.randint(N_seeds)+1
coords,material = seeds.from_grid(grid,average=average,periodic=periodic,invert=invert,selection=[selection])
coords,material = seeds.from_grid(grid,average=average,periodic=periodic,invert_selection=invert,selection=[selection])
assert selection not in material if invert else (selection==material).all()