No project description provided
Project description
RetailTree
RetailTree is a Python library designed for efficient management and querying of spatial data utilizing a tree-based data structure. Specifically, RetailTree employs a VP (Vantage Point) tree for optimized spatial data management.
Key Features
- Nearest Neighbor Search: RetailTree enables finding the nearest neighbors in 2D space.
- Tree-Based Structure: Utilizes a VP tree for optimized spatial data management.
- Top, Right, Left, and Bottom Annotations: Supports retrieval of annotations based on their relative positions.
- Annotations within Angle Range: Provides functionality to retrieve annotations within a specified angle range relative to a reference point.
Installation
You can install retailTree via pip:
pip install retailtree
Usage
from retailtree import RetailTree, Annotation
from retailtree.utils.dist_func import manhattan, euclidean
# Create annotation object
ann1 = Annotation(id=1, x_min=2, y_min=1, x_max=3, y_max=2)
ann2 = Annotation(id=2, x_min=1, y_min=2, x_max=2, y_max=3)
ann3 = Annotation(id=3, x_min=2, y_min=2, x_max=3, y_max=3)
ann4 = Annotation(id=4, x_min=3, y_min=2, x_max=4, y_max=3)
ann5 = Annotation(id=5, x_min=2, y_min=3, x_max=3, y_max=4)
annotations = [ann1, ann2, ann3, ann4, ann5]
# Create retailtree object
rt = RetailTree()
# Adding annotations to retailtree
for ann in annotations:
rt.add_annotation(ann)
# Build tree
rt.build_tree(dist_func=euclidean)
# Get neighbors-annotations within radius
print(rt.neighbors(id=3, radius=1))
# Get Top, Bottom, Right, Left annotations
print(rt.TBLR(id=3, radius=1, overlap=0.5))
# Get neighboring annotations within a particular angle range
print(rt.neighbors_wa(id=3, radius=1, amin=0, amax=180))
# Get annotation properties
print(rt.get(id=3).get_coords())
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
retailtree-1.2.tar.gz
(8.3 kB
view details)
Built Distribution
retailtree-1.2-py3-none-any.whl
(10.2 kB
view details)
File details
Details for the file retailtree-1.2.tar.gz
.
File metadata
- Download URL: retailtree-1.2.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c1eefdb607e5cbd194fc580533a9ba6649cd05d2e8aaa77d93f0455aa4daac9 |
|
MD5 | 5d27986c22ab41cd9f9139e709df2099 |
|
BLAKE2b-256 | 85cbf774d9c529d869b7ca347a5c3197fbb444bf34503155dce4fd6ff63a05d8 |
File details
Details for the file retailtree-1.2-py3-none-any.whl
.
File metadata
- Download URL: retailtree-1.2-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdd487ed3296176f46d86494e575076575b9d97f538ee461d17518b119c3c571 |
|
MD5 | b69d203166e43d5e3300efec60ee6d87 |
|
BLAKE2b-256 | 519090ac742412053909cf7d19720d6cb0628e6f6e9186b82e7b8b0119bfa92e |