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):
The parameter
eps
(scalar, unit or array)The array
f['eps']
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:
pot (
pynbody.array.SimArray
) – The gravitational potential at the specified positions, with units.accel (
pynbody.array.SimArray
) – The gravitational acceleration at the specified positions, with units.