Simple package to symmetric generate random field.
Project description
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.
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file FyeldGenerator-0.1.7.tar.gz.
File metadata
- Download URL: FyeldGenerator-0.1.7.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f7bf86469006c8f41b96f070a6f196ed59ea488bab9daf495da358ea2146c19
|
|
| MD5 |
020558f74d08fcec572fee01b63d8122
|
|
| BLAKE2b-256 |
145719d19ecb4750b68eca303f6a2561d37988b282203a3843f68d7e0c0cb578
|
File details
Details for the file FyeldGenerator-0.1.7-py3-none-any.whl.
File metadata
- Download URL: FyeldGenerator-0.1.7-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
166e5a5f537de07c341e23b9c08553e5334860127f05ae99da12677442aa9126
|
|
| MD5 |
0de039c2fa1fa6249aed42032b7b0176
|
|
| BLAKE2b-256 |
01dfc356d5b38a890f845261d6395df8f343194e4049df90cf05e9bef4157b0a
|