Skip to main content

Morton encoded dyadic cubes and points for efficient space decomposition.

Project description

DyadicTiling

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 DyadicTiling.point import Point
from DyadicTiling.dyadic_cube 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 DyadicTiling.point_set 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 DyadicTiling.stopping_time 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.0.tar.gz (22.4 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.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dyadic_tiling-0.1.0.tar.gz
Algorithm Hash digest
SHA256 59a08d498c9307b33669c57e6126286d2699e24379ecc3288f40def63d9cab97
MD5 45cdfc6cff0951a72e1a0c060b5f3024
BLAKE2b-256 05052f6b1c04013bdcea27fd683bda6574bb64eeaa8fd17404ca42e4d3584c55

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for dyadic_tiling-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90bb8a706d5203e7a10dc1b0b2b546d5d764c0069d0d0388096e239ce04b7cf9
MD5 ba740c4f8e641df378eb4d2d7a104319
BLAKE2b-256 c761ad4e9cd76d2e96015905b6593d2f16d49b5280d1d3349831df6ce9ee9986

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