xoa.core.tiles.fit_regular_axis

xoa.core.tiles.fit_regular_axis#

xoa.core.tiles.fit_regular_axis(axes, step=None, origin=None, size=None, name='axis')[source]#

Get the regular axis that holds increasing 1D axes

What is not given is inferred. The step is first estimated from the axes, then refined with a least squares fit on all their points, which avoids a drift over large grids with single precision coordinates, and rounded to 8 significant digits. The origin is the lowest coordinate and the size covers the last coordinate.

Parameters:
  • axes (list(array_like)) – Increasing 1D coordinates, like those of tiles

  • step (None, float)

  • origin (None, float) – Coordinate of the index 0

  • size (None, int)

  • name (str) – Name of the axis for error messages

Returns:

  • float – Step

  • float – Origin

  • int – Size

Raises:

xoa.exceptions.XoaError – When the step cannot be inferred, or when an axis starts before the origin