hmf.core._kernels.lattice.lattice_index

hmf.core._kernels.lattice.lattice_index(x: float, step: float, *, up: bool) → int[source]

The index of the lattice node at or beyond x.

Parameters:
  • x – A position, in the same unit as step.

  • step – The spacing of the lattice, > 0.

  • up – If True, the first node at or above x; else the last node at or below it.

Returns:

The node’s index i, i.e. the node is at i * step. A position within LATTICE_RTOL steps of a node is on it, so rounding errors in x do not add or drop a node.

Return type:

int