code: def dump_tree(filename, roots, pointpile):
      """Write a copy of the tree to a HDF5 file.
  
      Parameters
      ----------
      filename: str
          output filename
      roots: list
          list of :py:class:`TreeNode` specifying the roots of the tree.
      pointpile: :py:class:`PointPile`
          information on the node points
      """
      import h5py
  
      nodes_from_ids = []
      nodes_to_ids = []
      nodes_values = []
  
      explorer = BreadthFirstIterator(roots)
      while True:
          next_node = explorer.next_node()
          if next_node is None:
              break
          (
              rootid,
              node,
              (
                  active_nodes,
                  active_rootids,
                  active_values,
                  active_nodeids,
              ),
          ) = next_node
          for c in node.children:
              nodes_from_ids.append(node.id)
              nodes_to_ids.append(c.id)
              nodes_values.append(c.value)
          explorer.expand_children_of(rootid, node)
  
      with h5py.File(filename, "w") as f:
          f.create_dataset(
              "unit_points",
              data=pointpile.us[: pointpile.nrows, :],
              compression="gzip",
              shuffle=True,
          )
          f.create_dataset(
              "points",
              data=pointpile.ps[: pointpile.nrows, :],
              compression="gzip",
              shuffle=True,
          )
  
          f.create_dataset(
              "nodes_parent_id",
              data=nodes_from_ids,
              compression="gzip",
              shuffle=True,
          )
          f.create_dataset(
              "nodes_child_id",
              data=nodes_to_ids,
              compression="gzip",
              shuffle=True,
          )
          f.create_dataset(
              "nodes_child_logl",
              data=nodes_values,
              compression="gzip",
              shuffle=True,
          )
  
imports: import numpy
  from numpy import log, log1p, exp, logaddexp
  import math
  import sys
  from .utils import resample_equal
  from .ordertest import UniformOrderAccumulator
label_desc: Use image node_id 3 for calling a global function with example usage: dump_tree(filename, roots, pointpile) without return types