Spatial Consistency¶
- class ConsistentGenerator(rng)[source]¶
Bases:
objectGenerator 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,SerializableBase class for a realization of a consistent random generator.
- class DualConsistentRealization(frequencies, phases)[source]¶
Bases:
ConsistentRealizationRealization 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
Factorymust be instructed to carry out the deserialization process.- Parameters:
process (
DeserializationProcess) – The current stage of the deserialization process. This object is generated by theFactoryand 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
Factorymust be instructed to carry out the serialization process.- Parameters:
process (
SerializationProcess) – The current stage of the serialization process. This object is generated by theFactoryand provides an interface to serialization methods supporting multiple backends.- Return type:
- class StaticConsistentRealization(scalar_samples)[source]¶
Bases:
ConsistentRealizationConsistent 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
Factorymust be instructed to carry out the deserialization process.- Parameters:
process (
DeserializationProcess) – The current stage of the deserialization process. This object is generated by theFactoryand 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
Factorymust be instructed to carry out the serialization process.- Parameters:
process (
SerializationProcess) – The current stage of the serialization process. This object is generated by theFactoryand provides an interface to serialization methods supporting multiple backends.- Return type:
- class ConsistentSample[source]¶
Bases:
objectSample of a consistent realization.
Generated by calling
ConsistentRealization.sample().
- class DualConsistentSample(scalar_samples)[source]¶
Bases:
ConsistentSampleSample of a dual consistent realization.
Generated by calling
DualConsistentRealization.sample().Initialize a dual consistent sample.
- class StaticConsistentSample(scalar_samples)[source]¶
Bases:
ConsistentSampleConsistent sample that is invariant in space.
- Parameters:
scalar_samples (
ndarray) – Scalar samples of the realization.
- class ConsistentVariable(shape, offset=0)[source]¶
Bases:
ABC,SerializableBase class for spatially consistent random variables.
- Parameters:
- classmethod Deserialize(process)[source]¶
Deserialize an object’s state.
Objects cannot be deserialized directly, instead a
Factorymust be instructed to carry out the deserialization process.- Parameters:
process (
DeserializationProcess) – The current stage of the deserialization process. This object is generated by theFactoryand 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
Factorymust be instructed to carry out the serialization process.- Parameters:
process (
SerializationProcess) – The current stage of the serialization process. This object is generated by theFactoryand provides an interface to serialization methods supporting multiple backends.- Return type:
- class ConsistentGaussian(shape, offset=0)[source]¶
Bases:
ConsistentVariableSpatially 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:
ConsistentVariableSpatially 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:
ConsistentVariableSpatially 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.