code: def unitcube_line_intersection(ray_origin, ray_direction):
      r"""Compute intersection of a line (ray) and a unit box (0:1 in all axes).
  
      Based on
      http://www.iquilezles.org/www/articles/intersectors/intersectors.htm
  
      Parameters
      -----------
      ray_origin: array of vectors
          starting point of line
      ray_direction: vector
          line direction vector
  
      Returns
      --------
      tleft: array
          negative intersection point distance from ray\_origin in units in ray\_direction
      tright: array
          positive intersection point distance from ray\_origin in units in ray\_direction
  
      """
      # make sure ray starts inside the box
      assert (ray_origin >= 0).all(), ray_origin
      assert (ray_origin <= 1).all(), ray_origin
      assert (
          (ray_direction**2).sum() ** 0.5 > 1e-200
      ).all(), ray_direction
  
      # step size
      with np.errstate(divide="ignore", invalid="ignore"):
          m = 1.0 / ray_direction
          n = m * (ray_origin - 0.5)
          k = np.abs(m) * 0.5
          # line coordinates of intersection
          # find first intersecting coordinate
          t1 = -n - k
          t2 = -n + k
          return np.nanmax(t1, axis=1), np.nanmin(t2, axis=1)
  
imports: import numpy
  from ultranest.utils import submasks
  from ultranest.stepfuncs import evolve, step_back
  from ultranest.stepfuncs import generate_cube_oriented_direction, generate_cube_oriented_direction_scaled
  from ultranest.stepfuncs import generate_random_direction, generate_region_oriented_direction, generate_region_random_direction
  from ultranest.stepfuncs import generate_differential_direction, generate_mixture_random_direction
  import scipy.stats
label_desc: Use image node_id 1 for calling a global function with example usage: unitcube_line_intersection(ray_origin, ray_direction) and returns: np,  np