code: def test_spectral_bandwidth(infile):
      DATA = load(infile)
  
      y, sr = librosa.load(
          os.path.join("tests", DATA["wavfile"][0]), sr=None, mono=True
      )
  
      n_fft = DATA["nfft"][0, 0].astype(int)
      hop_length = DATA["hop_length"][0, 0].astype(int)
  
      S = DATA["S"]
  
      # normalization is disabled here, since the precomputed S is already
      # normalized
      # metlab uses p=1, other folks use p=2
      bw = librosa.feature.spectral_bandwidth(
          S=S,
          sr=sr,
          n_fft=n_fft,
          hop_length=hop_length,
          centroid=DATA["centroid"],
          norm=False,
          p=1,
      )
  
      # METlab implementation takes the mean, not the sum
      assert np.allclose(bw, S.shape[0] * DATA["bw"])
  
file_path: librosa/tests/test_met_features.py
imports: import os
  import pytest
  import numpy
  import scipy.io
  import scipy.signal
  from test_core import load, files
  import librosa
label_desc: Use image node_id 5 for calling a global function with example usage: test_spectral_bandwidth(infile) without return types