tracktable.analysis.rtree module

Module contents

Find points in boxes and nearest neighbors with an R-tree.

class tracktable.analysis.rtree.RTree(points=None)[source]

Bases: object

find_nearest_neighbors(seed_point, num_neighbors)[source]

Find points near a search point

Finds the K nearest neighbors to a search point. Note that if the search point is already present in the R-tree then it will be one of the results returned.

Parameters
  • seed_point (Tracktable point) – Point whose neighbors you want to find

  • num_neighbors (int) – How many neighbors to find

Returns: Sequence of points originally supplied

find_points_in_box(min_corner, max_corner)[source]

Find points inside a box

Finds all of the points in a box between minimum and maximum corner points.

Parameters
  • min_corner (Tracktable point) – Minimum corner to bound the box

  • max_corner (Tracktable point) – Maximum corner to bound the box

Returns: Sequence of points originally supplied

points

Return the points currently held in the r-tree

NOTE: this will return the points as originally supplied by the user, not the feature vectors that actually populate the tree.

Returns: Sequence of points originally supplied