예제 #1
0
    def test_text_table(self):
        text = printer.text_table(self.data, self.dim_rows, self.dim_cols,
                                  lambda ds: sum([d["x"] for d in ds]))
        self.assertEqual(
            "\tc0\tc1\tc2\n" + "r0\t6\t15\t24\n" + "r1\t36\t45\t54\n", text)

        text = printer.text_table(self.data, self.dim_cols, self.dim_rows,
                                  lambda ds: sum([d["x"] for d in ds]))
        self.assertEqual(
            "\tr0\tr1\n" + "c0\t6\t36\n" + "c1\t15\t45\n" + "c2\t24\t54\n",
            text)
예제 #2
0
def create_single_table_bundle(props, dim_rows, dim_cols, cellLambda, headerRowNames, cv0, cv1, cv2, vb=1,
                               tableVariants=None, onlyNonemptyRows=True, tablePostprocessor=post,
                               printTextTable=False, middle_col_align="c"):
    if tableVariants is None:
        tableVariants = [p_true]
    assert isinstance(tableVariants, list)

    text = ""
    for variant in tableVariants:  # each variant is some predicate on data
        props_variant = [p for p in props if variant(p)]
        if onlyNonemptyRows:
            dim_rows_variant = Dim([c for c in dim_rows.configs if len(c.filter_props(props_variant)) > 0])
        else:
            dim_rows_variant = dim_rows

        tableText = tablePostprocessor(
            printer.latex_table(props_variant, dim_rows_variant, dim_cols, cellLambda, layered_headline=True,
                                vertical_border=vb, headerRowNames=headerRowNames, middle_col_align=middle_col_align))

        if printTextTable:
            print("VARIANT: " + str(variant))
            print(printer.text_table(props, dim_rows_variant, dim_cols, cellLambda, d_cols=";"))

        text += r"\noindent"
        text += printer.table_color_map(tableText, cv0, cv1, cv2, "colorLow", "colorMedium", "colorHigh")
        # text += "\n"

    return text
예제 #3
0
 def test_text_table_multichar_seps(self):
     text = printer.text_table(self.data,
                               self.dim_rows,
                               self.dim_cols,
                               lambda ds: sum([d["x"] for d in ds]),
                               d_cols=" && ",
                               d_rows=";\n")
     self.assertEqual(
         " && c0 && c1 && c2;\n" + "r0 && 6 && 15 && 24;\n" +
         "r1 && 36 && 45 && 54;\n", text)
예제 #4
0
def create_subsection_shared_stats(props, dim_rows, dim_cols, numRuns):
    vb = 1  # vertical border

    print("STATUS")
    text = post(
        printer.latex_table(props,
                            dim_rows,
                            dim_cols,
                            get_num_computed,
                            layered_headline=True,
                            vertical_border=vb))
    latex_status = printer.table_color_map(text, 0.0, numRuns / 2, numRuns,
                                           "colorLow", "colorMedium",
                                           "colorHigh")

    print("SUCCESS RATES")
    print(
        printer.text_table(props,
                           dim_rows,
                           dim_cols,
                           fun_successRate,
                           d_cols=";"))
    text = post(
        printer.latex_table(props,
                            dim_rows,
                            dim_cols,
                            fun_successRate,
                            layered_headline=True,
                            vertical_border=vb))
    latex_successRates = printer.table_color_map(text, 0.0, 0.5, 1.0,
                                                 "colorLow", "colorMedium",
                                                 "colorHigh")

    print("FINAL PROPERTIES")
    print(
        printer.text_table(props,
                           dim_rows,
                           dim_cols,
                           fun_propertiesMet,
                           d_cols=";"))
    text = post(
        printer.latex_table(props,
                            dim_rows,
                            dim_cols,
                            fun_propertiesMet,
                            layered_headline=True,
                            vertical_border=vb))
    latex_propertiesMet = printer.table_color_map(text, 0.0, 0.5, 1.0,
                                                  "colorLow", "colorMedium",
                                                  "colorHigh")

    print("AVG RUNTIME")
    text = post(
        printer.latex_table(props,
                            dim_rows,
                            dim_cols,
                            get_avg_runtime,
                            layered_headline=True,
                            vertical_border=vb))
    latex_avgRuntime = printer.table_color_map(text, 0.0, 1800.0, 3600.0,
                                               "colorLow", "colorMedium",
                                               "colorHigh")

    print("AVG RUNTIME (SUCCESSFUL)")
    text = post(
        printer.latex_table(props,
                            dim_rows,
                            dim_cols,
                            get_avg_runtimeOnlySuccessful,
                            layered_headline=True,
                            vertical_border=vb))
    latex_avgRuntimeOnlySuccessful = printer.table_color_map(
        text, 0.0, 1800.0, 3600.0, "colorLow", "colorMedium", "colorHigh")

    # print("SUCCESS RATES (FULL INFO)")
    # text = post(printer.latex_table(props, dim_rows, dim_cols, fun_successRates_full, layered_headline=True, vertical_border=vb))

    # print("AVG SIZES")
    # text = post(printer.latex_table(props, dim_rows, dim_cols, get_stats_size, layered_headline=True, vertical_border=vb))
    # latex_sizes = printer.table_color_map(text, 0.0, 100.0, 200.0, "colorLow", "colorMedium", "colorHigh")

    print("AVG SIZES (SUCCESSFUL)")
    text = post(
        printer.latex_table(props,
                            dim_rows,
                            dim_cols,
                            get_stats_sizeOnlySuccessful,
                            layered_headline=True,
                            vertical_border=vb))
    latex_sizesOnlySuccessful = printer.table_color_map(
        text, 0.0, 100.0, 200.0, "colorLow", "colorMedium", "colorHigh")

    subsects_main = [
        ("Status (correctly finished runs)", latex_status,
         reversed(reporting.color_scheme_red)),
        ("Success rates (mse below thresh (1.0e-25) + properties met)",
         latex_successRates, reporting.color_scheme_green),
        ("Success rates (properties met)", latex_propertiesMet,
         reporting.color_scheme_green),
        ("Average runtime [s]", latex_avgRuntime,
         reporting.color_scheme_violet),
        ("Average runtime (only successful) [s]",
         latex_avgRuntimeOnlySuccessful, reporting.color_scheme_violet),
        # ("Average sizes of best of runs (number of nodes)", latex_sizes, reporting.color_scheme_yellow),
        ("Average sizes of best of runs (number of nodes) (only successful)",
         latex_sizesOnlySuccessful, reporting.color_scheme_yellow),
    ]
    return reporting.Subsection("Shared Statistics",
                                get_content_of_subsections(subsects_main))