class_docstr: Simple Nested sampler for reference.
class_docstr_tok: ["Simple","Nested","sampler","for","reference","."]
docstr: Set up nested sampler.
  
  Parameters
  -----------
  param_names: list of str, names of the parameters.
      Length gives dimensionality of the sampling problem.
  loglike: function
      log-likelihood function.
      Receives multiple parameter vectors, returns vector of likelihood.
  transform: function
      parameter transform from unit cube to physical parameters.
      Receives multiple cube vectors, returns multiple parameter vectors.
  derived_param_names: list of str
      Additional derived parameters created by transform. (empty by default)
  log_dir: str
      where to store output files
  resume: 'resume', 'overwrite' or 'subfolder'
      if 'overwrite', overwrite previous data.
      if 'subfolder', create a fresh subdirectory in log_dir.
      if 'resume' or True, continue previous run if available.
  wrapped_params: list of bools
      indicating whether this parameter wraps around (circular parameter).
  num_live_points: int
      Number of live points
  vectorized: bool
      If true, loglike and transform function can receive arrays
      of points.
  run_num: int
      unique run number. If None, will be automatically incremented.
docstr_tok: ["Set","up","nested","sampler",".","Parameters","--","--","--","--","--","-","param_names",":","list","of","str",",","names","of","the","parameters",".","Length","gives","dimensionality","of","the","sampling","problem",".","loglike",":","function","log-likelihood","function",".","Receives","multiple","parameter","vectors",",","returns","vector","of","likelihood",".","transform",":","function","parameter","transform","from","unit","cube","to","physical","parameters",".","Receives","multiple","cube","vectors",",","returns","multiple","parameter","vectors",".","derived_param_names",":","list","of","str","Additional","derived","parameters","created","by","transform",".","(","empty","by","default",")","log_dir",":","str","where","to","store","output","files","resume",":","'resume","'",",","'overwrite","'","or","'subfolder'","if","'overwrite","'",",","overwrite","previous","data",".","if","'subfolder","'",",","create","a","fresh","subdirectory","in","log_dir",".","if","'resume","'","or","True",",","continue","previous","run","if","available",".","wrapped_params",":","list","of","bools","indicating","whether","this","parameter","wraps","around","(","circular","parameter",")",".","num_live_points",":","int","Number","of","live","points","vectorized",":","bool","If","true",",","loglike","and","transform","function","can","receive","arrays","of","points",".","run_num",":","int","unique","run","number",".","If","None",",","will","be","automatically","incremented","."]
code: def __init__(
      self,
      param_names,
      loglike,
      transform=None,
      derived_param_names=[],
      resume="subfolder",
      run_num=None,
      log_dir="logs/test",
      num_live_points=1000,
      vectorized=False,
      wrapped_params=[],
  ):
      """Set up nested sampler.
  
      Parameters
      -----------
      param_names: list of str, names of the parameters.
          Length gives dimensionality of the sampling problem.
      loglike: function
          log-likelihood function.
          Receives multiple parameter vectors, returns vector of likelihood.
      transform: function
          parameter transform from unit cube to physical parameters.
          Receives multiple cube vectors, returns multiple parameter vectors.
      derived_param_names: list of str
          Additional derived parameters created by transform. (empty by default)
      log_dir: str
          where to store output files
      resume: 'resume', 'overwrite' or 'subfolder'
          if 'overwrite', overwrite previous data.
          if 'subfolder', create a fresh subdirectory in log_dir.
          if 'resume' or True, continue previous run if available.
      wrapped_params: list of bools
          indicating whether this parameter wraps around (circular parameter).
      num_live_points: int
          Number of live points
      vectorized: bool
          If true, loglike and transform function can receive arrays
          of points.
      run_num: int
          unique run number. If None, will be automatically incremented.
  
      """
      self.paramnames = param_names
      x_dim = len(self.paramnames)
      self.num_live_points = num_live_points
      self.sampler = "nested"
      self.x_dim = x_dim
      self.derivedparamnames = derived_param_names
      num_derived = len(self.derivedparamnames)
      self.num_params = x_dim + num_derived
      self.volfactor = vol_prefactor(self.x_dim)
      if wrapped_params is None:
          self.wrapped_axes = []
      else:
          self.wrapped_axes = np.where(wrapped_params)[0]
  
      assert resume or resume in (
          "overwrite",
          "subfolder",
          "resume",
      ), "resume should be one of 'overwrite' 'subfolder' or 'resume'"
      append_run_num = resume == "subfolder"
      resume = resume == "resume" or resume
  
      if not vectorized:
          transform = vectorize(transform)
          loglike = vectorize(loglike)
  
      if transform is None:
          self.transform = lambda x: x
      else:
          self.transform = transform
  
      u = np.random.uniform(size=(2, self.x_dim))
      p = self.transform(u)
      assert p.shape == (2, self.num_params), (
          "Error in transform function: returned shape is %s, expected %s"
          % (p.shape, (2, self.num_params))
      )
      logl = loglike(p)
      assert np.logical_and(
          u > 0, u < 1
      ).all(), "Error in transform function: u was modified!"
      assert np.shape(logl) == (2,), (
          "Error in loglikelihood function: returned shape is %s, expected %s"
          % (p.shape, (2, self.num_params))
      )
      assert np.isfinite(logl).all(), (
          "Error in loglikelihood function: returned non-finite number: %s for input u=%s p=%s"
          % (logl, u, p)
      )
  
      def safe_loglike(x):
          """Call likelihood function safely wrapped to avoid non-finite values."""
          x = np.asarray(x)
          logl = loglike(x)
          assert np.isfinite(logl).all(), (
              "User-provided loglikelihood returned non-finite value:",
              logl[~np.isfinite(logl)][0],
              "for input value:",
              x[~np.isfinite(logl), :][0, :],
          )
          return logl
  
      self.loglike = safe_loglike
  
      self.use_mpi = False
      try:
          from mpi4py import MPI
  
          self.comm = MPI.COMM_WORLD
          self.mpi_size = self.comm.Get_size()
          self.mpi_rank = self.comm.Get_rank()
          if self.mpi_size > 1:
              self.use_mpi = True
      except Exception:
          self.mpi_size = 1
          self.mpi_rank = 0
  
      self.log = self.mpi_rank == 0
      self.log_to_disk = self.log and log_dir is not None
  
      if self.log and log_dir is not None:
          self.logs = make_run_dir(
              log_dir, run_num, append_run_num=append_run_num
          )
          log_dir = self.logs["run_dir"]
      else:
          log_dir = None
  
      self.logger = create_logger(
          __name__ + "." + type(self).__name__, log_dir=log_dir
      )
  
      if self.log:
          self.logger.info("Num live points [%d]", self.num_live_points)
  
      if self.log_to_disk:
          # self.pointstore = TextPointStore(os.path.join(self.logs['results'], 'points.tsv'), 2 + self.x_dim + self.num_params)
          self.pointstore = HDF5PointStore(
              os.path.join(self.logs["results"], "points.hdf5"),
              3 + self.x_dim + self.num_params,
              mode="a" if resume else "w",
          )
      else:
          self.pointstore = NullPointStore(
              3 + self.x_dim + self.num_params
          )
  
imports: from __future__ import print_function, division
  import os
  import sys
  import csv
  import json
  import operator
  import time
  import warnings
  from numpy import log, exp, logaddexp
  import numpy
  from .utils import create_logger, make_run_dir, resample_equal, vol_prefactor, vectorize, listify
  from .utils import is_affine_transform, normalised_kendall_tau_distance, distributed_work_chunk_size
  from ultranest.mlfriends import MLFriends, AffineLayer, ScalingLayer, find_nearby, WrappingEllipsoid, RobustEllipsoidRegion
  from .store import HDF5PointStore, TextPointStore, NullPointStore
  from .viz import get_default_viz_callback
  from .ordertest import UniformOrderAccumulator
  from .netiter import PointPile, SingleCounter, MultiCounter, BreadthFirstIterator, TreeNode, count_tree_between, find_nodes_before, logz_sequence
  from .netiter import dump_tree, combine_results
  from .hotstart import get_auxiliary_contbox_parameterization
label_desc: Use image node_id 1 to create a new NestedSampler object from inherited base classes: object with example: obj = NestedSampler(param_names, loglike, transform, derived_param_names, resume, run_num, log_dir, num_live_points, vectorized, wrapped_params)