Skip to content

Commit 483ca58

Browse files
authored
Merge pull request #5 from ParallelDots/documentation
Documentation updation along with minor changes
2 parents dbf35c5 + fe410d8 commit 483ca58

3 files changed

Lines changed: 36 additions & 22 deletions

File tree

README.md

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RetailTree
2+
23
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.
34

45
# Key Features
@@ -14,34 +15,45 @@ RetailTree is a Python library designed for efficient management and querying of
1415
You can install retailTree via pip:
1516

1617
```
17-
1) clone the repo
18-
2) cd retailTree
19-
3) pip install retailTree-0.0.1-py3-none-any.whl
18+
pip install retailtree
2019
```
2120

2221
# Usage
2322

2423
```
25-
from retailTree import retailTree, Annotation
26-
from retailTree.utils.dist_func import manhattan, euclidean
24+
from retailtree import RetailTree, Annotation
25+
from retailtree.utils.dist_func import manhattan, euclidean
26+
27+
# Create annotation object
28+
ann1 = Annotation(id=1, x_min=2, y_min=1, x_max=3, y_max=2)
29+
ann2 = Annotation(id=2, x_min=1, y_min=2, x_max=2, y_max=3)
30+
ann3 = Annotation(id=3, x_min=2, y_min=2, x_max=3, y_max=3)
31+
ann4 = Annotation(id=4, x_min=3, y_min=2, x_max=4, y_max=3)
32+
ann5 = Annotation(id=5, x_min=2, y_min=3, x_max=3, y_max=4)
33+
34+
annotations = [ann1, ann2, ann3, ann4, ann5]
2735
28-
obj = RetailTree()
36+
# Create retailtree object
37+
rt = RetailTree()
2938
30-
# Adding annotations
31-
obj.add_annotation(id=1, x_min=1, y_min=1, x_max=1, y_max=1)
32-
obj.add_annotation(id=2, x_min=2, y_min=2, x_max=2, y_max=2)
39+
# Adding annotations to retailtree
40+
for ann in annotations:
41+
rt.add_annotation(ann)
3342
34-
# Tree Building
35-
obj.build_tree(dist_func=manhattan)
43+
44+
# Build tree
45+
rt.build_tree(dist_func=euclidean)
3646
3747
# Get neighbors-annotations within radius
38-
obj.find_neighbors(id=961360402, radius=1)
48+
print(rt.neighbors(id=3, radius=1))
3949
4050
# Get Top, Bottom, Right, Left annotations
41-
obj.TBLR(id=961360402, radius=1.4)
51+
print(rt.TBLR(id=3, radius=1, overlap=0.5))
4252
4353
# Get neighboring annotations within a particular angle range
44-
obj.get_neighbors_within_angle(
45-
id=963804130, radius=1, min_angle=0, max_angle=90)
54+
print(rt.neighbors_wa(id=3, radius=1, amin=0, amax=180))
55+
56+
# Get annotation properties
57+
print(rt.get(id=3).get_coords())
4658
4759
```

retailtree/retailtree.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ def __fetching_ann_in_range(self, result_dict, min_angle, max_angle, result_lst)
110110
# if min_angle is None:
111111
return result_lst
112112

113-
def neighbors_wa(self, id: int, radius=1, mina=None, maxa=None):
113+
def neighbors_wa(self, id: int, radius=1, amin=None, amax=None):
114114
"""
115115
Retrieves neighboring elements within a specified angle range around a given element.
116116
117117
Args:
118118
id (int): The identifier of the central element.
119119
radius (float, optional): The radius within which to search for neighbors. Defaults to 1.
120-
mina (min_angle) (float, optional): The minimum angle in degree. Defaults to None.
121-
maxa (max_angle) (float, optional): The maximum angle in degree. Defaults to None.
120+
amin (min_angle) (float, optional): The minimum angle in degree. Defaults to None.
121+
amax (max_angle) (float, optional): The maximum angle in degree. Defaults to None.
122122
123123
Returns:
124124
list: A list of dictionaries containing information about neighboring elements,
@@ -139,7 +139,7 @@ def neighbors_wa(self, id: int, radius=1, mina=None, maxa=None):
139139
}
140140

141141
self.__fetching_ann_in_range(
142-
result_dict, mina, maxa, result_lst)
142+
result_dict, amin, amax, result_lst)
143143

144144
return result_lst
145145

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
from setuptools import setup, find_packages
22

3-
def read( fname ):
3+
4+
def read(fname):
45
with open(fname) as fp:
56
content = fp.read()
67
return content
7-
8+
9+
810
setup(
911
name="retailtree",
10-
version="1.1",
12+
version="1.2",
1113
long_description=read("README.md"),
1214
long_description_content_type='text/markdown',
1315
packages=find_packages(),

0 commit comments

Comments
 (0)