eelregit / pmwd

Differentiable Cosmological Forward Model
BSD 3-Clause "New" or "Revised" License
69 stars 16 forks source link

PM prototype #1

Closed eelregit closed 2 years ago

modichirag commented 2 years ago
eelregit commented 2 years ago
* I am wondering if we should also add numpart_1d and ndim to the static config class since they are fundamentally on par with mesh_shape

We don't want to completely exclude glass ICs.

For the current use cases the spatial dimension is inferred from Particles.ndim and len(mesh_shape). What do you think will need that additionally?

* Also in the current implementation, is it possible to run boxes which are anisotropic- i.e. different shape/sizes in terms of cell_size, mesh_shape or number of particles in 3 directions?

Right, that's the reason they are parameterized by a scalar cell_size and a tuple mesh_shape instead of box_size.

modichirag commented 2 years ago

On Thu, Nov 11, 2021 at 4:29 PM Yin Li @.***> wrote:

@.**** commented on this pull request.

In pmwd/pm.py https://github.com/eelregit/pmwd/pull/1#discussion_r747901699:

  • neg_ik = jnp.where(jnp.abs(jnp.abs(k) - nyquist) <= eps, 0j, -1j * k)
  • neg_grad = neg_ik * pot
  • return neg_grad
  • +def gravity(ptcl, param, dconf, sconf):

  • """Compute particles' gravitational forces on a mesh with FFT
  • """
  • kvec = rfftnfreq(sconf.mesh_shape,
  • cell_size=dconf.cell_size, dtype=ptcl.real_dtype)
  • dens = jnp.zeros(sconf.mesh_shape, dtype=ptcl.real_dtype)
  • dens = scatter(ptcl, dens, chunk_size=sconf.chunk_size)

Yes I think they have the cell_size missing. Thanks!

BTW can you split the commits into units commit message and history will be cleaner that way and contributions are not easier to sort out when commits are squashed (fix into buggy ones)

yeah, sorry about that but I noticed the bug after I had already made other changes in the file so there did not seem to be a good way of making a unit commit out of it but will try in future.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/eelregit/pmwd/pull/1#discussion_r747901699, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADF45XWERRJTGX6G65ZV77DULRNXNANCNFSM5DG7ZNVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Chirag Modi Flatiron Research Fellow, Cosmology X Data Science Group Center for Computational Astrophysics Center for Computational Mathematics Flatiron Institute, Simons Foundation