Skip to main content

FyeldGenerator repository

This package provides with a quick way of generating random field having a specified power spectrum.

Example

from FyeldGenerator import generate_field
import matplotlib.pyplot as plt
import numpy as np

# Helper that generates power-law power spectrum
def Pkgen(n):
    def Pk(k):
        return np.power(k, -n)

    return Pk


# Draw samples from a normal distribution
def distrib(shape):
    a = np.random.normal(loc=0, scale=1, size=shape)
    b = np.random.normal(loc=0, scale=1, size=shape)
    return a + 1j * b


shape = (512, 512)

field = generate_field(distrib, Pkgen(2), shape)

plt.imshow(field, cmap="seismic")

Install

It is now on pypi! For the "official" release, use:

pip install FyeldGenerator

For the latest release:

pip install -e git+https://github.com/cphyc/FyeldGenerator.git#egg=FyeldGenerator

License

This work is licensed under the CC-BY-SA license. You are allowed to copy, modify and distribute it as long as you keed the license. See more in the LICENSE file.

Metadata

Release files for FyeldGenerator 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for FyeldGenerator 0.1.7
File Size Uploaded
FyeldGenerator-0.1.7.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for FyeldGenerator 0.1.7
File Interpreter ABI Platform
FyeldGenerator-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / FyeldGenerator-0.1.7.tar.gz

Download URL FyeldGenerator-0.1.7.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7f7bf86469006c8f41b96f070a6f196ed59ea488bab9daf495da358ea2146c19
BLAKE2b-256 checksum
How to use checksums
145719d19ecb4750b68eca303f6a2561d37988b282203a3843f68d7e0c0cb578
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.10

Release files / FyeldGenerator-0.1.7-py3-none-any.whl

Download URL FyeldGenerator-0.1.7-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
166e5a5f537de07c341e23b9c08553e5334860127f05ae99da12677442aa9126
BLAKE2b-256 checksum
How to use checksums
01dfc356d5b38a890f845261d6395df8f343194e4049df90cf05e9bef4157b0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.10
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page