gstools.field.generator¶
GStools subpackage providing generators for spatial random fields.
The following classes are provided
RandMeth (model[, mode_no, seed, …]) |
Randomization method for calculating isotropic spatial random fields. |
-
class
gstools.field.generator.
RandMeth
(model, mode_no=1000, seed=None, chunk_tmp_size=10000000.0, verbose=False, **kwargs)[source]¶ Randomization method for calculating isotropic spatial random fields.
Parameters: - model (
CovModel
) – covariance model - mode_no (
int
, optional) – number of Fourier modes. Default:1000
- seed (
int
orNone
, optional) – the seed of the random number generator. If “None”, a random seed is used. Default:None
- chunk_tmp_size (
int
, optional) – Number of points (number of coordinates * mode_no) to be handled by one chunk while creating the fild. This is used to prevent memory overflows while generating the field. Default:1e7
- verbose (
bool
, optional) – State if there should be output during the generation. Default:False
- **kwargs – Placeholder for keyword-args
Notes
The Randomization method is used to generate isotropic spatial random fields characterized by a given covariance model. The calculation looks like:
where:
- : fourier mode number
- : random samples from a normal distribution
- : samples from the spectral density distribution of the covariance model
Attributes: Methods
__call__
(x[, y, z])Calculates the random modes for the randomization method. reset_seed
([seed])Recalculate the random amplitudes and wave numbers with the given seed. update
([model, seed])Update the model and the seed. -
__call__
(x, y=None, z=None)[source]¶ Calculates the random modes for the randomization method.
Parameters: - x (
float
,numpy.ndarray
) – the x components of the position tuple, the shape has to be (len(x), 1, 1) for 3d and accordingly shorter for lower dimensions - y (
float
,numpy.ndarray
, optional) – the y components of the pos. tupls - z (
float
,numpy.ndarray
, optional) – the z components of the pos. tuple
Returns: the random modes
Return type: - x (
-
reset_seed
(seed=nan)[source]¶ Recalculate the random amplitudes and wave numbers with the given seed.
Parameters: seed ( int
orNone
ornumpy.nan
, optional) – the seed of the random number generator. IfNone
, a random seed is used. Ifnumpy.nan
, the actual seed will be kept. Default:numpy.nan
Notes
Even if the given seed is the present one, modes will be racalculated.
-
update
(model=None, seed=nan)[source]¶ Update the model and the seed.
If model and seed are not different, nothing will be done.
Parameters:
- model (