Skip to main content

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:

  1. Ensure it is installed, and available[^1]

  2. In python script:

    import gaussianfft as grf
    import numpy as np
    
  3. 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.

  4. 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

  5. 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)

  6. To get the start seed that is used: seed = grf.seed()

  7. 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).

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gaussianfft-1.1.1b8.tar.gz (420.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

gaussianfft-1.1.1b8-cp312-cp312-manylinux_2_17_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp312-cp312-macosx_11_0_x86_64.whl (15.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

gaussianfft-1.1.1b8-cp311-cp311-manylinux_2_17_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp311-cp311-macosx_11_0_x86_64.whl (15.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

gaussianfft-1.1.1b8-cp310-cp310-manylinux_2_17_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp310-cp310-macosx_11_0_x86_64.whl (15.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

gaussianfft-1.1.1b8-cp39-cp39-manylinux_2_17_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp39-cp39-macosx_11_0_x86_64.whl (15.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

gaussianfft-1.1.1b8-cp38-cp38-manylinux_2_17_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp38-cp38-macosx_11_0_x86_64.whl (15.2 MB view details)

Uploaded CPython 3.8macOS 11.0+ x86-64

gaussianfft-1.1.1b8-cp37-cp37m-manylinux_2_17_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

gaussianfft-1.1.1b8-cp37-cp37m-macosx_11_0_x86_64.whl (15.2 MB view details)

Uploaded CPython 3.7mmacOS 11.0+ x86-64

File details

Details for the file gaussianfft-1.1.1b8.tar.gz.

File metadata

  • Download URL: gaussianfft-1.1.1b8.tar.gz
  • Upload date:
  • Size: 420.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for gaussianfft-1.1.1b8.tar.gz
Algorithm Hash digest
SHA256 60b7c04e4e8671e0c67819717a756cf1053f1ab1bad90c9e03ae5d03b8417290
MD5 440234f4b568842ce11a8d5b3c1b9e83
BLAKE2b-256 01a2166eedfb337502882e95f230915aaad9627f6e1f1f34a60c1c3d68ad6631

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 919e18818ae6b0e2530f09870032d986e768a0a8387d139d1bcd346a6c12cb1f
MD5 3c3701c2ccc3b4f4f17ae1a149aebfa7
BLAKE2b-256 21714589b33992d49d2cb165e75304116e07ff6f92661f603591aae5548795de

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b0f3dbe16c9b5106896ad821e8d9a1881b42497e92caada1eea2a8229745972d
MD5 456e06322debef246572ef5b6f3d5103
BLAKE2b-256 5d1987371b4dc151e0f593322325b3ae309b319feb756d7f11c466f76e183d99

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c1177a0501c26eb6fe52b1d0fb83bdf82dc95a10a99e6a480310b6dfac8ef226
MD5 4271927475fae08d1435aefde6403703
BLAKE2b-256 26a80272b92adf0bd38b78ee6fb73cbc7f0911cff7d6c51469e6d378b2d5e5c0

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 77dc4390855e901077d96d7e7dd8c3458e089ff54f9fd436583e04244844de81
MD5 80c32ef8dcb6628d45da39597d7189c8
BLAKE2b-256 2ca233fd982110630b0977b17af4144e39d5eb4e3862ba0357fc90da85672a98

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c0821e3a26e62c5914da61f48aa58f431a9e4791b60d76f3af50d88d1005e3cb
MD5 83cce4ea08750c3dcd7facb60030e2c7
BLAKE2b-256 463c3e12f7bbab1a127e5f87b58f913db3558bae9a78a7545c41901d0dd254c4

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1e3bfb2714404c715cae8ca3d53fc59a9db278a40d9c16ff2b900653ebe0cacf
MD5 5a822b67387d675da5b1452024e2bdf6
BLAKE2b-256 ad1ac28b9566b072d0f9c688a98e3365335bfb7fa9013569e754132b67e3cace

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 958ca0abed5b3f387fb9d75be28d67bd82f8bc828760f2cfc416a41f0d0da935
MD5 0f8eb0d3a0ce751a3cbd593d4d453bf1
BLAKE2b-256 ca1a0939a2376c2b6edb8538bef2c42270449b9e4e637eb11d891d815b2f5721

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 09d49ca72b9c620cc5568169ca49029103f4743ad5d32d093f9f0f1dcdcd0a45
MD5 cbe6a9f17568a2665e03bf07fac8735c
BLAKE2b-256 0469c90b4cb64b7c79f4bdf1278d5c541267357100ef92bf00ab192e95e12540

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 cdc121a476715c997134537e4962c969171ddf0e6fbf6596a906960f57686baa
MD5 1f144fcb21424315b1e9bffe1876c18f
BLAKE2b-256 dfa9d4cb95dba8ec55beb121b40ccfda685ba84c506d338b8ed18a7c9fe1cc52

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp39-cp39-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7311d8ae296a8096ede71253edbb85fdeb317be002bd743879a057277f6e1a19
MD5 b6d3004ecd18920792b35d6a8e9b71f9
BLAKE2b-256 1c82fde37ddf08b50d856daccc686fa833b9ca272c187deeb96a58ead86028bc

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f048246e4eb55cc793d20542432de49277f198ee155578722823dc38fc00e6e
MD5 2015b2fa1a3b6943d771aaf29109d282
BLAKE2b-256 0020a6849b0af8b3256c44e01c058d680ac24232607b833f4ae2b5bdd5187ffe

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 8d952e3a1bb7a447e1d91de26376daaec793fa7d216d3dbc2b3e789a1b340a21
MD5 1b76b5c6a2d1b1cac3499d0a5a24c8fb
BLAKE2b-256 ce3135196ad9d934c097961c898e74053a9f7c884beb295bb74d82d8bb9e50c7

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp38-cp38-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a4eb50eb65acff178d1f3744a8375efed46bd5de9b958c792fcc420f4cb93424
MD5 9c99630613c1707303de47e4270bcdc3
BLAKE2b-256 eadc2e60363d7f32cc0cad4b5f74475cb9f257f4f45eae536b252bec18fcfca4

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8f26d5ed8a258236193c63507422c55fdc53a80ab4d567c816f2c74c96a2351f
MD5 b7ae74af9b1af049b58a4b2241d675c6
BLAKE2b-256 244c321cf2c9b5d9aa412ea570ec839f493d0c3d30c319d393e1e30f43bab7c5

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 bf449f42955d421847648b9b67fafb25b96c020e86c6c66a671409787582db07
MD5 0c5aaffae55d483077b7d211302f856d
BLAKE2b-256 82480e7d64acc7a2d2351292cc5716f9f56da57a2746d01a3c241b45d5db1dc9

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp37-cp37m-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp37-cp37m-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d15fa1610264c0c398f59d4e1b37101a6276db068252df15f6176688b1beee0e
MD5 3ac2a92f007ff5f42f3fb51fb18f7df4
BLAKE2b-256 cfda9594875f8e7b51ab98786f7d1fa6fd4ed98676059a66b214eceb9ab1d330

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e14ef0a9b383d82073230a1c7cc2731f7b1bbf2214fa847fd9f076f7adecd4a5
MD5 411773c0b0c68ea5140acc41687f1a4f
BLAKE2b-256 a41a602afa607228cdac428d6c65b78a124e61c2a002395a2490bd46a50b1983

See more details on using hashes here.

File details

Details for the file gaussianfft-1.1.1b8-cp37-cp37m-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for gaussianfft-1.1.1b8-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 8b0faa71e3fa6308d4529309f29a18eca3769a1c6803df46aacf32a100adfc5a
MD5 25cdc7b1db58610374e053cf08937b49
BLAKE2b-256 d85b1acaabcb38eaf63df9a32fb724e07cef609fb6b181a320f3db2cad01fa05

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page