code: def tv_l1_from_gradient(spatial_grad):
      """Compute energy contribution due to penalized gradient, in TV-L1 model.
  
      Parameters
      ----------
      spatial_grad : ndarray, shape (4, nx, ny, nx)
         precomputed "gradient + id" array
  
      Returns
      -------
      out : float
          Energy contribution due to penalized gradient.
      """
      tv_term = np.sum(
          np.sqrt(np.sum(spatial_grad[:-1] * spatial_grad[:-1], axis=0))
      )
      l1_term = np.abs(spatial_grad[-1]).sum()
      return l1_term + tv_term
  
file_path: nilearn/nilearn/decoding/_objective_functions.py
imports: from functools import partial
  import numpy
  from scipy import linalg
label_desc: Use image node_id 4 for calling a global function with example usage: tv_l1_from_gradient(spatial_grad) and returns: unknown