fit_field

cosmax.tools.fit_field(key: Array, elements: int, field: Array, total_mass: float, size: float = 1.0, iterations: float = 400, learning_rate: float = 0.005) Tuple[Array, Array, Array]

Given a 3D density field, fit the particle positions and masses such that the density field is well represented by the particles.

Parameters:
  • key – random key

  • elements – cubic root of the number of particles

  • field – 3D density field

  • total_mass – total mass of the field

  • size – size of the box in real space

  • iterations – number of iterations

  • learning_rate – learning rate

Returns:

initial particle positions, fitted particle positions, particle masses