code: def main(argv):
      """Load the model, generate kernel and bandpass plots."""
      parser = get_parser()
      args = parser.parse_args(argv)
      model_path = args.model_path
      sample_rate = args.sample_rate
  
      model = torch.load(model_path, map_location="cpu")
      if "model" in model:  # snapshots vs. model.acc.best
          model = model["model"]
      if args.filter_key not in model:
          raise ValueError(
              f"The loaded model file does not contain the learned"
              f" filters in {args.filter_key}"
          )
      filters = model[args.filter_key]
      if not filters.type() == "torch.FloatTensor":
          raise TypeError(
              "The loaded filter values are not of type torch.FloatTensor"
          )
      filters = filters.detach().cpu().numpy()
      f_mins = np.abs(filters[:, 0])
      f_maxs = np.abs(filters[:, 0]) + np.abs(
          filters[:, 1] - filters[:, 0]
      )
      F_mins, F_maxs = f_mins * sample_rate, f_maxs * sample_rate
      F_mins, F_maxs = (
          np.round(F_mins).astype(np.int64),
          np.round(F_maxs).astype(np.int64),
      )
  
      # Create output folder if it does not yet exist
      args.out_folder.mkdir(parents=True, exist_ok=True)
  
      plot_filter_kernels(filters, sample_rate, args)
  
      plot_filters(
          range(len(F_mins)),
          "filters.%s" % args.filetype,
          F_mins,
          F_maxs,
          args.out_folder,
      )
      plot_filters(
          np.argsort(F_maxs - F_mins),
          "filters_len_sort.%s" % args.filetype,
          F_mins,
          F_maxs,
          args.out_folder,
      )
      plot_filters(
          np.argsort(F_mins),
          "filters_min_sort.%s" % args.filetype,
          F_mins,
          F_maxs,
          args.out_folder,
      )
  
      img_path = str(args.out_folder / f"filtergraph.{args.filetype}")
      plot_filtergraph(
          filters,
          sample_rate=sample_rate,
          img_path=img_path,
          scale=args.scale,
      )
      img_path = str(
          args.out_folder / f"filtergraph_unsorted.{args.filetype}"
      )
      plot_filtergraph(
          filters,
          sample_rate=sample_rate,
          img_path=img_path,
          sorted=False,
          scale=args.scale,
      )
  
file_path: espnet/egs2/reazonspeech/asr1/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 6 for calling a global function with example usage: main(argv) without return types