code: def linBspline(knots):
      """Create linear B spline that is zero outside [knots[0], knots[-1]]
  
      (knots is assumed to be sorted).
      """
      fns = []
      knots = np.array(knots)
      for i in range(knots.shape[0] - 2):
          name = f"bs_{i}"
          k1, k2, k3 = knots[i : i + 3]
          d1 = k2 - k1
  
          def anon(x, k1=k1, k2=k2, k3=k3):
              return (x - k1) / d1 * np.greater(x, k1) * np.less_equal(
                  x, k2
              ) + (k3 - x) / d1 * np.greater(x, k2) * np.less(x, k3)
  
          fns.append(implemented_function(name, anon))
      return fns
  
imports: import numpy
  from sympy.utilities.lambdify import implemented_function
  from nipy.algorithms.statistics.api import Formula
  from nipy.modalities.fmri import utils
label_desc: Use image node_id 1 for calling a global function with example usage: linBspline(knots) and returns: fns, unknown