binny.axes.grids module#

Axis grid builders.

Small helpers for building 1D grids commonly used in numerical work (e.g. k, ell, z).

binny.axes.grids.grid(kind: str, /, **kwargs: Any)#

Constructs a 1D sampling grid using a named strategy.

Supported kinds (case-insensitive) and common aliases:
  • "linear": "lin", "uniform"

  • "log": "log_grid", "logarithmic", "geom"

Parameters:
  • kind – Grid strategy selector (case-insensitive).

  • **kwargs – Parameters forwarded to the underlying grid builder.

Returns:

1D NumPy array of grid points (dtype float64).

Raises:

ValueError – If kind is not recognized.

binny.axes.grids.linear_grid(start: float, stop: float, n: int) ndarray#

Builds a linearly spaced 1D grid including endpoints.

Parameters:
  • start – Lower endpoint of the grid.

  • stop – Upper endpoint of the grid.

  • n – Number of grid points (>= 2).

Returns:

A 1D NumPy array of shape (n,) with dtype float64.

Raises:
  • TypeError – If start/stop are not real numbers or n is not integer-like.

  • ValueError – If the grid specification is invalid (e.g., non-finite or non-increasing endpoints, or n < 2).

binny.axes.grids.log_grid(start: float, stop: float, n: int) ndarray#

Builds a log-spaced 1D grid including endpoints.

Values are evenly spaced in log(x) (geometric progression).

Parameters:
  • start – Lower endpoint of the grid (must be > 0).

  • stop – Upper endpoint of the grid (must be > start).

  • n – Number of grid points (>= 2).

Returns:

A 1D NumPy array of shape (n,) with dtype float64.

Raises:
  • TypeError – If start/stop are not real numbers or n is not integer-like.

  • ValueError – If the grid specification is invalid (e.g., non-finite, non-increasing, or non-positive endpoints, or n < 2).