Spatial Consistency¶
- class ConsistentGenerator(rng)[source]¶
Bases:
object
Generator of consistent random variables.
- Parameters:
rng (
Generator
|RandomNode
) – Random number generator used to initialize this random variable.
- add_variable(variable)[source]¶
Add a dual consistent random variable to the generator.
Returns: The variable’s offset in the generated samples.
- Return type:
- boolean(shape=None)[source]¶
Create a dual consistent boolean random variable.
- Parameters:
shape (
Optional
[Tuple
[int
,...
]]) – Shape of the output array. If not specified, the variable will be scalar.- Return type:
Returns: Dual consistent boolean random variable.
- gaussian(shape=None)[source]¶
Create a dual consistent Gaussian random variable.
- Parameters:
shape (
Optional
[Tuple
[int
,...
]]) – Shape of the output array. If not specified, the variable will be scalar.- Return type:
Returns: Dual consistent Gaussian random variable.
- class ConsistentRealization[source]¶
Bases:
ABC
,Serializable
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:
- classmethod Deserialize(process)[source]¶
Deserialize an object’s state.
Objects cannot be deserialized directly, instead a
Factory
must be instructed to carry out the deserialization process.- Parameters:
process (
DeserializationProcess
) – The current stage of the deserialization process. This object is generated by theFactory
and provides an interface to deserialization methods supporting multiple backends.- Return type:
- Returns:
The deserialized object.
- sample(position_a, position_b)[source]¶
Sample the realization given two locations in euclidean space.
- Parameters:
- Return type:
Returns: Sample of the realization.
- serialize(process)[source]¶
Serialize this object’s state.
Objects cannot be serialized directly, instead a
Factory
must be instructed to carry out the serialization process.- Parameters:
process (
SerializationProcess
) – The current stage of the serialization process. This object is generated by theFactory
and provides an interface to serialization methods supporting multiple backends.- Return type:
- class StaticConsistentRealization(scalar_samples)[source]¶
Bases:
ConsistentRealization
Consistent realization that is immutable in space.
- Parameters:
scalar_samples (
ndarray
) – Scalar samples of the realization.
- classmethod Deserialize(process)[source]¶
Deserialize an object’s state.
Objects cannot be deserialized directly, instead a
Factory
must be instructed to carry out the deserialization process.- Parameters:
process (
DeserializationProcess
) – The current stage of the deserialization process. This object is generated by theFactory
and provides an interface to deserialization methods supporting multiple backends.- Return type:
- Returns:
The deserialized object.
- sample(position_a, position_b)[source]¶
Sample the realization given two locations in euclidean space.
- Parameters:
- Return type:
Returns: Sample of the realization.
- serialize(process)[source]¶
Serialize this object’s state.
Objects cannot be serialized directly, instead a
Factory
must be instructed to carry out the serialization process.- Parameters:
process (
SerializationProcess
) – The current stage of the serialization process. This object is generated by theFactory
and provides an interface to serialization methods supporting multiple backends.- Return type:
- 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 (
ndarray
) – Scalar samples of the realization.
- class ConsistentVariable(shape, offset=0)[source]¶
Bases:
ABC
,Serializable
Base class for spatially consistent random variables.
- Parameters:
- classmethod Deserialize(process)[source]¶
Deserialize an object’s state.
Objects cannot be deserialized directly, instead a
Factory
must be instructed to carry out the deserialization process.- Parameters:
process (
DeserializationProcess
) – The current stage of the deserialization process. This object is generated by theFactory
and provides an interface to deserialization methods supporting multiple backends.- Return type:
- Returns:
The deserialized object.
- 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.
- serialize(process)[source]¶
Serialize this object’s state.
Objects cannot be serialized directly, instead a
Factory
must be instructed to carry out the serialization process.- Parameters:
process (
SerializationProcess
) – The current stage of the serialization process. This object is generated by theFactory
and provides an interface to serialization methods supporting multiple backends.- Return type:
- class ConsistentGaussian(shape, offset=0)[source]¶
Bases:
ConsistentVariable
Spatially consistent normally distributed Gaussian variable.
- Parameters:
- 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(shape, offset=0)[source]¶
Bases:
ConsistentVariable
Spatially consistent uniformly distributed random variable.
- Parameters:
- 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(shape, offset=0)[source]¶
Bases:
ConsistentVariable
Spatially consistent boolean random variable.
- Parameters:
- 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.