code: def spectral_entropy(signal, n_short_blocks=10):
      """Computes the spectral entropy"""
      # number of frame samples
      num_frames = len(signal)
  
      # total spectral energy
      total_energy = np.sum(signal**2)
  
      # length of sub-frame
      sub_win_len = int(np.floor(num_frames / n_short_blocks))
      if num_frames != sub_win_len * n_short_blocks:
          signal = signal[0 : sub_win_len * n_short_blocks]
  
      # define sub-frames (using matrix reshape)
      sub_wins = signal.reshape(
          sub_win_len, n_short_blocks, order="F"
      ).copy()
  
      # compute spectral sub-energies
      s = np.sum(sub_wins**2, axis=0) / (total_energy + eps)
  
      # compute spectral entropy
      entropy = -np.sum(s * np.log2(s + eps))
  
      return entropy
  
imports: from __future__ import print_function
  import math
  import numpy
  import sys
  from scipy.fftpack import fft
  import matplotlib.pyplot
  from scipy.signal import lfilter
  from scipy.fftpack.realtransforms import dct
  from tqdm import tqdm
label_desc: Use image node_id 6 for calling a global function with example usage: spectral_entropy(signal, n_short_blocks) and returns: entropy