code: def calculate(
      file_list: List[str],
      gt_file_list: List[str],
      args: argparse.Namespace,
      f0_rmse_dict: Dict[str, float],
  ):
      """Calculate log-F0 RMSE."""
      for i, gen_path in enumerate(file_list):
          corresponding_list = list(
              filter(
                  lambda gt_path: _get_basename(gt_path) in gen_path,
                  gt_file_list,
              )
          )
          assert len(corresponding_list) == 1
          gt_path = corresponding_list[0]
          gt_basename = _get_basename(gt_path)
  
          # load wav file as int16
          gen_x, gen_fs = sf.read(gen_path, dtype="int16")
          gt_x, gt_fs = sf.read(gt_path, dtype="int16")
  
          fs = gen_fs
          if gen_fs != gt_fs:
              gt_x = librosa.resample(
                  gt_x.astype(np.float), gt_fs, gen_fs
              )
  
          # extract ground truth and converted features
          gen_mcep, gen_f0 = world_extract(
              x=gen_x,
              fs=fs,
              f0min=args.f0min,
              f0max=args.f0max,
              n_fft=args.n_fft,
              n_shift=args.n_shift,
              mcep_dim=args.mcep_dim,
              mcep_alpha=args.mcep_alpha,
          )
          gt_mcep, gt_f0 = world_extract(
              x=gt_x,
              fs=fs,
              f0min=args.f0min,
              f0max=args.f0max,
              n_fft=args.n_fft,
              n_shift=args.n_shift,
              mcep_dim=args.mcep_dim,
              mcep_alpha=args.mcep_alpha,
          )
  
          # DTW
          _, path = fastdtw(
              gen_mcep, gt_mcep, dist=spatial.distance.euclidean
          )
          twf = np.array(path).T
          gen_f0_dtw = gen_f0[twf[0]]
          gt_f0_dtw = gt_f0[twf[1]]
  
          # Get voiced part
          nonzero_idxs = np.where((gen_f0_dtw != 0) & (gt_f0_dtw != 0))[
              0
          ]
          gen_f0_dtw_voiced = np.log(gen_f0_dtw[nonzero_idxs])
          gt_f0_dtw_voiced = np.log(gt_f0_dtw[nonzero_idxs])
  
          # log F0 RMSE
          log_f0_rmse = np.sqrt(
              np.mean((gen_f0_dtw_voiced - gt_f0_dtw_voiced) ** 2)
          )
          logging.info(f"{gt_basename} {log_f0_rmse:.4f}")
          f0_rmse_dict[gt_basename] = log_f0_rmse
  
file_path: espnet/egs2/ameboshi/svs1/pyscripts/utils/evaluate_f0.py
imports: import argparse
  import fnmatch
  import logging
  import multiprocessing
  import os
  from typing import Dict, List, Tuple
  import librosa
  import numpy
  import pysptk
  import pyworld
  import soundfile
  from fastdtw import fastdtw
  from scipy import spatial
label_desc: Use image node_id 5 for calling a global function with example usage: calculate(file_list, gt_file_list, args, f0_rmse_dict) without return types