Implementation of the AxesImpl abstract base class.

AxesImpl

Bases: Impl[R]

Base class for axis metadata containers.

AxesImpl is a lightweight container for axis metadata (names, bounds, periodicity flags, and units). It does NOT store or manipulate the underlying numerical data; instead it standardizes how set representations (of type R) expose axis-aware interactions (selection, projection, formatting).

Construction (new):

AxesImpl([
    dict(name=   'x', bounds=[xmin, xmax], unit='m'),
    dict(name='*phi', bounds=[0, 2*pi],    unit='rad'),
    dict(name=   'y', bounds=[-5, 5]),  # unit optional
])

Also accepted (shorthand): AxesImpl(['x', 'y', 'z']) # all (-inf,+inf), no units

Conventions
  • Leading '' in name => periodic axis (name stored without '').
  • bounds omitted or Ellipsis => (-inf, +inf)
  • unit omitted => ''
  • Each axis spec must be a dict with at minimum a 'name' key (unless list[str] form used).

Key properties / methods: - ndim: number of axes - axis(ax): resolve axis identifier (int index or name) to int - axis_name(i): canonical name at index i - axis_bounds(ax): (min, max) tuple for the resolved axis - axis_is_periodic(ax): True if marked periodic (via leading '*') - project_onto(inp, axes): subclasses implement projection onto one or multiple axes.

__init__(specs)

Construct AxesImpl.

Parameters:

Name Type Description Default
axes

Either a list of axis spec dicts (preferred) or list of axis name strings. Dict form keys: name (required), bounds (optional), unit (optional), periodic (optional bool). Periodicity may also be encoded by leading '*' in the name.

required

assert_axis(ax)

Assert that the given axis identifier is valid.

axis(ax)

Resolve the given axis identifier to an integer index.

axis_bounds(ax)

Get the (min, max) bounds tuple of the given axis.

axis_is_periodic(ax)

Return True if the given axis is marked periodic.

axis_name(i)

Get the canonical name of the axis at the given index.

axis_unit(ax)

Get the unit string of the axis at the given index.

project_onto(inp, axes, **kwds)

Project the input set representation onto the specified axes.

This method should be implemented in subclasses. The axes argument may be a single axis identifier or a tuple of them. Additional keyword arguments may be accepted by subclasses.

Parameters:

Name Type Description Default
inp R

The input set to project.

required
axes Axis | tuple[Axis, ...]

The axis or axes to project onto.

required
**kwds

Additional keyword arguments for subclass-specific behavior.

{}

Returns:

Type Description
R

The projected set.