code: def main(args):
      nlive = args.num_live_points
      ndim = args.x_dim
      nsteps = args.nsteps
      problemname = args.problem
      # num_warmup_steps = nlive * 10
  
      np.random.seed(1)
      # sampler = MLFriendsSampler()
      # region, it, Lmin, us, Ls, transform, loglike = prepare_problem(problemname, ndim, nlive, sampler)
  
      samplers = [
          # ('cubemh', CubeMHSampler(nsteps=1)),
          # ('regionmh', RegionMHSampler(nsteps=1)),
          # ('cubeslice', CubeSliceSampler(nsteps=1)),
          # ('regionslice', RegionSliceSampler(nsteps=1)),
          # ('pathslice', SamplingPathSliceSampler(nsteps=1)),
          # ('pathstep', SamplingPathStepSampler(nsteps=12, nresets=12, log=True)),
          # ('stepsampler', OtherSamplerProxy(nsteps=10, sampler='steps')),
          ("geodesic", GeodesicSliceSampler(nsteps=2)),
          ("regiongeodesic", RegionGeodesicSliceSampler(nsteps=2)),
      ]
      if args.sampler != "all":
          samplers = [
              (name, sampler)
              for name, sampler in samplers
              if name == args.sampler
          ]
      for samplername, sampler in samplers:
          print("exploring with %s ..." % sampler)
          (
              region,
              it,
              Lmin,
              us,
              Ls,
              transform,
              loglike,
          ) = prepare_problem(problemname, ndim, nlive, sampler)
  
          nc = 0
          starti = 0
          startu = us[starti, :]
          # take 20 steps
          print("taking %d steps..." % nsteps)
          sampler.reset()
          sampler.path = None
          for i in range(nsteps):
              ax = plt.figure(figsize=(10, 10)).gca()
              filename = "viz_%s_sampler_%s_step%02d.png" % (
                  problemname,
                  samplername,
                  i + 1,
              )
              # replace lowest likelihood point
              plt.plot(us[:, 0], us[:, 1], "x", ms=2, color="k")
              Lmin = Ls.min()
              # sampler.__next__(region, Lmin, us, Ls, transform, loglike, plot=True)
              plt.plot(startu[0], startu[1], "x", ms=6, color="k")
  
              while True:
                  unew = sampler.move(startu, region, plot=ax)
                  mask = np.logical_and(unew > 0, unew < 1).all(axis=1)
                  unew = unew[mask, :]
                  mask = region.inside(unew)
                  if not mask.all():
                      plt.plot(
                          unew[~mask, 0], unew[~mask, 1], "v", color="r"
                      )
                  if mask.any():
                      plt.plot(
                          unew[mask, 0], unew[mask, 1], "^", color="b"
                      )
  
                      # choose first
                      j = np.where(mask)[0][0]
                      unew = unew[j, :]
                      pnew = transform(unew)
                      Lnew = loglike(pnew)
                      nc += 1
  
                      if Lnew >= Lmin:
                          plt.plot(
                              unew[0], unew[1], "o ", ms=4, color="g"
                          )
                          plt.plot(
                              [startu[0], unew[0]],
                              [startu[1], unew[1]],
                              "--",
                              color="green",
                          )
                          sampler.adjust_accept(
                              True, unew, pnew, Lnew, nc
                          )
                          startu = unew
                          break
                      else:
                          plt.plot(
                              unew[0],
                              unew[1],
                              "o",
                              ms=4,
                              color="orange",
                          )
                          sampler.adjust_accept(
                              False, unew, pnew, Lnew, nc
                          )
                  else:
                      sampler.adjust_outside_region()
  
              xlo, xhi = plt.xlim()
              ylo, yhi = plt.ylim()
              lo = min(xlo, ylo)
              hi = max(xhi, yhi)
              lo, hi = 0, 1
              lo, hi = us.min(), us.max()
              lo, hi = lo - (hi - lo), hi + (hi - lo)
              plt.xlim(lo, hi)
              plt.ylim(lo, hi)
              plt.xlabel("x")
              plt.ylabel("y")
              plt.savefig(filename, bbox_inches="tight")
              plt.close()
  
file_path: ultranest/evaluate/viz_sampling.py
imports: import numpy
  import matplotlib.pyplot
  from ultranest.mlfriends import ScalingLayer, AffineLayer, MLFriends
  from ultranest.stepsampler import RegionMHSampler, CubeMHSampler
  from ultranest.stepsampler import CubeSliceSampler, RegionSliceSampler, SamplingPathSliceSampler, SamplingPathStepSampler, OtherSamplerProxy
  from ultranest.stepsampler import GeodesicSliceSampler, RegionGeodesicSliceSampler
  import tqdm
  from problems import transform, get_problem
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) without return types