code: def read_file(
      log_dir,
      x_dim,
      num_bootstraps=20,
      random=True,
      verbose=False,
      check_insertion_order=True,
  ):
      """
      Read the output HDF5 file of UltraNest.
  
      Parameters
      ----------
      log_dir: str
          Folder containing results
      x_dim: int
          number of dimensions
      num_bootstraps: int
          number of bootstraps to use for estimating logZ.
      random: bool
          use randomization for volume estimation.
      verbose: bool
          show progress
      check_insertion_order: bool
          whether to perform MWW insertion order test for assessing convergence
  
      Returns
      ----------
      sequence: dict
          contains arrays storing for each iteration estimates of:
  
              * logz: log evidence estimate
              * logzerr: log evidence uncertainty estimate
              * logvol: log volume estimate
              * samples_n: number of live points
              * logwt: log weight
              * logl: log likelihood
  
      final: dict
          same as ReactiveNestedSampler.results and
          ReactiveNestedSampler.run return values
  
      """
      import h5py
  
      filepath = os.path.join(log_dir, "results", "points.hdf5")
      fileobj = h5py.File(filepath, "r")
      _, ncols = fileobj["points"].shape
      num_params = ncols - 3 - x_dim
  
      points = fileobj["points"][:]
      fileobj.close()
      del fileobj
      stack = list(enumerate(points))
  
      pointpile = PointPile(x_dim, num_params)
  
      def pop(Lmin):
          """Find matching sample from points file."""
          # look forward to see if there is an exact match
          # if we do not use the exact matches
          #   this causes a shift in the loglikelihoods
          for i, (idx, next_row) in enumerate(stack):
              row_Lmin = next_row[0]
              L = next_row[1]
              if row_Lmin <= Lmin and L > Lmin:
                  idx, row = stack.pop(i)
                  return idx, row
          return None, None
  
      roots = []
      while True:
          _, row = pop(-np.inf)
          if row is None:
              break
          logl = row[1]
          u = row[3 : 3 + x_dim]
          v = row[3 + x_dim : 3 + x_dim + num_params]
          roots.append(pointpile.make_node(logl, u, v))
  
      root = TreeNode(id=-1, value=-np.inf, children=roots)
  
      def onNode(node, main_iterator):
          """Insert (single) child of node if available."""
          while True:
              _, row = pop(node.value)
              if row is None:
                  break
              if row is not None:
                  logl = row[1]
                  u = row[3 : 3 + x_dim]
                  v = row[3 + x_dim : 3 + x_dim + num_params]
                  child = pointpile.make_node(logl, u, v)
                  assert logl > node.value, (logl, node.value)
                  main_iterator.Lmax = max(main_iterator.Lmax, logl)
                  node.children.append(child)
  
      return logz_sequence(
          root,
          pointpile,
          nbootstraps=num_bootstraps,
          random=random,
          onNode=onNode,
          verbose=verbose,
          check_insertion_order=check_insertion_order,
      )
  
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 a global function with example usage: read_file(log_dir, x_dim, num_bootstraps, random, verbose, check_insertion_order) and returns: logz_sequence, None,  None, idx,  row