Example #1
0
def read_yaml_config(yaml_config: Openable, fill_fields: bool = True) -> dict:
    """
    Reads a model test configuration file (YAML).

    :param yaml_config:
        path or file-like object in the YAML format.

    :returns:
        Model test configuration from the YAML made into a dictionary.
    """
    cfg = deepcopy(cfg_defaults)

    logger.info("reading YAML configuration")
    with open(yaml_config) as config_file:
        cfg = deep_update(cfg, yaml.safe_load(config_file))

    return cfg
        "seis_catalog": {
            "seis_catalog_file": DATA_FILE,
            "columns": {
                "event_id": "event_id"
            },
        },
        "rupture_file": {
            "rupture_file_path": None,
            "read_rupture_file": False,
            "save_rupture_file": False
        }
    },
}

cfg = deepcopy(cfg_defaults)
cfg = deep_update(cfg, test_cfg)

bin_gdf, obs_seis_catalog = load_inputs(cfg)


class test_relm_test_functions(unittest.TestCase):
    def setUp(self):
        self.cfg = cfg
        self.bin_gdf = bin_gdf
        self.obs_seis_catalog = obs_seis_catalog

    def test_s_test_bin(self):
        S_test_cfg = self.cfg["config"]["model_framework"]["relm"]["S_test"]

        sb = self.bin_gdf.loc["836860fffffffff"].SpacemagBin