Python API

class ndtbl.ExplicitAxis(coordinates: ArrayLike)

Axis defined by explicitly provided coordinates.

Args:

coordinates: One-dimensional, strictly increasing coordinates.

coordinates() ndarray[tuple[Any, ...], dtype[float64]]

Return the axis coordinates as a float64 NumPy array.

property kind: str

Return the serialized axis kind name.

property max: float

Return the last coordinate value.

property min: float

Return the first coordinate value.

property size: int

Return the number of points on the axis.

class ndtbl.FieldGroup(axes: tuple[UniformAxis | ExplicitAxis, ...], field_names: tuple[str, ...], values: ndarray[tuple[Any, ...], dtype[float32]] | ndarray[tuple[Any, ...], dtype[float64]])

In-memory ndtbl payload and metadata.

Args:

axes: Axes that define the table dimensions. field_names: Names of the stored fields. values: Array shaped as (*axis_sizes, field_count).

property axis_sizes: tuple[int, ...]

Return the point count of each axis in storage order.

property dimension: int

Return the number of axes in the group.

property dtype: dtype[float32] | dtype[float64]

Return the normalized payload dtype.

property dtype_name: str

Return the payload dtype as a human-readable string.

property field_count: int

Return the number of fields stored at each point.

metadata() GroupMetadata

Build metadata that matches the current group contents.

property point_count: int

Return the total number of points across all axes.

class ndtbl.GroupMetadata(axes: tuple[UniformAxis | ExplicitAxis, ...], field_names: tuple[str, ...], dtype: dtype[float32] | dtype[float64], format_version: int = 1)

Metadata describing an ndtbl field group without payload values.

Args:

axes: Axes that define the table dimensions. field_names: Names of the stored fields. dtype: Payload scalar dtype, limited to float32 or float64. format_version: ndtbl binary file format version.

property axis_sizes: tuple[int, ...]

Return the point count of each axis in storage order.

property dimension: int

Return the number of axes in the table.

property dtype_name: str

Return the payload dtype as a human-readable string.

property field_count: int

Return the number of fields stored at each point.

property point_count: int

Return the total number of points across all axes.

exception ndtbl.NdtblFormatError

Raised when an .ndtbl file cannot be parsed safely.

class ndtbl.UniformAxis(min: float, max: float, size: int)

Axis with uniformly spaced coordinates.

Args:

min: Coordinate value at the first point. max: Coordinate value at the last point. size: Number of points along the axis.

coordinates() ndarray[tuple[Any, ...], dtype[float64]]

Return the axis coordinates as a float64 NumPy array.

property kind: str

Return the serialized axis kind name.

ndtbl.read_group(path: str | Path) FieldGroup

Read a complete ndtbl file into memory.

Args:

path: Path to the input .ndtbl file.

Returns:

The parsed field group including payload values.

ndtbl.read_metadata(path: str | Path) GroupMetadata

Read only metadata from an ndtbl file.

Args:

path: Path to the input .ndtbl file.

Returns:

The parsed group metadata.

ndtbl.write_group(path: str | Path, group: FieldGroup, *, max_size_mib: float = 128.0) None

Write a field group to an ndtbl file.

Args:

path: Destination path for the output .ndtbl file. group: In-memory field group to serialize. max_size_mib: Maximum serialized file size allowed before writing.