A fast library for simulating Gaussian Random Fields, using the fast Fourier transform
Project description
Gaussianfft
A fast library for simulating Gaussian Random Fields in 1-, 2-, and 3-dimensional space, using the fast Fourier transform (Intel MKL). It can handle very large grids (The ambition is to handle grid sizes of 1000 x 1000 x 1000 and greater).
Originally developed by Norsk Regnesentral (NR) on commission from Equinor. Documentation from Norsk Regnesentral: SAND_04_18.pdf
Usage
pip install gaussianfft
import gaussianfft as grf
grf.seed(100) # For deterministic / repeatable output
variogram = grf.variogram(grf.VariogramType.GAUSSIAN, 1000)
simulation = grf.simulate(variogram, nx=100, dx=1, ny=100, dy=1) # 2D 100 x 100 grid
See examples for examples, getting started, and other documentation.
Description
Contact person in Norsk Regnesentral: Petter Abrahamsen (2024) Contact person in Equinor: Oddvar Lia
Check Docstring for usage but a brief summary follows:
How to use it in python scripts called up from RMS:
-
Ensure it is installed, and available[^1]
-
In python script:
import gaussianfft as grf import numpy as np
-
Set variogram:
variogram = grf.variogram(variogram_name, main_range, perp_range, vert_range, azimuth, dip, power)
variogram_name
is one of:exponential
spherical
gaussian
general_exponential
(this is the only one using the exponent called power in the variogram function)matern32
matern52
matern72
constant
The ranges are given the same name as in IPL but corresponds to x,y,z directions.
Note that the simulation is a regular 3D grid and the coordinate system is right-handed. This means that input azimuth angle should be
(90 - azimut_used_in_rms)
for standard RMS grids which are left-handed. So if you want to use this in RMS and load the result into a zone in a grid in RMS (e.g by using Roxar API) then be aware of this. -
Simulation is done by:
gauss_vector = grf.simulation(variogram, nx, dx, ny, dy, nz, dz)
The gauss field output is a 1D numpy array and by using
gauss_result = np.reshape(gauss_vector, (nx, ny, nz), order='F')
one get a 3D numpy array -
To check how large the extension of the internal simulation grid is (to avoid edge effects in the result from the FFT algorithm) the grid is increased before it is simulated internally in the module. You can check this extension to see the actual grid size used. This grid size is reported by using the function:
[nx_extended, ny_extended, nz_extended] = grf.simulation_size(variogram, nx, dx, ny, dy, nz, dz)
and depends very much on the relative size of the correlation lengths and the grid size (length, width, height)
-
To get the start seed that is used:
seed = grf.seed()
-
To set a seed before calling any simulation:
grf.seed(seed_value)
Note: the returned seed from grf.seed()
is created automatically by the clock time.
If you use multiprocessing, and run several processes in parallel be sure to delay start of a new process by at least 1 second after the previous process to avoid that two different processes get the same start seed.
The return seed is the same regardless of how many times you call simulation since it is the start seed of the first call to simulation.
It must however not be called before the first call to simulation if you want the start seed to be automatically generated.
If you want to run with a predefined start seed, call grf.seed(seed_value)
before the first call to simulation.
Building
We use scikit-build-core
as the build tool, in order to use pyproject.toml
to facilitate easier building while using cmake
to build the C++ extension.
We use pybind11
to create a Python module from the C++ source code.
When building with -DCMAKE_BUILD_TARGET=Debug
(the default), Boost::filesystem.
By default, Boost 1.81.0 will be used.
This can be overwritten by setting -DBOOST_VERSION
.
You may want to create a virtual environment before building gaussianfft
.
python -m venv venv
source venv/bin/activate
For the time being, Windows is not supported due to difficulties making gaussianfft
compile there (on a windows runner on GitHub Actions).
Contributions for making it compile reliably on Windows are welcome.
The rest of this section assumes you are working on a UNIX-like system. It has been tested on macOS (Intel/Apple Silicon) and Linux (x86).
If you are compiling gaussianfft
for ARM / Aarch / Apple Silicon, ARM performance library must be installed.
Please follow ARM's Install Guide for instructions on how to install them.
The libraries are available for download here.
To build the distribution wheel(s), run
export PYTHON=<which python to use> # Only useful when not running in a virtual environment
make build
This will build the binary, and source distributions with the build
package in a temporary / ephemeral directory.
There is no caching of build artifacts in this case.
If you need to build, and iterate on the extension module, you may want to execute
cmake -S . -B build
cmake --build build
Contributing
Report bugs (description with reproducible steps + run environment) and feature requests are welcome.
[^1]: If using RMS, make sure the path where gaussianfft
is installed is available to RMS.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file gaussianfft-1.1.2.tar.gz
.
File metadata
- Download URL: gaussianfft-1.1.2.tar.gz
- Upload date:
- Size: 421.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ff2a44aac79b9168c96d52985b16d54c89bf6015ef39bf511fe12f5160953ba |
|
MD5 | ef2bca3194e4a95dace6a130e87e4c67 |
|
BLAKE2b-256 | 624161ae9960a2868cd667dbe8dc7f47b80a7479510103879d1f1389b97a0c2c |
File details
Details for the file gaussianfft-1.1.2-cp312-cp312-manylinux_2_17_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp312-cp312-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5be4c6adf818ea2a226326864edf4e9aae22c6549f94bda6b63affae95a5ac46 |
|
MD5 | 81b1d697eee670885fba800e5d22b10e |
|
BLAKE2b-256 | 182b1e636581580e03f26cf9cc42c46851dddd4981654c13bed8a600c80421f6 |
File details
Details for the file gaussianfft-1.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0914ea4eb47b98092c4bb41d992352cf66e4803a3c36429d2e27e493d7e51a96 |
|
MD5 | 10123cee0dc5c79ba98d493d4ce00f4b |
|
BLAKE2b-256 | 26e83f8ffbc47e706786f710225cd8cd34dc2d32c378ad1bc7e1d35d8033b37b |
File details
Details for the file gaussianfft-1.1.2-cp312-cp312-macosx_14_0_arm64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp312-cp312-macosx_14_0_arm64.whl
- Upload date:
- Size: 668.1 kB
- Tags: CPython 3.12, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cd3189021ee6d6aaeaab868aa9e3e1ff5f503708378adbaf45cb3bb85bede5a |
|
MD5 | 1d2143a8db87358a9c7dfdca907ae0fb |
|
BLAKE2b-256 | 0ba4e911d0586d531c75dc6861ea2e1bd916f52676c56c00b0c7b78cd39c26d7 |
File details
Details for the file gaussianfft-1.1.2-cp312-cp312-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp312-cp312-macosx_11_0_x86_64.whl
- Upload date:
- Size: 15.2 MB
- Tags: CPython 3.12, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5dc350d7273c35d7827dc55b30fa922cec9b69cd352fd5dfd3927cf3a3191fe |
|
MD5 | c7913d91dde924f2636d0daa8a2970b7 |
|
BLAKE2b-256 | 0086fc96863e87fe92636e08c1d09200c9911b418fb6d5c2fe8d4e59b04b6f86 |
File details
Details for the file gaussianfft-1.1.2-cp311-cp311-manylinux_2_17_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp311-cp311-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa872c0a51b5fdea392b1702b5e72c706e3f4f1f2cb2d31381a607ed532ea76d |
|
MD5 | 71c045b0aba3545b82131b6545b1529d |
|
BLAKE2b-256 | 618d909324905e945481beaa93ca8e8402ae2b19ab042bf1b32c9108bc61f283 |
File details
Details for the file gaussianfft-1.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a59c459d0759751f5a819ad34e4f712402bfbe7814c8dba3c4d61053bdc5c403 |
|
MD5 | 9a86a66b035313ae4cbaded0e017b80f |
|
BLAKE2b-256 | 711b8881be60d6db7ab046df738a6a9ea1a2bfa00f205e6e91c195d93e9047a8 |
File details
Details for the file gaussianfft-1.1.2-cp311-cp311-macosx_14_0_arm64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp311-cp311-macosx_14_0_arm64.whl
- Upload date:
- Size: 669.3 kB
- Tags: CPython 3.11, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbe50f37fd0f0271b3b83fbf68b405831083474bb051ac6e45fe8e4d693b387d |
|
MD5 | afdd793daff1fa26e21de82aec769ec6 |
|
BLAKE2b-256 | 917889f86530dac3e50372b7c2bb2b62bbb6cb89bfc59f4d319420fced760ad4 |
File details
Details for the file gaussianfft-1.1.2-cp311-cp311-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp311-cp311-macosx_11_0_x86_64.whl
- Upload date:
- Size: 15.2 MB
- Tags: CPython 3.11, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae5dd05d08f152f856d75a33fa088e3900e1eeedc496c8b5f97d4e2464472be7 |
|
MD5 | 982aab7ffb2b7bf9b97cac2cdc7e531a |
|
BLAKE2b-256 | c54e20929d21923c2ade493a54a09f2951d8968643698557ec6bce754ece02c5 |
File details
Details for the file gaussianfft-1.1.2-cp310-cp310-manylinux_2_17_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp310-cp310-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a879e8a83ea1a00e4a8186cd682083b466bc0eae54b4419ccd4e77c26b61e5a |
|
MD5 | 202788340c08966c358923cc86d690e5 |
|
BLAKE2b-256 | f1b8943057d1c0e4b4028c768e896ea29054131a795c68921c8c222570c6503f |
File details
Details for the file gaussianfft-1.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62d415687a4cb8ff93b02a8abc5f6fda3ca683eaa5b42b7e06a22fb5731f3f9b |
|
MD5 | b1823a9ae5f54d0cb942fe3c774833a7 |
|
BLAKE2b-256 | 1d02889600105557b661ab6d4edbd96f9924fea800ee2f1c929730ba808348ba |
File details
Details for the file gaussianfft-1.1.2-cp310-cp310-macosx_14_0_arm64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp310-cp310-macosx_14_0_arm64.whl
- Upload date:
- Size: 668.1 kB
- Tags: CPython 3.10, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6281992955e8ecae9076df243dd3fb4d8a9b92342fdd103803c3da91276e5503 |
|
MD5 | 1d286d25c6a843e81b1f2788d4d110ef |
|
BLAKE2b-256 | e48e1f1f4cfddb6b4430bb0d534f1a63906e97f60ae34d4a57a1584f4826383e |
File details
Details for the file gaussianfft-1.1.2-cp310-cp310-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp310-cp310-macosx_11_0_x86_64.whl
- Upload date:
- Size: 15.2 MB
- Tags: CPython 3.10, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9918c939c61499151554aeb5d9284dd60639ec7cf4885f770eae834ea05c715b |
|
MD5 | 5629d5885fe1cafe06b830521e32d217 |
|
BLAKE2b-256 | 3f471ceb86460c6d1b0b06850362f2b2e235a5b763876d64a27b39c372a68497 |
File details
Details for the file gaussianfft-1.1.2-cp39-cp39-manylinux_2_17_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp39-cp39-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37a0cb202464c8c515e86ddfaf5d8d5be2ce285388ed5794d00911da8e430bdd |
|
MD5 | 0f33d30898b299b456f11c8e06005e72 |
|
BLAKE2b-256 | 722e79e13ad73af82f4a85b1e4bb39968f44b55585835c526c15330896b27bb6 |
File details
Details for the file gaussianfft-1.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df55c7ef160917958b68eaf61a6bdcaf35ff9a7a3079fd7f698e58e61d147591 |
|
MD5 | 37c4eb4850536124de3bca46b903f97d |
|
BLAKE2b-256 | 734a134a7067991090ab0769e021f64f331f01f7379a690a1b147f4b31ebc670 |
File details
Details for the file gaussianfft-1.1.2-cp39-cp39-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp39-cp39-macosx_11_0_x86_64.whl
- Upload date:
- Size: 15.2 MB
- Tags: CPython 3.9, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dd5ac6207e635f6cedde995454174cb03b4d7698f80e216d0d3886de8fedceb |
|
MD5 | c8dec92aeaf05b3ec0fc33c4884d48b2 |
|
BLAKE2b-256 | e77315004a9f2d3a208d35d8cf2c343c1cce03e2ee6f96ac7741692671bd1630 |
File details
Details for the file gaussianfft-1.1.2-cp38-cp38-manylinux_2_17_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp38-cp38-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99a90414ae688d8942e8939845d192b4ddbdfd4e048a7f3c9ba5324dd09b0466 |
|
MD5 | d08242db8d5cd100cc7294d2d83d839a |
|
BLAKE2b-256 | 1b0deb620e75a9c3ac6785ecd4759093774b5f53f50529484aa5380668684666 |
File details
Details for the file gaussianfft-1.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a94a437c71dcb3b350d5f847d9fe192da53152efb0cf77d68e47b5217097470d |
|
MD5 | 550db96421b4868b5c6e4e811a42f2d4 |
|
BLAKE2b-256 | 9cb2253a92750ae66fe36d1d2f8710641e6997c00a760a928f136e0ff7fc0a72 |
File details
Details for the file gaussianfft-1.1.2-cp38-cp38-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp38-cp38-macosx_11_0_x86_64.whl
- Upload date:
- Size: 15.2 MB
- Tags: CPython 3.8, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f651ae846539fc2642749a670577a7a8d72dbc6464a70552299638a24b854d2f |
|
MD5 | bea69d6fc4ae624a8ea06ae997328fb7 |
|
BLAKE2b-256 | 3ce63a0ede95ff731ccf2f3772c220f8d67fe7561ab7ffb32524272516123651 |
File details
Details for the file gaussianfft-1.1.2-cp37-cp37m-manylinux_2_17_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp37-cp37m-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f35cc8a80b0dcefa750c5c00430626007fbc65a0ad227f76ca602c592ad35da |
|
MD5 | 6ad2ba4b7e37ec82b1af2cf69c4ae174 |
|
BLAKE2b-256 | 88f4671af9bf4943a172567dd4f28427cc66e3ff8dc02b2ea42cf21761ad7109 |
File details
Details for the file gaussianfft-1.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 12.8 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d63b20478e760b7a9cd04bf1b43486557bdaf8e86f54d76b7012fd4b8f4fde56 |
|
MD5 | ec1e01e9ed90ab4bec686d3e871149e2 |
|
BLAKE2b-256 | d61a2012453c58452a37d52b15c744d6d9c38bb77a4a11b83c8151774f9d6b7b |
File details
Details for the file gaussianfft-1.1.2-cp37-cp37m-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: gaussianfft-1.1.2-cp37-cp37m-macosx_11_0_x86_64.whl
- Upload date:
- Size: 15.2 MB
- Tags: CPython 3.7m, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 905301e13fb6f6fd85f3f6dd6324c8d547c65ad013b34a09804306239a4708c8 |
|
MD5 | 372eaa6fa1a58fb4e87cdf1e98c7b43d |
|
BLAKE2b-256 | 2e50eca4b68cf97d88490f020c69e73b21a00cbdc6f1a871d69649059ca3ebdf |