mirror of
https://github.com/DifferentiableUniverseInitiative/JaxPM.git
synced 2025-06-15 10:21:11 +00:00
format
This commit is contained in:
parent
e1a8134b8e
commit
67a80e1041
2 changed files with 2 additions and 2 deletions
|
@ -166,7 +166,7 @@ def uniform_particles(mesh_shape, sharding=None):
|
||||||
axis=-1)
|
axis=-1)
|
||||||
|
|
||||||
|
|
||||||
def normal_field(seed , shape, sharding=None, dtype=float):
|
def normal_field(seed, shape, sharding=None, dtype=float):
|
||||||
"""Generate a Gaussian random field with the given power spectrum."""
|
"""Generate a Gaussian random field with the given power spectrum."""
|
||||||
gpu_mesh = sharding.mesh if sharding is not None else None
|
gpu_mesh = sharding.mesh if sharding is not None else None
|
||||||
if gpu_mesh is not None and not (gpu_mesh.empty):
|
if gpu_mesh is not None and not (gpu_mesh.empty):
|
||||||
|
|
|
@ -131,7 +131,7 @@ def linear_field(mesh_shape, box_size, pk, seed, sharding=None):
|
||||||
Generate initial conditions.
|
Generate initial conditions.
|
||||||
"""
|
"""
|
||||||
# Initialize a random field with one slice on each gpu
|
# Initialize a random field with one slice on each gpu
|
||||||
field = normal_field(seed=seed , shape=mesh_shape, sharding=sharding)
|
field = normal_field(seed=seed, shape=mesh_shape, sharding=sharding)
|
||||||
field = fft3d(field)
|
field = fft3d(field)
|
||||||
kvec = fftk(field)
|
kvec = fftk(field)
|
||||||
kmesh = sum((kk / box_size[i] * mesh_shape[i])**2
|
kmesh = sum((kk / box_size[i] * mesh_shape[i])**2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue