Commit e69f9945 authored by Jan Kiene's avatar Jan Kiene
Browse files

add consistent color assignment

this helps keep split and whole page in synch wrt colors, even if a
format/category/mode is omitted in one of them (e.g. JBM in split)
parent 119ef098
Loading
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
import argparse
import math
import pathlib
import sys
import pandas as pd
import numpy as np
from typing import List
@@ -25,6 +26,19 @@ BINS_FOR_MEASURES = {

DEFAULT_MEASURES = ["MAX_ABS_DIFF", "MLD", "MIN_SSNR", "MIN_ODG"]

HERE = pathlib.Path(__file__).parent
ROOT_DIR = HERE.parent
sys.path.append(str(ROOT_DIR))
from tests.constants import CAT_NORMAL, CAT_BITRATE_SWITCHING, CAT_DTX, CAT_JBM, CAT_PLC

COLORS_FOR_CATEGORIES = {
    CAT_DTX: "tab:blue",
    CAT_PLC: "tab:orange",
    CAT_NORMAL: "tab:green",
    CAT_JBM: "tab:red",
    CAT_BITRATE_SWITCHING: "tab:purple",
}


def get_bins_for_diff(data: pd.Series):
    return np.linspace(data.min(), data.max(), num=10)
@@ -76,6 +90,7 @@ def create_histograms(
                    linewidth=0.5,
                    label=cat,
                    bottom=bottom,
                    color=COLORS_FOR_CATEGORIES[cat],
                )
                bottom += data