code: def clustering(
      path,
      levels,
      density_threshold,
      expected_clusters,
      expected_noise,
      ccore,
      **kwargs,
  ):
      sample = read_sample(path)
  
      amount_threshold = kwargs.get("amount_threshold", 0)
  
      bang_instance = bang(
          sample,
          levels,
          ccore,
          density_threshold=density_threshold,
          amount_threshold=amount_threshold,
      )
  
      bang_instance.process()
  
      clusters = bang_instance.get_clusters()
      noise = bang_instance.get_noise()
      directory = bang_instance.get_directory()
      dendrogram = bang_instance.get_dendrogram()
  
      assertion.eq(len(clusters), len(dendrogram))
  
      obtained_length = len(noise)
      obtained_cluster_length = []
      for cluster in clusters:
          obtained_length += len(cluster)
          obtained_cluster_length.append(len(cluster))
  
      obtained_cluster_length.sort()
  
      assertion.eq(len(sample), obtained_length)
      assertion.eq(expected_noise, len(noise))
  
      if expected_clusters is not None:
          assertion.eq(len(expected_clusters), len(clusters))
          assertion.eq(expected_clusters, obtained_cluster_length)
  
      leafs = directory.get_leafs()
      covered_points = set()
      for leaf in leafs:
          points = leaf.get_points()
          for index_point in points:
              covered_points.add(index_point)
  
      assertion.eq(len(sample), len(covered_points))
      return bang_instance
  
file_path: pyclustering/pyclustering/cluster/tests/bang_templates.py
imports: import matplotlib
  from pyclustering.tests.assertion import assertion
  from pyclustering.cluster.bang import bang, bang_visualizer, bang_animator
  from pyclustering.utils import read_sample
label_desc: Use image node_id 1 for calling the bang_test_template obj's underlying member method code with example usage: obj.clustering(path, levels, density_threshold, expected_clusters, expected_noise, ccore) and returns: bang_instance