Skip to main content

tidy3a

Tidy-style verbs for named multidimensional arrays: point clouds, images, sensor measurements, scientific and complex-valued arrays. Built on xarray and NumPy, in the spirit of tidy3.

Status: version 0.3.0; 0.2.0 is on PyPI. The design decisions are in docs/plan.md; the rules fit on one page in docs/decisions.md.

Requires Python 3.11 or newer and NumPy. From a checkout, install the package with xarray, for xarray inputs and outputs and for lazy and memory-mapped data:

python -m pip install -e ".[xarray]"

Without the extra, tidy3a needs NumPy alone: in-memory pipelines run on the NumPy backend (the default wherever it holds the data without loss; see docs/backends.md), arrays come in through read_array and read_binary, and results go out through pull() and to_dict(). The fast extra (".[xarray,fast]") adds Numba for compiled grouped sums and means; results are the same with or without it.

Quick start

import numpy as np
from tidy3a import fields, filter, formula, infer, mutate, pull, read_array

points = np.array([[3, 4, 0], [0, 0, 50], [60, 0, 0]], dtype="float32")
cloud = read_array(
    points,
    dims={"point": infer, "feature": 3},
    labels={"feature": ["x", "y", "z"]},
    field_axis="feature",
)
x, y, z, distance = fields("x", "y", "z", "distance")

nearby = (
    cloud
    >> mutate(distance = formula(r"\sqrt{x^2 + y^2 + z^2}"))
    >> filter(distance <= 50)
)
print(nearby >> pull(distance))  # [ 5. 50.]

The implemented API includes read_array, read_binary, fixed_text, infer, tidy(), tidy-layer verbs (select, filter, slice, mutate, group_by, summarise, joins, pull, bind_cols), array helpers (dot, numeric functions, conj, rename_axes, pack), and formula() for plain mathematical text and a strict LaTeX dialect. Scripts declare names with fields() or write col("x"). collect() returns a computed xarray Dataset; to_xarray() returns a shallow copy sharing the underlying values; to_dict() returns NumPy arrays in xarray's to_dict layout. An array from the calling code, such as a rotation matrix, is an xarray DataArray or a one-variable read_array(...) result.

Notebooks

Install IPython separately to use the notebook extension. In a notebook cell:

%load_ext tidy3a.jupyter
from tidy3a import *

The extension enables bare field names inside verbs, so the quick-start example can omit the fields() declaration. Multi-line pipes need parentheses. Sharing a notebook with tidy3 requires its ownership-aware transformer; the prerequisite is recorded in the plan.

Execution and first-release scope

The first release runs eagerly on NumPy. read_array accepts homogeneous raw numeric files, .npy files, and NumPy arrays. read_binary reads mixed fixed-width records into separate variables, preserving numeric types and strictly decoding UTF-8/ASCII text declared with fixed_text. Records can be packed or have explicit field offsets and padding; see the reader contract for supported options. tidy() wraps xarray DataArrays and Datasets; optional file readers stay in xarray's ecosystem.

read_array(..., lazy=True) memory-maps raw and .npy files. It does not make the verb pipeline lazy: arithmetic can allocate results, filtering evaluates its mask, and updating a field label copies its containing array into memory. tidy() preserves a lazy xarray input initially; collect() computes it. Dask execution guarantees remain planned.

Integer arithmetic follows NumPy, including unsigned subtraction wrapping around. Convert before subtracting when negative results are needed, for example nir * 1.0 - red for uint8 image bands. See first-release limitations for the supported subset.

Examples and development

The point-cloud example runs on real nuScenes Mini data and checks itself against plain NumPy:

python examples/nuscenes_sweep.py /path/to/nuscenes-mini

Three public sample datasets (gridded air temperature, ERA-Interim wind, and stars' Landsat scene) run against plain xarray; see examples/sample_data.py for the files, optional reader dependencies, and checks.

To run the local tests:

python -m pip install -e ".[dev]"
python -m pytest -q

Before pushing, run the CI checks in fresh environments with only declared dependencies (requires uv):

scripts/check.sh

The release procedure describes the GitHub Release workflow and the one-time GitHub/PyPI setup.

License

MIT

Metadata

Release files for tidy3a 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tidy3a 0.3.0
File Size Uploaded Provenance Actions
tidy3a-0.3.0.tar.gz 284.6 kB With provenance Details for tidy3a-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tidy3a 0.3.0
File Interpreter ABI Platform Actions
tidy3a-0.3.0-py3-none-any.whl Python 3 none any Details for tidy3a-0.3.0-py3-none-any.whl

Total release size: 403.6 kB

Release files / tidy3a-0.3.0.tar.gz

Download URL tidy3a-0.3.0.tar.gz
Size 284.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5f01e6e47647cde54908872e183f7ba0d788ed5b298d3b5723b3dc8c9d9f8dde
BLAKE2b-256 checksum
How to use checksums
aaa91758fca169db420f382e926b66380a371214aaaa7d0f00484452942d5043
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / tidy3a-0.3.0-py3-none-any.whl

Download URL tidy3a-0.3.0-py3-none-any.whl
Size 118.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
617a40cb8b0a1a23591a36865813036326e1062f06d225505dfa1712e9f375ce
BLAKE2b-256 checksum
How to use checksums
d34c4eab4783fe0ce5dbca23fe1e59f78abb8f209f61d37b1177369741c3c570
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for tidy3a 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tidy3a-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page