Spatial Consistency¶
- class ConsistentGenerator(rng)[source]¶
Bases:
object
Generator of consistent random variables.
- Parameters:
rng (np.random.Generator | RandomNode) – Random number generator used to initialize this random variable.
- add_variable(variable)[source]¶
Add a dual consistent random variable to the generator.
Return the variable’s offset in the generated samples.
- Return type:
- realize(decorrelation_distance, num_sinusoids=30)[source]¶
- Parameters:
- Return type:
Returns: Realization of the consistent generator.
- class ConsistentRealization[source]¶
Bases:
ABC
,HDFSerializable
Base class for a realization of a consistent random generator.
- class DualConsistentRealization(frequencies, phases)[source]¶
Bases:
ConsistentRealization
Realization of a set of dual consistent random variables.
- Parameters:
frequencies (np.ndarray) – Frequencies of the spatially consistent process.
phases (np.ndarray) – Phases of the spatially consistent process.
- class StaticConsistentRealization(scalar_samples)[source]¶
Bases:
ConsistentRealization
Consistent realization that is immutable in space.
- Parameters:
scalar_samples (np.ndarray) – Scalar samples of the realization.
- class ConsistentSample[source]¶
Bases:
object
Sample of a consistent realization.
Generated by calling
ConsistentRealization.sample()
.
- class DualConsistentSample(scalar_samples)[source]¶
Bases:
ConsistentSample
Sample of a dual consistent realization.
Generated by calling
DualConsistentRealization.sample()
.Initialize a dual consistent sample.
- class StaticConsistentSample(scalar_samples)[source]¶
Bases:
ConsistentSample
Consistent sample that is invariant in space.
- Parameters:
scalar_samples (np.ndarray) – Scalar samples of the realization.
- class ConsistentVariable(generator, shape=None)[source]¶
Bases:
ABC
Base class for spatially consistent random variables.
- Parameters:
generator (ConsistentGenerator) – Generator to which this variable belongs.
shape (Tuple[int, ...] | None, optional) – Shape of the output array. Scalar by default.
- sample(sample)[source]¶
Sample the variable given a sample of the realization.
- Parameters:
sample (ConsistentSample) – Sample of the realization.
- Return type:
Returns: Numpy array of samples of dimensions matching the variable size.
- class ConsistentGaussian(generator, shape=None)[source]¶
Bases:
ConsistentVariable
Spatially consistent normally distributed Gaussian variable.
- Parameters:
generator (ConsistentGenerator) – Generator to which this variable belongs.
shape (Tuple[int, ...] | None, optional) – Shape of the output array. Scalar by default.
- sample(sample, mean=0.0, std=1.0)[source]¶
Sample the variable given a sample of the realization.
- Parameters:
sample (ConsistentSample) – Sample of the realization.
- Return type:
Returns: Numpy array of samples of dimensions matching the variable size.
- class ConsistentUniform(generator, shape=None)[source]¶
Bases:
ConsistentVariable
Spatially consistent uniformly distributed random variable.
- Parameters:
generator (ConsistentGenerator) – Generator to which this variable belongs.
shape (Tuple[int, ...] | None, optional) – Shape of the output array. Scalar by default.
- sample(sample)[source]¶
Sample the variable given a sample of the realization.
- Parameters:
sample (ConsistentSample) – Sample of the realization.
- Return type:
Returns: Numpy array of samples of dimensions matching the variable size.
- class ConsistentBoolean(generator, shape=None)[source]¶
Bases:
ConsistentVariable
Spatially consistent boolean random variable.
- Parameters:
generator (ConsistentGenerator) – Generator to which this variable belongs.
shape (Tuple[int, ...] | None, optional) – Shape of the output array. Scalar by default.
- sample(sample)[source]¶
Sample the variable given a sample of the realization.
- Parameters:
sample (ConsistentSample) – Sample of the realization.
- Return type:
Returns: Numpy array of samples of dimensions matching the variable size.