def uncropped_data_and_metadata():
    full_data_file = os.path.join(TEST_DATA_DIR, "trimouse_eval.pickle")
    metadata_file = full_data_file.replace("eval", "meta")
    with open(full_data_file, "rb") as file:
        data = pickle.load(file)
    with open(metadata_file, "rb") as file:
        metadata = pickle.load(file)
    params = crossvalutils._set_up_evaluation(data)
    data_unc, _ = crossvalutils._rebuild_uncropped_data(data, params)
    meta_unc = crossvalutils._rebuild_uncropped_metadata(metadata, params["imnames"])
    return data_unc, meta_unc
def test_get_n_best_paf_graphs(evaluation_data_and_metadata):
    data, metadata = evaluation_data_and_metadata
    params = crossvalutils._set_up_evaluation(data)
    n_graphs = 5
    paf_inds, dict_ = crossvalutils._get_n_best_paf_graphs(data,
                                                           metadata,
                                                           params["paf_graph"],
                                                           n_graphs=n_graphs)
    assert len(paf_inds) == n_graphs
    assert len(dict_) == len(params["paf_graph"])
    assert len(paf_inds[0]) == 11
    assert paf_inds[0] == BEST_GRAPH
    assert len(paf_inds[-1]) == len(params["paf_graph"])
Example #3
0
def test_get_n_best_paf_graphs_montblanc(
        evaluation_data_and_metadata_montblanc):
    data, metadata = evaluation_data_and_metadata_montblanc
    params = crossvalutils._set_up_evaluation(data)
    paf_inds, dict_ = crossvalutils._get_n_best_paf_graphs(
        data,
        metadata,
        params["paf_graph"],
    )
    assert len(paf_inds) == 4
    assert len(dict_) == len(params["paf_graph"])
    assert [len(inds) for inds in paf_inds] == list(range(3, 7))
    assert paf_inds[-1] == BEST_GRAPH_MONTBLANC
    assert len(paf_inds[-1]) == len(params["paf_graph"])