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

Uploaded Python 3

File details

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

File metadata

  • Download URL: dyadic_tiling-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 85231a8de8feb7b75cc458674558e8b5e5525b39897070e1a728a8c8a26c138b
MD5 47a212d079f0da874993968c52f11f9b
BLAKE2b-256 ca2dd2cad1cefedc770387386b869affa9d79c96719d9533e9d9b7d2a6eda8a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dyadic_tiling-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a3120004c1cb365513d6900cd96eeb0010aa906fc7091f8e9d748d7d1189ee5f
MD5 8c9d5964e293e2495b9976242b2d7eca
BLAKE2b-256 27589d12bac8926b71631f8d3ea021e470c0fae12d9173cb823915e4a16b8cd2

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