code: def iterate_experiments(
      func,
      env_ids,
      snapshot_config=None,
      seeds=None,
      xcolumn="TotalEnvSteps",
      xlabel="Total Environment Steps",
      ycolumn="Evaluation/AverageReturn",
      ylabel="Average Return",
  ):
      """Iterate experiments for benchmarking over env_ids and seeds.
  
      Args:
          env_ids (list[str]): List of environment ids.
          snapshot_config (garage.experiment.SnapshotConfig): The experiment
              configuration used by :class:`~Trainer` to create the
              :class:`~Snapshotter`.
          seeds (list[int]): List of seeds.
          func (func): The experiment function.
          xcolumn (str): Which column should be the JSON x axis.
          xlabel (str): Label name for x axis.
          ycolumn (str): Which column should be the JSON y axis.
          ylabel (str): Label name for y axis.
  
      """
      func_name = func.__name__.replace("_", "-")
  
      if seeds is None:
          seeds = random.sample(range(100), 4)
  
      for env_id in env_ids:
          task_ys = []
  
          if _plot is not None and env_id not in _plot:
              _plot[env_id] = {"xlabel": xlabel, "ylabel": ylabel}
  
          for seed in seeds:
              exp_name = func_name + "_" + env_id + "_" + str(seed)
              sub_log_dir = os.path.join(_log_dir, exp_name)
  
              tf.compat.v1.reset_default_graph()
  
              ctxt = dict(log_dir=sub_log_dir)
              if snapshot_config:
                  ctxt.update(snapshot_config)
              func(ctxt, env_id=env_id, seed=seed)
  
              if _plot is not None or _auto:
                  xs, ys = _read_csv(sub_log_dir, xcolumn, ycolumn)
                  task_ys.append(ys)
  
          if _plot is not None or _auto:
              ys_mean = np.array(task_ys).mean(axis=0)
              ys_std = np.array(task_ys).std(axis=0)
  
              if _plot is not None:
                  plt.figure(env_id)
  
                  plt.plot(xs, ys_mean, label=func_name)
                  plt.fill_between(
                      xs,
                      (ys_mean - ys_std),
                      (ys_mean + ys_std),
                      alpha=0.1,
                  )
              if _auto:
                  _export_to_json(
                      env_id + "_" + func_name,
                      xs,
                      xlabel,
                      ys_mean,
                      ylabel,
                      ys_std,
                  )
  
file_path: garage/benchmarks/src/garage_benchmarks/helper.py
imports: import csv
  import functools
  import json
  import os
  import pathlib
  import random
  import subprocess
  from google.cloud import storage
  import matplotlib.pyplot
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: iterate_experiments(func, env_ids, snapshot_config, seeds, xcolumn, xlabel, ycolumn, ylabel) without return types