code: def test_clustering():
      from ultranest.mlfriends import update_clusters
  
      for i in range(5):
          np.random.seed(i * 100)
  
          points = np.random.uniform(size=(100, 2))
  
          nclusters, clusteridxs, overlapped_points = update_clusters(
              points, points, 0.1**2
          )
  
          for i in np.unique(clusteridxs):
              x, y = points[clusteridxs == i].transpose()
              plt.scatter(x, y)
          plt.savefig("testclustering_0p1.pdf", bbox_inches="tight")
          plt.close()
          assert 1 < nclusters < 30
  
          nclusters, clusteridxs, overlapped_points = update_clusters(
              points, points, 0.2**2
          )
  
          for i in np.unique(clusteridxs):
              x, y = points[clusteridxs == i].transpose()
              plt.scatter(x, y)
          plt.savefig("testclustering_0p2.pdf", bbox_inches="tight")
          plt.close()
          assert 1 <= nclusters < 2
  
file_path: ultranest/tests/test_clustering.py
imports: from __future__ import print_function, division
  import numpy
  import os
  import matplotlib.pyplot
  from ultranest.utils import create_logger
  from ultranest import ReactiveNestedSampler
  from ultranest.mlfriends import MLFriends, AffineLayer
label_desc: Use image node_id 1 for calling a global function with example usage: test_clustering() without return types