Esempio n. 1
0
def test_add_bad_reason():
    runs = load_tracker_runs()
    tkdqm_runs = load_tkdqmdoctor_runs()
    runs = merge_runreg_tkdqmdoc(runs, tkdqm_runs)

    runs = runs.pipe(filter_collisions)

    print(runs.columns)

    runs = runs.pipe(add_bad_reason)

    runs = runs.loc[runs["tracking"] == "BAD", [
        "run_number",
        "bad_reason",
        "pixel_comment",
        "strip_comment",
        "tracking_comment",
        "comment",
    ], ]

    setup_pandas_display(max_rows=200)

    runs = runs.loc[~runs.bad_reason.isnull(), :]
    pandas.set_option("display.max_colwidth", -1)
    print(runs)
Esempio n. 2
0
def test_plot_reference_distribution():
    tracker_runs = load_tracker_runs()

    tkdqmdoctor_runs = load_tkdqmdoctor_runs()
    runs = merge_runreg_tkdqmdoc(tracker_runs, tkdqmdoctor_runs)

    runs = (runs.pipe(add_is_bad).pipe(exclude_online).pipe(
        exclude_rereco).pipe(add_is_commissioning).pipe(add_is_special).pipe(
            exclude_commissioning).pipe(exclude_special))

    plot_reference_distribution(runs, show=SHOW_PLOTS)
Esempio n. 3
0
def test_merge_runreg_tkdqmdoctor_runs():
    tracker_runs = load_tracker_runs()
    tkdqm = load_tkdqmdoctor_runs()

    tracker_size = len(tracker_runs)
    tracker_column_count = len(list(tracker_runs))

    assert 36 == tracker_column_count

    merged = merge_runreg_tkdqmdoc(tracker_runs, tkdqm)
    merged_column_count = len(list(merged))

    assert len(tracker_runs) == tracker_size, "No Change in Line count"
    assert tracker_column_count + 6 == merged_column_count, "Increased Column count"
Esempio n. 4
0
def test_add_reference_cost():
    tracker_runs = load_tracker_runs()
    tkdqmdoc_runs = load_tkdqmdoctor_runs()

    runs = merge_runreg_tkdqmdoc(tracker_runs, tkdqmdoc_runs)

    assert "reference_cost" not in runs
    add_reference_cost(runs)
    assert "reference_cost" in runs

    runs.set_index(["run_number", "reco"], inplace=True)

    assert math.isclose(runs.loc[(315322, "prompt"), "reference_cost"],
                        0.130825,
                        abs_tol=0.01)
Esempio n. 5
0
def test_reference_cost():
    run_number = 315322
    ref_run_number = 315705
    expected_cost = 0.130825

    tracker_runs = load_tracker_runs()
    tkdqmdoctor_runs = load_tkdqmdoctor_runs()
    runs = merge_runreg_tkdqmdoc(tracker_runs, tkdqmdoctor_runs)

    runs.set_index(["run_number", "reco"], inplace=True)

    assert runs.loc[(run_number, "prompt"),
                    "reference_run_number"] == ref_run_number

    matrix = extract_tracking_map_content(
        load_tracking_map(run_number, "prompt"))
    ref_matrix = extract_tracking_map_content(
        load_tracking_map(ref_run_number, "prompt"))

    assert math.isclose(reference_cost(matrix, ref_matrix),
                        expected_cost,
                        abs_tol=0.01)
 def test_load_tkdqmdoctor_runs(self):
     runs = load_tkdqmdoctor_runs()
     assert len(runs) >= 3000
     assert len(runs) <= 4000