code: def main(args):
      np.random.seed(2)
      ndim = args.x_dim
      sigma = args.sigma
      centers = np.sin(np.arange(ndim) / 2.0)
      data = np.random.normal(centers, sigma).reshape((1, -1))
  
      def loglike(theta):
          sigma = 10 ** theta[:, 0]
          like = (
              -0.5
              * (
                  ((theta[:, 1:] - data) / sigma.reshape((-1, 1))) ** 2
              ).sum(axis=1)
              - 0.5 * log(2 * np.pi * sigma**2) * ndim
          )
          return like
  
      def transform(x):
          z = x * 20 - 10
          z[:, 0] = x[:, 0] * 6 - 3
          return z
  
      import string
  
      paramnames = ["sigma"] + list(string.ascii_lowercase)[:ndim]
  
      if args.reactive:
          from ultranest import ReactiveNestedSampler
  
          sampler = ReactiveNestedSampler(
              paramnames,
              loglike,
              transform=transform,
              log_dir=args.log_dir + "RNS-%dd" % ndim,
              vectorized=True,
              resume=True,
          )
          sampler.run(
              log_interval=20, min_num_live_points=args.num_live_points
          )
          sampler.plot()
      else:
          from ultranest import NestedSampler
  
          sampler = NestedSampler(
              paramnames,
              loglike,
              transform=transform,
              num_live_points=args.num_live_points,
              vectorized=True,
              log_dir=args.log_dir + "-%dd" % ndim,
              resume=True,
          )
          sampler.run()
          sampler.plot()
  
imports: import argparse
  import numpy
  from numpy import log
label_desc: Use image node_id 1 for calling a global function with example usage: main(args) and returns: like, z