Spatial encoding algorithm using psuedo hilbert curves
Project description
Spatial Codec
Modified: 2021-06
Navigation
About
Spatial codec is a spatial encoding and decoding algorithm developed for iteratively mapping any number of bytes to a 3D (N3 space) matrix. The algorithm uses a psuedo variant of Hilbert's Space Filling Curve which preserves the relative localization of bits in 3D independant of the matrix dimension which is a convienient property for error correction and scalable network policies.
Quickstart
Install scodec from the package index
python3 -m pip install --upgrade pip
...
python3 -m pip install scodec
You may be required to install some apt packages on some linux distros:
sudo xargs -a apt-packages.txt apt install -y
API
Spatial codec provides an api for interacting in 2 (N2) and 3 (N3) dimensional space. Below is an example of using the N2 space api:
from scodec.n2 import N2
# configure a 2D spatial codec using a 64 bit block size
sc = N2(block_size=64)
# encode utf-8 string and enable matplotlib visualizer
space_encode = sc.stream_encode(bytes("Hello World", "utf-8"), mpl=True)
# feed spatial encode stream back into stream decode
bytestream = sc.stream_decode(space_encode)
CLI Tool
The codec provides a cli tool for ease of use. Run the algorithm for a specified block size -b / --block, with a data stream -d / --data and dimension -n / --dimension (2 or 3). The MPL visualizer can be enabled with the -v= flag.
# n2 codec invocation
python3 -m codec -n 2 -b 512 -d "Hello World" -v=
...
# n3 codec invocation
python3 -m codec -n 3 -b 8 -d "H" -v=
License
BSD 2-Clause License available here
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scodec-0.0.5.tar.gz.
File metadata
- Download URL: scodec-0.0.5.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c3902ef27a93c0ab980e29dabfd71c88a27458d467ccef1a6e1e197986f364f
|
|
| MD5 |
1b524b5abed4f678642c8a81587b8d58
|
|
| BLAKE2b-256 |
dc7e8f1004dbff69d39fcf199ebbc163f372b8e50b6e15c4f72c4c7059afc6eb
|
File details
Details for the file scodec-0.0.5-py2-none-any.whl.
File metadata
- Download URL: scodec-0.0.5-py2-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
786d77274711f99b232434b98a61479ae3d3f6e4d5eab84a1d3b3ac4211f2e1b
|
|
| MD5 |
b3db0844e997136c0665f67471c42ec1
|
|
| BLAKE2b-256 |
440cdf0a87cae213bb68617d328e7a860cd6c5cce920d4d02e160c27122e3495
|