Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cphyc/fyeldgenerator
Easily generate random fields
https://github.com/cphyc/fyeldgenerator
helper python random-field
Last synced: 6 days ago
JSON representation
Easily generate random fields
- Host: GitHub
- URL: https://github.com/cphyc/fyeldgenerator
- Owner: cphyc
- License: other
- Created: 2017-02-08T14:41:30.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T07:09:08.000Z (7 months ago)
- Last Synced: 2024-04-30T22:13:01.208Z (7 months ago)
- Topics: helper, python, random-field
- Language: Python
- Size: 93.8 KB
- Stars: 17
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
FyeldGenerator repository
=========================This package provides with a quick way of generating random field having a specified power spectrum.
Example
-------```python
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 * bshape = (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:
```bash
pip install FyeldGenerator
```For the latest release:
```bash
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.Citing
------
If you're using this package for research purposes, consider citing the [Zenodo entry (https://zenodo.org/record/7427712)](https://zenodo.org/record/7427712).