Example #1
0
def retrieve_experiment(experiment_name):
    if experiment_name.endswith('.yml') or experiment_name.endswith('.yaml'):
        # user is giving a path to an experiment file
        try:
            config = load_yaml(experiment_name)
        except IOError:
            raise ValueError("Requested experiment configuration at path '{}' "
                             "does not exist".format(experiment_name))
    else:
        # predefined experiment
        try:
            config = load_yaml(predefined_experiment_path(experiment_name))
        except IOError:
            raise ValueError("Requested predefined experiment configuration "
                             "'{}' does not exist".format(experiment_name))
    return Experiment(config)
Example #2
0
def retrieve_experiment(experiment_name):
    if experiment_name.endswith('.yml') or experiment_name.endswith('.yaml'):
        # user is giving a path to an experiment file
        try:
            config = load_yaml(experiment_name)
        except IOError:
            raise ValueError("Requested experiment configuration at path '{}' "
                             "does not exist".format(experiment_name))
    else:
        # predefined experiment
        try:
            config = load_yaml(predefined_experiment_path(experiment_name))
        except IOError:
            raise ValueError("Requested predefined experiment configuration "
                             "'{}' does not exist".format(experiment_name))
    return Experiment(config)
Example #3
0
def save_custom_config(c, validate_schema=True):
    from menpobench.utils import save_yaml, load_yaml
    if custom_config_path().exists():
        # Update existing config file with new information
        config = load_yaml(custom_config_path())
        config.update(c)
    else:
        config = c
    if validate_schema:
        # validate the config against the schema
        s = config_schema()
        if not schema_is_valid(s, config):
            report = schema_error_report(s, config)
            raise SchemaError('configuration', 'user', report)
    save_yaml(config, custom_config_path())
Example #4
0
def validate_predefined_experiment(name):
    config = load_yaml(predefined_experiment_path(name))
    validate_experiment_def(config)
Example #5
0
def load_config():
    return load_yaml(resolve_config_path())
Example #6
0
def validate_predefined_experiment(name):
    config = load_yaml(predefined_experiment_path(name))
    validate_experiment_def(config)