def load(cls, config_file):
""" Load experiment parameters from a YAML configuration file
Parameters
----------
config_file: string
path to a YAML configuration file
Returns
-------
dictionary (or list of dictionaries) of parameters to pass to a behavior
"""
try:
import yaml
except ImportError:
raise ImportError("Pyyaml is required to use a .yaml configuration file")
parameters = list()
with open(config_file, "rb") as config:
for val in yaml.load_all(config):
parameters.append(val)
if len(parameters) == 1:
parameters = parameters[0]
return parameters
评论列表
文章目录