Commit 08d8466a authored by Jan Kiene's avatar Jan Kiene
Browse files

small refactoring + change to layout

parent 87691838
Loading
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ from create_report_pages import SUBPAGE_TMPL_CSS, FORMATS

TITLE_4_MEASURE = {
    "MLD": "Maximum MLD across channels",
    "MAX_ABS_DIFF": "Maximim absolute difference across channels",
    "MAX_ABS_DIFF": "Maximum absolute difference across channels",
    "MIN_SSNR": "Minimum SSNR across channels",
    "MIN_ODG": "Minimum PEAQ ODG across channels",
    "DELTA_ODG": "PEAQ ODG using binauralized input and output",
@@ -16,9 +16,13 @@ SUMMARY_PAGE_TMPL_HTML = """

<h1>Summary for job {job_name}, ID: {id_current}</h1>

<hr>

{images}

"""
IMAGE_HTML_TMPL = "<img src={image_dir}/histogram_{measure}_{format}.png>"
SUBHEADING_HTML_TMP = "<h2>{subtitle}</h2>\n"


def create_summary_page(
@@ -28,16 +32,18 @@ def create_summary_page(
    measures: List[str],
    image_dir: str,
):
    html = "<hr>"
    for m in measures:
        image_filename_tmpl = "histogram_{measure}_{format}.png"
        image_html = " ".join(
    html = "\n<hr>\n".join(
        [
            SUBHEADING_HTML_TMP.format(subtitle=TITLE_4_MEASURE[m])
            + " ".join(
                [
                f"<img src={image_dir}/{image_filename_tmpl.format(measure=m, format=f)}>"
                    IMAGE_HTML_TMPL.format(measure=m, format=f, image_dir=image_dir)
                    for f in FORMATS
                ]
            )
        html += f"<h2>{TITLE_4_MEASURE[m]}</h2>\n" + image_html
            for m in measures
        ]
    )

    new_summary_page = SUBPAGE_TMPL_CSS + SUMMARY_PAGE_TMPL_HTML.format(
        id_current=id_current,