code: def parse_noise_list(
      noise_set_para_array, smoothing_weight, sampling_rate=None
  ):
      """This function creates the point-source noise list
      and the isotropic noise dictionary from the noise information file
      The isotropic noise dictionary is indexed by the room
      and its value is the corrresponding isotropic noise list
      Each noise object in the list contains the following attributes:
      noise_id, noise_type, bg_fg_type, room_linkage, probability, noise_rspecifier
      Please refer to the help messages in the parser for the meaning of these attributes
      """
      noise_parser = argparse.ArgumentParser()
      noise_parser.add_argument(
          "--noise-id", type=str, required=True, help="noise id"
      )
      noise_parser.add_argument(
          "--noise-type",
          type=str,
          required=True,
          help="the type of noise; i.e. isotropic or point-source",
          choices=["isotropic", "point-source"],
      )
      noise_parser.add_argument(
          "--bg-fg-type",
          type=str,
          default="background",
          help="background or foreground noise, for background noises, "
          "they will be extended before addition to cover the whole speech; for foreground noise, they will be kept "
          "to their original duration and added at a random point of the speech.",
          choices=["background", "foreground"],
      )
      noise_parser.add_argument(
          "--room-linkage",
          type=str,
          default=None,
          help="required if isotropic, should not be specified if point-source.",
      )
      noise_parser.add_argument(
          "--probability",
          type=float,
          default=None,
          help="probability of the noise.",
      )
      noise_parser.add_argument(
          "noise_rspecifier",
          type=str,
          help="""noise rspecifier, it can be either a filename or a piped command.
                                E.g. type5_noise_cirline_ofc_ambient1.wav or "sox type5_noise_cirline_ofc_ambient1.wav -t wav - |" """,
      )
  
      set_list = parse_set_parameter_strings(noise_set_para_array)
  
      pointsource_noise_list = []
      iso_noise_dict = {}
      for noise_set in set_list:
          current_noise_list = [
              noise_parser.parse_args(shlex.split(x.strip()))
              for x in open(noise_set.filename)
          ]
          current_pointsource_noise_list = []
          for noise in current_noise_list:
              if sampling_rate is not None:
                  # check if the rspecifier is a pipe or not
                  if len(noise.noise_rspecifier.split()) == 1:
                      noise.noise_rspecifier = (
                          "sox {0} -r {1} -t wav - |".format(
                              noise.noise_rspecifier, sampling_rate
                          )
                      )
                  else:
                      noise.noise_rspecifier = (
                          "{0} sox -t wav - -r {1} -t wav - |".format(
                              noise.noise_rspecifier, sampling_rate
                          )
                      )
  
              if noise.noise_type == "isotropic":
                  if noise.room_linkage is None:
                      raise Exception(
                          "--room-linkage must be specified if --noise-type is isotropic"
                      )
                  else:
                      if noise.room_linkage not in iso_noise_dict:
                          iso_noise_dict[noise.room_linkage] = []
                      iso_noise_dict[noise.room_linkage].append(noise)
              else:
                  current_pointsource_noise_list.append(noise)
  
          pointsource_noise_list += smooth_probability_distribution(
              current_pointsource_noise_list,
              smoothing_weight,
              noise_set.probability,
          )
  
      # ensure the point-source noise probabilities sum to 1
      pointsource_noise_list = smooth_probability_distribution(
          pointsource_noise_list, smoothing_weight, 1.0
      )
      if len(pointsource_noise_list) > 0:
          assert almost_equal(
              sum(
                  noise.probability for noise in pointsource_noise_list
              ),
              1.0,
          )
  
      # ensure the isotropic noise source probabilities for a given room sum to 1
      for key in iso_noise_dict.keys():
          iso_noise_dict[key] = smooth_probability_distribution(
              iso_noise_dict[key]
          )
          assert almost_equal(
              sum(noise.probability for noise in iso_noise_dict[key]),
              1.0,
          )
  
      return (pointsource_noise_list, iso_noise_dict)
  
imports: import argparse, shlex, glob, math, os, random, sys, warnings, copy, imp, ast
label_desc: Use image node_id 18 for calling a global function with example usage: parse_noise_list(noise_set_para_array, smoothing_weight, sampling_rate) and returns: pointsource_noise_list,  iso_noise_dict