yt.utilities.lib.distance_queue module¶
Distance queue implementation
- class yt.utilities.lib.distance_queue.DistanceQueue¶
Bases:
PriorityQueue
This is a distance queue object, designed to incrementally evaluate N positions against a reference point. It is initialized with the maximum number that are to be retained (i.e., maxn-nearest neighbors).
- find_nearest(center, points)¶
This function accepts a center and a set of [N,3] points, and it will return the indices into the points array of the maxn closest neighbors.
- setup(DW, periodicity)¶
- class yt.utilities.lib.distance_queue.PriorityQueue¶
Bases:
object
This class acts as a “priority-queue.” It was extracted from the DistanceQueue object so that it could serve as a general-purpose method for storing the N-most “valuable” objects. It’s relatively simple, in that it provides storage for a single int64 (which is usually an ‘index’ into an external array or list) and a single float64 “value” associated with them. You can insert new objects, and then if it’s already at maxn objects in it, it’ll bump the least valuable one off the end. Of particular note is that lower values are considered to be more valuable than higher ones; this is because our typical use case is to store radii.