code: def plot_filtergraph(
      filters: torch.Tensor,
      sample_rate: int,
      img_path: str,
      sorted: bool = True,
      logscale: bool = False,
      scale: str = "mel",
  ):
      """Plot the Sinc filter bandpass frequencies.
  
      Args:
          filters: Filter parameters.
          sample_rate: Sample rate of signal.
          img_path: Output plot file.
          sorted: Sort bandpasses by center frequency.
          logscale: Set Y axis to logarithmic scale.
      """
      if scale == "mel":
          from espnet2.layers.sinc_conv import MelScale
  
          f = MelScale.bank(128, sample_rate).detach().cpu().numpy()
      elif scale == "bark":
          from espnet2.layers.sinc_conv import BarkScale
  
          f = BarkScale.bank(128, sample_rate).detach().cpu().numpy()
      else:
          raise NotImplementedError
  
      f = f / sample_rate
      f1, f2 = f[:, 0], f[:, 1]
      f_mins, f_maxs, f_mids = convert_parameter_to_frequencies(
          filters[:, 0], filters[:, 1], sample_rate, sorted
      )
      mel_mins, mel_maxs, mel_mids = convert_parameter_to_frequencies(
          f1, f2, sample_rate, sorted
      )
  
      x = np.arange(len(f_mids))
      plt.clf()
      if logscale:
          plt.yscale("log")
      plt.xlabel("filter index")
      plt.ylabel("f [Hz]")
      ax = plt.gca()
      ax.plot(x, mel_mins, color="blue", label="mel filters")
      ax.plot(x, mel_maxs, color="blue")
      ax.plot(x, mel_mids, "--", color="darkblue")
      ax.fill_between(x, mel_mins, mel_maxs, color="blue", alpha=0.3)
      ax.plot(x, f_mins, color="green", label="learned filters")
      ax.plot(x, f_maxs, color="green")
      ax.plot(x, f_mids, "--", color="darkgreen")
      ax.fill_between(x, f_mins, f_maxs, color="green", alpha=0.3)
      ax.legend(loc="upper left", prop={"size": 15})
      plt.savefig(img_path, bbox_inches="tight")
      print("Plotted %s" % img_path)
  
file_path: espnet/egs2/l3das22/enh1/pyscripts/utils/plot_sinc_filters.py
imports: import argparse
  import sys
  from pathlib import Path
  import matplotlib.pyplot
  import numpy
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: plot_filtergraph(filters, sample_rate, img_path, sorted, logscale, scale) without return types