Skip to content
Snippets Groups Projects
Commit bfa2e9e6 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

add alternate random field generator

parent 10486066
Branches
Tags
1 merge request!23WIP: Feature/use cmake
Pipeline #
...@@ -143,6 +143,19 @@ def generate_data_3D( ...@@ -143,6 +143,19 @@ def generate_data_3D(
a[ii] = 0 a[ii] = 0
return a return a
def generate_random_discontinuous_data_3D(
n0, n1, n2,
dtype = np.complex128,
p = 1.5,
amplitude = 0.5):
"""returns the Fourier representation of a random field.
"""
assert(n0 % 2 == 0 and n1 % 2 == 0 and n2 % 2 == 0)
a = np.random.randn(n1, n0, n2)
b = np.fft.rfftn(a).astype(dtype)
return b
def randomize_phases(v): def randomize_phases(v):
"""randomize the phases of an FFTW complex field. """randomize the phases of an FFTW complex field.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment