code: def calc_centroid(signal, fs):
      """Computes the centroid along the time axis.
  
      Feature computational cost: 1
  
      Parameters
      ----------
      signal : nd-array
          Input from which centroid is computed
      fs: int
          Signal sampling frequency
  
      Returns
      -------
      float
          Temporal centroid
  
      """
  
      time = compute_time(signal, fs)
  
      energy = np.array(signal) ** 2
  
      t_energy = np.dot(np.array(time), np.array(energy))
      energy_sum = np.sum(energy)
  
      if energy_sum == 0 or t_energy == 0:
          centroid = 0
      else:
          centroid = t_energy / energy_sum
  
      return centroid
  
imports: import scipy.signal
  from tsfel.feature_extraction.features_utils import *
label_desc: Use image node_id 2 for calling a global function with example usage: calc_centroid(signal, fs) and returns: centroid