class_docstr: Nested sampler with reactive exploration strategy.
  
  Storage & resume capable, optionally MPI parallelised.
class_docstr_tok: ["Nested","sampler","with","reactive","exploration","strategy",".","Storage","&","resume","capable",",","optionally","MPI","parallelised","."]
docstr: Ensure root has `nroots` children.
  
  Sample from prior to fill up (if needed).
  
  Parameters
  -----------
  nroots: int
      Number of root live points, after the plateau is traversed.
docstr_tok: ["Ensure","root","has","`","nroots","`","children",".","Sample","from","prior","to","fill","up","(","if","needed",")",".","Parameters","--","--","--","--","--","-","nroots",":","int","Number","of","root","live","points",",","after","the","plateau","is","traversed","."]
code: def _widen_roots(self, nroots):
      """Ensure root has `nroots` children.
  
      Sample from prior to fill up (if needed).
  
      Parameters
      -----------
      nroots: int
          Number of root live points, after the plateau is traversed.
      """
      if self.log and len(self.root.children) > 0:
          self.logger.info(
              "Widening roots to %d live points (have %d already) ...",
              nroots,
              len(self.root.children),
          )
      nnewroots = nroots - len(self.root.children)
      if nnewroots <= 0:
          # nothing to do
          return
  
      prev_u = []
      prev_v = []
      prev_logl = []
      prev_rowid = []
  
      if self.log and self.use_point_stack:
          # try to resume:
          # self.logger.info('Resuming...')
          for i in range(nnewroots):
              rowid, row = self.pointstore.pop(-np.inf)
              if row is None:
                  break
              prev_logl.append(row[1])
              prev_u.append(row[3 : 3 + self.x_dim])
              prev_v.append(
                  row[3 + self.x_dim : 3 + self.x_dim + self.num_params]
              )
              prev_rowid.append(rowid)
  
      if self.log:
          prev_u = np.array(prev_u)
          prev_v = np.array(prev_v)
          prev_logl = np.array(prev_logl)
  
          num_live_points_missing = nnewroots - len(prev_logl)
      else:
          num_live_points_missing = -1
  
      if self.use_mpi:
          num_live_points_missing = self.comm.bcast(
              num_live_points_missing, root=0
          )
          prev_u = self.comm.bcast(prev_u, root=0)
          prev_v = self.comm.bcast(prev_v, root=0)
          prev_logl = self.comm.bcast(prev_logl, root=0)
  
      assert num_live_points_missing >= 0
      if self.log and num_live_points_missing > 0:
          self.logger.info(
              "Sampling %d live points from prior ...",
              num_live_points_missing,
          )
      if num_live_points_missing > 0:
          num_live_points_todo = distributed_work_chunk_size(
              num_live_points_missing, self.mpi_rank, self.mpi_size
          )
          self.ncall += num_live_points_missing
  
          if num_live_points_todo > 0:
              active_u = np.random.uniform(
                  size=(num_live_points_todo, self.x_dim)
              )
              active_v = self.transform(active_u)
              active_logl = self.loglike(active_v)
          else:
              active_u = np.empty((0, self.x_dim))
              active_v = np.empty((0, self.num_params))
              active_logl = np.empty((0,))
  
          if self.use_mpi:
              recv_samples = self.comm.gather(active_u, root=0)
              recv_samplesv = self.comm.gather(active_v, root=0)
              recv_likes = self.comm.gather(active_logl, root=0)
              recv_samples = self.comm.bcast(recv_samples, root=0)
              recv_samplesv = self.comm.bcast(recv_samplesv, root=0)
              recv_likes = self.comm.bcast(recv_likes, root=0)
  
              active_u = np.concatenate(recv_samples, axis=0)
              active_v = np.concatenate(recv_samplesv, axis=0)
              active_logl = np.concatenate(recv_likes, axis=0)
  
          assert active_logl.shape == (num_live_points_missing,), (
              active_logl.shape,
              num_live_points_missing,
          )
  
          if self.log_to_pointstore:
              for i in range(num_live_points_missing):
                  rowid = self.pointstore.add(
                      _listify(
                          [-np.inf, active_logl[i], 0.0],
                          active_u[i, :],
                          active_v[i, :],
                      ),
                      1,
                  )
  
          if len(prev_u) > 0:
              active_u = np.concatenate((prev_u, active_u))
              active_v = np.concatenate((prev_v, active_v))
              active_logl = np.concatenate((prev_logl, active_logl))
          assert active_u.shape == (nnewroots, self.x_dim), (
              active_u.shape,
              nnewroots,
              self.x_dim,
              num_live_points_missing,
              len(prev_u),
          )
          assert active_v.shape == (nnewroots, self.num_params), (
              active_v.shape,
              nnewroots,
              self.num_params,
              num_live_points_missing,
              len(prev_u),
          )
          assert active_logl.shape == (nnewroots,), (
              active_logl.shape,
              nnewroots,
          )
      else:
          active_u = prev_u
          active_v = prev_v
          active_logl = prev_logl
  
      roots = [
          self.pointpile.make_node(logl, u, p)
          for u, p, logl in zip(active_u, active_v, active_logl)
      ]
      if len(active_u) > 4:
          self.build_tregion = not is_affine_transform(
              active_u, active_v
          )
      self.root.children += roots
  
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 7 for calling the ReactiveNestedSampler obj's underlying member method code with example usage: obj._widen_roots(nroots) without return types