gstools.tools¶
GStools subpackage providing miscellaneous tools.
Export¶
to_vtk_structured |
|
vtk_export_structured (filename, pos, fields) |
Export a field to vtk structured rectilinear grid file. |
to_vtk_unstructured |
|
vtk_export_unstructured (filename, pos, fields) |
Export a field to vtk unstructured grid file. |
to_vtk |
|
vtk_export (filename, pos, fields[, mesh_type]) |
Export a field to vtk. |
Special functions¶
inc_gamma (s, x) |
The (upper) incomplete gamma function. |
exp_int (s, x) |
The exponential integral . |
inc_beta (a, b, x) |
The incomplete Beta function. |
tplstable_cor (r, len_scale, hurst, alpha) |
The correlation function of the TPLStable model. |
Geometric¶
xyz2pos (x[, y, z, dtype, max_dim]) |
Convert x, y, z to postional arguments. |
pos2xyz (pos[, dtype, calc_dim, max_dim]) |
Convert postional arguments to x, y, z. |
r3d_x (theta) |
Rotation matrix about x axis. |
r3d_y (theta) |
Rotation matrix about y axis. |
r3d_z (theta) |
Rotation matrix about z axis. |
-
gstools.tools.
vtk_export_structured
(filename, pos, fields)[source]¶ Export a field to vtk structured rectilinear grid file.
Parameters: - filename (
str
) – Filename of the file to be saved, including the path. Note that an ending (.vtr) will be added to the name. - pos (
list
) – the position tuple, containing main direction and transversal directions - fields (
dict
ornumpy.ndarray
) – Structured fields to be saved. Either a single numpy array as returned by SRF, or a dictionary of fields with theirs names as keys.
- filename (
-
gstools.tools.
vtk_export_unstructured
(filename, pos, fields)[source]¶ Export a field to vtk unstructured grid file.
Parameters: - filename (
str
) – Filename of the file to be saved, including the path. Note that an ending (.vtu) will be added to the name. - pos (
list
) – the position tuple, containing main direction and transversal directions - fields (
dict
ornumpy.ndarray
) – Unstructured fields to be saved. Either a single numpy array as returned by SRF, or a dictionary of fields with theirs names as keys.
- filename (
-
gstools.tools.
vtk_export
(filename, pos, fields, mesh_type='unstructured')[source]¶ Export a field to vtk.
Parameters: - filename (
str
) – Filename of the file to be saved, including the path. Note that an ending (.vtr or .vtu) will be added to the name. - pos (
list
) – the position tuple, containing main direction and transversal directions - fields (
dict
ornumpy.ndarray
) – [Un]structured fields to be saved. Either a single numpy array as returned by SRF, or a dictionary of fields with theirs names as keys. - mesh_type (
str
, optional) – ‘structured’ / ‘unstructured’. Default: structured
- filename (
-
gstools.tools.
inc_gamma
(s, x)[source]¶ The (upper) incomplete gamma function.
Given by:
Parameters: - s (
float
) – exponent in the integral - x (
numpy.ndarray
) – input values
- s (
-
gstools.tools.
exp_int
(s, x)[source]¶ The exponential integral .
Given by:
Parameters: - s (
float
) – exponent in the integral (should be > -100) - x (
numpy.ndarray
) – input values
- s (
-
gstools.tools.
inc_beta
(a, b, x)[source]¶ The incomplete Beta function.
Given by:
Parameters: - a (
float
) – first exponent in the integral - b (
float
) – second exponent in the integral - x (
numpy.ndarray
) – input values
- a (
-
gstools.tools.
tplstable_cor
(r, len_scale, hurst, alpha)[source]¶ The correlation function of the TPLStable model.
Given by
Parameters: - r (
numpy.ndarray
) – input values - len_scale (
float
) – length-scale of the model. - hurst (
float
) – Hurst coefficient of the power law. - alpha (
float
, optional) – Shape parameter of the stable model.
- r (
-
gstools.tools.
xyz2pos
(x, y=None, z=None, dtype=None, max_dim=3)[source]¶ Convert x, y, z to postional arguments.
Parameters: - x (
numpy.ndarray
) – grid axis in x-direction if structured, or first components of position vectors if unstructured - y (
numpy.ndarray
, optional) – analog to x - z (
numpy.ndarray
, optional) – analog to x - dtype (data-type, optional) – The desired data-type for the array. If not given, then the type will be determined as the minimum type required to hold the objects in the sequence. Default: None
- max_dim (
int
, optional) – Cut of information above the given dimension. Default: 3
Returns: pos – the position tuple
Return type: - x (
-
gstools.tools.
pos2xyz
(pos, dtype=None, calc_dim=False, max_dim=3)[source]¶ Convert postional arguments to x, y, z.
Parameters: - pos (
iterable
) – the position tuple, containing main direction and transversal directions - dtype (data-type, optional) – The desired data-type for the array. If not given, then the type will be determined as the minimum type required to hold the objects in the sequence. Default: None
- calc_dim (
bool
, optional) – State if the dimension should be returned. Default: False - max_dim (
int
, optional) – Cut of information above the given dimension. Default: 3
Returns: - x (
numpy.ndarray
) – first components of position vectors - y (
numpy.ndarray
or None) – analog to x - z (
numpy.ndarray
or None) – analog to x - dim (
int
, optional) – dimension (only if calc_dim is True)
Notes
If len(pos) > 3, everything after pos[2] will be ignored.
- pos (
-
gstools.tools.
r3d_x
(theta)[source]¶ Rotation matrix about x axis.
Parameters: theta ( float
) – Rotation angleReturns: Rotation matrix. Return type: numpy.ndarray
-
gstools.tools.
r3d_y
(theta)[source]¶ Rotation matrix about y axis.
Parameters: theta ( float
) – Rotation angleReturns: Rotation matrix. Return type: numpy.ndarray
-
gstools.tools.
r3d_z
(theta)[source]¶ Rotation matrix about z axis.
Parameters: theta ( float
) – Rotation angleReturns: Rotation matrix. Return type: numpy.ndarray