Commit 83570627 authored by norvell's avatar norvell
Browse files

Add ODG analysis to create_histogram_summary.py, and improve newline handling in figures

parent 782844df
Loading
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ if __name__ == "__main__":
        "--measure",
        type=str,
        nargs=1,
        help="Measure, any of: MLD, DIFF, SSNR, default: MLD",
        help="Measure, any of: MLD, DIFF, SSNR, ODG, default: MLD",
        default=["MLD"],
    )
    parser.add_argument(
@@ -67,6 +67,7 @@ if __name__ == "__main__":
        "MLD": ("MLD", [0, 5, 10, math.inf]),
        "DIFF": ("MAXIMUM ABS DIFF", [0, 1024, 16384, 32769]),
        "SSNR": ("MIN_SSNR", [-math.inf, 0, 20, 40, 60, 100]),
        "ODG": ("MIN_ODG", [-5, -4, -3, -2, -1, 0]),
    }
    (measure_label, limits) = limits_per_measure[measure]

@@ -85,7 +86,7 @@ if __name__ == "__main__":
    # Output CSV file
    with open(csv_summary, "w") as fp:
        limits_labels = [
            f"{str(a)} --\n {str(b)}" for (a, b) in zip(limits[0:-1], limits[1:])
            f"{str(a)} -- {str(b)}" for (a, b) in zip(limits[0:-1], limits[1:])
        ] + ["None"]
        # Zero difference is treated as a special category for MLD and MAXIMUM ABS DIFF
        if measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF":
@@ -124,7 +125,8 @@ if __name__ == "__main__":
                fp.write(line)

                # Matplotlib histogram
                ax.bar(limits_labels, data, 0.5, label=cat, bottom=bottom)
                labels = [x if len(x) < 10 else x.replace('--','--\n') for x in limits_labels]
                ax.bar(labels, data, 0.5, label=cat, bottom=bottom)
                bottom += data

            # Histogram layout