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.1.1.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.1.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dyadic_tiling-0.1.1.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.1.1.tar.gz
Algorithm Hash digest
SHA256 120ed5bd01712c28751cda68a18acb8583c0e77d3446d58a0a495b104ca0ce2b
MD5 104c9e74afe998a1f3abf8e1516cc636
BLAKE2b-256 608827798bb6684de234a8d31e16e3279e2e81e2903394493b0824ddf380bd5e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dyadic_tiling-0.1.1-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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c2534402003ee62f62e5ade3a3727472038e240c055312811f7496cb53afbb9
MD5 8a1c6ab8bca081f179aef8cccf2abd27
BLAKE2b-256 e5c0d0dd1a976985fe5fe537d4e5dfd491861123d8acfa87db1fd1f4f0780ce2

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