Skip to main content

Morton encoded dyadic cubes and points for efficient space decomposition.

Project description

DyadicTiling

PyPI version License: MIT

Morton encoded dyadic cubes and points for efficient space decomposition.

DyadicTiling is a lightweight Python package for tiling spaces of arbitrary dimension with dyadic cubes. Points are organised using Morton encodings, dyadic cubes are points with a truncation level, and tilings are collections of dyadic cubes. The natural ordering from the Morton encoding allows for efficient operations, even in high-dimensions.


✨ Features

  • Pure‑Python: Only one light-weight dependency, sortedcontainers.
  • Arbitrary dimension: The same code works from 1‑D to 17‑D and beyond.
  • PointSet & DyadicCubeSet: Membership operations in O(log n).
  • Stopping Times: Define a (consistent) rule τ(x) that assigns a level to each point and automatically get a disjoint set of dyadic cubes.
  • Fully tested: 100% coverage across 100+ unit tests.

🚀 Installation

pip install dyadic-tiling            # From PyPI (recommended)
# or
pip install git+https://github.com/Benjamin-Walker/DyadicTiling.git

Requires Python ⩾ 3.8 and sortedcontainers ⩾ 2.4.


⚡ Quick‑start

from dyadic_tiling import Point
from dyadic_tiling import DyadicCube

# 1. Encode any point in [range[0][0], range[0][1]] x [range[1][0], range[1][1]]
range = [[-3, -1], [1.1, 1.3]]
p = Point([-2.3, 1.2], coordinate_ranges=range)
print(p.get_morton_string(4))      # → '00110111' (morton code at level 4)

# 2. Grab the dyadic cube that contains it at level k
cube = p.get_containing_cube(level=2)
print(cube)                        # DyadicCube(dim=2, level=2, morton_code=0011)

# 3. Slice a PointSet by cube
from dyadic_tiling import PointSet
cloud = PointSet([p, Point([-2.5, 1.18], coordinate_ranges=range), Point([-1.1, 1.28], coordinate_ranges=range)])
print(cloud.in_cube(cube))         # Only points inside that square

# 4. Build a stopping using DyadicCubes
from dyadic_tiling import DyadicCubeSetStoppingTime
rule = DyadicCubeSetStoppingTime()
rule.add(cube)
print(rule(p))                     # 2  (the level for the point p)

📄 License

DyadicTiling is distributed under the MIT license — see LICENSE for details.


✏️ Citation

If this package saved you some time, please cite it:

@software{dyadictiling,
  author       = {Benjamin Walker},
  title        = {DyadicTiling: Morton encoded dyadic cubes and points for efficient space decomposition.},
  year         = {2025},
  url          = {https://github.com/Benjamin-Walker/DyadicTiling},
  license      = {MIT}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dyadic_tiling-0.2.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dyadic_tiling-0.2.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file dyadic_tiling-0.2.0.tar.gz.

File metadata

  • Download URL: dyadic_tiling-0.2.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for dyadic_tiling-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a65bdcb3d57218aedf00c1303404636b26ce0cca43ff18372fae173fb3c027d5
MD5 3169af7f0c91a792bee188ba177c75a3
BLAKE2b-256 e496de799f290b52df413f2f2e71808d45d4ef640e9fe56203c201599545cd33

See more details on using hashes here.

File details

Details for the file dyadic_tiling-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dyadic_tiling-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for dyadic_tiling-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99fbf97b0c8ed93d0322585301954231c412161c6c16464dc499b6f8c5f5ab8e
MD5 3a99222ec33638f3df93dd00e9b94ca4
BLAKE2b-256 ec12b061e32b7e9db5b00e5ab7895570b35e9ef39a9d387c7f87f2989dd1789b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page