Example #1
0
def get_stats_json(filename):
    """Reads the stats json and outputs dictionary with
    all the necessary data
    """
    d = load_json(os.path.abspath(filename))
    data_container = {
        "sta_lon": np.array(d["sta_lon"]),
        "sta_lat": np.array(d["sta_lat"]),
        "nwindows": d["nwindows"],
        "nwin_on_trace": d["nwin_on_trace"]
    }
    cmtsource = CMTSource.from_dictionary(d["oldcmt"])
    new_cmtsource = CMTSource.from_dictionary(d["newcmt"])
    config = Struct(**d["config"])
    nregions = d["nregions"]
    bootstrap_mean = np.array(d["bootstrap_mean"])
    bootstrap_std = np.array(d["bootstrap_std"])
    var_reduction = d["var_reduction"]
    mode = d["mode"]
    G = d["G"]
    stats = d["stats"]

    return (data_container, cmtsource, new_cmtsource, config, nregions,
            bootstrap_mean, bootstrap_std, var_reduction, mode, G, stats)