From ed437519f22ada546da6c051157b2f328e6ea8e9 Mon Sep 17 00:00:00 2001 From: Tushar Saini Date: Wed, 15 May 2024 19:17:30 +0530 Subject: [PATCH 1/3] [UPD] update retailtree.py --- retailtree/retailtree.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/retailtree/retailtree.py b/retailtree/retailtree.py index a48c8c4..9eef551 100644 --- a/retailtree/retailtree.py +++ b/retailtree/retailtree.py @@ -110,15 +110,15 @@ def __fetching_ann_in_range(self, result_dict, min_angle, max_angle, result_lst) # if min_angle is None: return result_lst - def neighbors_wa(self, id: int, radius=1, mina=None, maxa=None): + def neighbors_wa(self, id: int, radius=1, amin=None, amax=None): """ Retrieves neighboring elements within a specified angle range around a given element. Args: id (int): The identifier of the central element. radius (float, optional): The radius within which to search for neighbors. Defaults to 1. - mina (min_angle) (float, optional): The minimum angle in degree. Defaults to None. - maxa (max_angle) (float, optional): The maximum angle in degree. Defaults to None. + amin (min_angle) (float, optional): The minimum angle in degree. Defaults to None. + amax (max_angle) (float, optional): The maximum angle in degree. Defaults to None. Returns: 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): } self.__fetching_ann_in_range( - result_dict, mina, maxa, result_lst) + result_dict, amin, amax, result_lst) return result_lst From 6c25a01da56401cc92cbb3d577b743b07a2ef84a Mon Sep 17 00:00:00 2001 From: Tushar Saini Date: Wed, 15 May 2024 19:18:30 +0530 Subject: [PATCH 2/3] [UPD] update README.md --- README.md | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6205109..7edda2f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # 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 @@ -14,34 +15,45 @@ RetailTree is a Python library designed for efficient management and querying of You can install retailTree via pip: ``` -1) clone the repo -2) cd retailTree -3) pip install retailTree-0.0.1-py3-none-any.whl +pip install retailtree ``` # Usage ``` -from retailTree import retailTree, Annotation -from retailTree.utils.dist_func import manhattan, euclidean +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] -obj = RetailTree() +# Create retailtree object +rt = RetailTree() -# Adding annotations -obj.add_annotation(id=1, x_min=1, y_min=1, x_max=1, y_max=1) -obj.add_annotation(id=2, x_min=2, y_min=2, x_max=2, y_max=2) +# Adding annotations to retailtree +for ann in annotations: + rt.add_annotation(ann) -# Tree Building -obj.build_tree(dist_func=manhattan) + +# Build tree +rt.build_tree(dist_func=euclidean) # Get neighbors-annotations within radius -obj.find_neighbors(id=961360402, radius=1) +print(rt.neighbors(id=3, radius=1)) # Get Top, Bottom, Right, Left annotations -obj.TBLR(id=961360402, radius=1.4) +print(rt.TBLR(id=3, radius=1, overlap=0.5)) # Get neighboring annotations within a particular angle range -obj.get_neighbors_within_angle( - id=963804130, radius=1, min_angle=0, max_angle=90) +print(rt.neighbors_wa(id=3, radius=1, amin=0, amax=180)) + +# Get annotation properties +print(rt.get(id=3).get_coords()) ``` From fe410d8abf22ca84beb70565341866bd138bf0d6 Mon Sep 17 00:00:00 2001 From: Tushar Saini Date: Wed, 15 May 2024 19:35:32 +0530 Subject: [PATCH 3/3] [UPD] update version --- setup.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 67f37bf..8ff14b5 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,15 @@ from setuptools import setup, find_packages -def read( fname ): + +def read(fname): with open(fname) as fp: content = fp.read() return content - + + setup( name="retailtree", - version="1.1", + version="1.2", long_description=read("README.md"), long_description_content_type='text/markdown', packages=find_packages(),