pynbody.gravity.direct

Contents

pynbody.gravity.direct#

pynbody.gravity.direct(f: SimSnap, ipos: ndarray, eps: float | SimArray | None = None, num_threads: int | None = None)[source]#

Calculate the gravitational acceleration and potential at the specified positions

The gravitational softening length is determined by (in order of preference):

  1. The parameter eps (scalar, unit or array)

  2. The array f['eps']

  3. f.properties['eps'] (scalar or unit)

Parameters:
  • f (pynbody.snapshot.SimSnap) – The snapshot containing the particles to be used in the calculation.

  • ipos (array_like) – The position at which the potential is to be calculated.

  • eps (float, pynbody.units.Unit, or array_like, optional) – The gravitational softening length. See above for what happens if this is not specified.

  • num_threads (int, optional) – The number of threads to use. If not specified, the number of threads is determined by the configuration parameter number_of_threads.

Returns: