mirror of
https://github.com/DifferentiableUniverseInitiative/JaxPM.git
synced 2025-05-14 12:01:12 +00:00
adds fix to make code jittablel
This commit is contained in:
parent
5dc239927f
commit
5108e56ee8
2 changed files with 7 additions and 5 deletions
|
@ -26,11 +26,9 @@ def density_plane(positions,
|
|||
xy = xy / nx * plane_resolution
|
||||
|
||||
# Selecting only particles that fall inside the volume of interest
|
||||
mask = (d > (center - width / 2)) & (d <= (center + width / 2))
|
||||
xy = xy[mask]
|
||||
|
||||
weight = jnp.where((d > (center - width / 2)) & (d <= (center + width / 2)), 1., 0.)
|
||||
# Painting density plane
|
||||
density_plane = cic_paint_2d(jnp.zeros([plane_resolution, plane_resolution]), xy)
|
||||
density_plane = cic_paint_2d(jnp.zeros([plane_resolution, plane_resolution]), xy, weight)
|
||||
|
||||
# Apply density normalization
|
||||
density_plane = density_plane / ((nx / plane_resolution) *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue