code: def threshold_radius(lims, dis, ids, thresh, keep_max=False):
      """restrict range-search results to those below a given radius"""
      if keep_max:
          mask = dis > thresh
      else:
          mask = dis < thresh
      new_lims = np.zeros_like(lims)
      n = len(lims) - 1
      for i in range(n):
          l0, l1 = lims[i], lims[i + 1]
          new_lims[i + 1] = new_lims[i] + mask[l0:l1].sum()
      return new_lims, dis[mask], ids[mask]
  
file_path: faiss/contrib/exhaustive_search.py
imports: import faiss
  import time
  import numpy
  import logging
label_desc: Use image node_id 5 for calling a global function with example usage: threshold_radius(lims, dis, ids, thresh, keep_max) and returns: new_lims,  dis,  ids