Forgot to update tweaks to chart.py (namely not doubling up on marker counts when used multiple times in a run)

This commit is contained in:
mrq 2025-01-12 20:26:41 +00:00
parent 97d59d9a34
commit d7e79d078f

View File

@ -16,14 +16,14 @@ import matplotlib.pyplot as Plot
import matplotlib.patches as patches
# consts
TITLE = "SGDQ 2024"
TITLE = "AGDQ 2025"
USE_LEGEND = True # display the legend with markers
TITLE_OFFSET = 0 # 2.5 # to-do: dynamically set this to how many columns are set with legend
# les constant consts
AUX_MODE = None # total | markers | None
SORT_BY = None # sort runs by the values
CUTOFF_SECONDS = 0
CUTOFF_SECONDS = 0 # 60 * 5
MODE = "scatter"
# more constant consts
@ -35,7 +35,7 @@ OUT_FILE_TIMESTAMP = f'./images/{TIMESTAMP}.png'
OUT_FILE = f'./images/ratings[{SORT_BY or AUX_MODE or "chronological"}].png'
MIN_COLUMNS = 2 # looks better if there's more than one column with the legend
CULL_SINGLETON_MARKERS = True # remove any marker that only has 1 entry
CULL_SINGLETON_MARKERS = False # remove any marker that only has 1 entry
COLOR_BY = "mean" # color by this stat's value
FADE_BY_STDEV = True # fade outliers
LINES = ["mean_smart", "median"] # show mean and median lines (or stdev too)
@ -103,7 +103,7 @@ SCORES = {
"K": -1,
"ZZZZ": 2.9,
"ZZZ-": 3.0,
"ZZZ": 3.1, "ZZ": 3.15, "Z-": 3.2, "Z": 3.25,
"ZZZ": 3.1, "ZZ": 3.15, "Z-": 3.2, "Z": 3.25, "DNF": 3.25,
"L": 3.25, "T": 3.25, "N": 3.25,
"FFF": 3.5, "FF": 3.7,
"F-": 3.7, "F": 4.0, "F+": 4.3, "E": 4.5,
@ -128,29 +128,30 @@ THREADS = {}
MARKERS = {}
REVERSE_MARKERS = {}
def add_marker( name, tag, color=COLORS["TEXT"], reverse=None ):
def add_marker( name, tag, color=COLORS["TEXT"], reverse=None, zoomer=None ):
MARKERS[name] = {
"tag": tag,
"color": color,
"count": 0,
"reverse": reverse,
"zoomer": zoomer,
}
add_marker("girl", tag="!", reverse="femcel")
add_marker("foid", tag="...", reverse="sex worker")
add_marker("tranny", tag="*", reverse="real woman")
add_marker("girl", tag="!", reverse="femcel", zoomer="gyatt")
add_marker("foid", tag="...", reverse="sex worker", zoomer="skibidi")
add_marker("tranny", tag="*", reverse="real woman", zoomer="fr")
add_marker("biohazard", tag="#")
add_marker("male", tag="")
add_marker("female", tag="")
add_marker("BOOBS", tag="( Y )")
add_marker("vt", tag="^")
add_marker("race", tag="@")
add_marker("trainwreck/cringekino", tag="%", reverse="flawless")
add_marker("DNF/invalid", tag="$", reverse="WR")
add_marker("overestimate", tag=">", reverse="underestimate")
add_marker("trainwreck/cringekino", tag="%", reverse="flawless", zoomer="fanum tax")
add_marker("DNF/invalid", tag="$", reverse="WR", zoomer="ohio")
add_marker("overestimate", tag=">", reverse="underestimate", zoomer=":skull:")
add_marker("amogus", tag=" sus")
add_marker("savestated", tag="\\")
add_marker("ad", tag="", reverse="organic")
add_marker("ad/nonrun", tag="", reverse="organic", zoomer="sigma")
# Ratings fetch related
@ -403,13 +404,13 @@ def title_format(s):
def plot_sub_scatter(sub, stats):
if DROP_Z_S:
xticks = [("W", 8), ("Mid", 6), ("L", 4)] if ZOOMER else [("S", 9), ("A", 8), ("B", 7), ("C", 6), ("D", 5), ("F", 4)]
xticks = [("Bussin", 8), ("Mid Sheesh", 6), ("L Rizz", 4)] if ZOOMER else [("S", 9), ("A", 8), ("B", 7), ("C", 6), ("D", 5), ("F", 4)]
# set Range
lo = xticks[-1][1] - 1
hi = xticks[0][1] + 1
else:
xticks = [("W", 8), ("Mid", 6), ("L", 4)] if ZOOMER else [("SSS", 10), ("S", 9), ("A", 8), ("B", 7), ("C", 6), ("D", 5), ("F", 4), ("Z", 3)]
xticks = [("Bussin", 8), ("Mid Sheesh", 6), ("L Rizz", 4)] if ZOOMER else [("SSS", 10), ("S", 9), ("A", 8), ("B", 7), ("C", 6), ("D", 5), ("F", 4), ("Z", 3)]
# set Range
lo = xticks[-1][1]
@ -492,13 +493,13 @@ def plot_sub_scatter(sub, stats):
def plot_sub_boxplot(sub, stats):
if DROP_Z_S:
xticks = [("W", 8), ("Mid", 6), ("L", 4)] if ZOOMER else [("S", 9), ("A", 8), ("B", 7), ("C", 6), ("D", 5), ("F", 4)]
xticks = [("Bussin", 8), ("Mid Sheesh", 6), ("L Rizz", 4)] if ZOOMER else [("S", 9), ("A", 8), ("B", 7), ("C", 6), ("D", 5), ("F", 4)]
# set Range
lo = xticks[-1][1] - 1
hi = xticks[0][1] + 1
else:
xticks = [("W", 8), ("Mid", 6), ("L", 4)] if ZOOMER else [("SSS", 10), ("S", 9), ("A", 8), ("B", 7), ("C", 6), ("D", 5), ("F", 4), ("Z", 3)]
xticks = [("Bussin", 8), ("Mid Sheesh", 6), ("L Rizz", 4)] if ZOOMER else [("SSS", 10), ("S", 9), ("A", 8), ("B", 7), ("C", 6), ("D", 5), ("F", 4), ("Z", 3)]
# set Range
lo = xticks[-1][1]
@ -520,6 +521,7 @@ def plot_sub_boxplot(sub, stats):
# Set axis labels
sub.tick_params(axis="y", left=False, labelleft=False)
sub.tick_params(axis="x", bottom=True, top=True, labelbottom=True, labeltop=True)
sub.set_xticks([t[1] for t in xticks])
sub.set_xticklabels([f"{t[0]} " for t in xticks], ha="center")
@ -720,6 +722,7 @@ def create_plot( stats ):
tag = entry["tag"]
count = entry["count"]
reverse = entry["reverse"] if "reverse" in entry else None
zoomer = entry["zoomer"] if "zoomer" in entry else None
if count <= (1 if CULL_SINGLETON_MARKERS else 0):
continue
@ -729,6 +732,9 @@ def create_plot( stats ):
if REVERSE and reverse:
marker = reverse
if ZOOMER and zoomer:
marker = zoomer
title = f'({count}) {marker}{tag}'
handles.append(patches.Patch(label=title_format(title), color="#000000"))
@ -801,14 +807,12 @@ def stat_new(name, ratings, entry={}):
# fix up previously split markers
for i, marker in enumerate(stat["markers"]):
if marker == "DNF":
if marker in ["DNF", "invalid"]:
stat["markers"][i] = "DNF/invalid"
elif marker == "trainwreck":
stat["markers"][i] = "trainwreck/cringekino"
elif marker == "invalid":
stat["markers"][i] = "DNF/invalid"
elif marker == "cringekino":
elif marker in ["trainwreck", "cringekino"]:
stat["markers"][i] = "trainwreck/cringekino"
elif marker in ["ad", "nonrun"]:
stat["markers"][i] = "ad/nonrun"
if "event" in entry:
stat["event"] = entry["event"]
@ -875,6 +879,9 @@ def read_stats(filename):
if random.random() < entry["randomize"] and rating > hi:
rating = random.uniform(lo, hi)
if ("reverse" in entry and random.random() < entry["reverse"]) or REVERSE:
rating = 10 - rating + 2.75
ratings.append( rating )
aux["total"].append( rating )
@ -882,12 +889,14 @@ def read_stats(filename):
stat = stat_new(name, ratings, entry)
stats.append(stat)
# increment marker totals
for marker in stat["markers"]:
# flatten
for marker in {*stat["markers"]}:
if marker not in MARKERS:
continue
MARKERS[marker]["count"] += 1
# increment marker totals
for marker in stat["markers"]:
for rating in ratings:
if marker not in aux["markers"]:
aux["markers"][marker] = []
@ -967,10 +976,8 @@ def main():
if CUTOFF_SECONDS > 0:
modifiers.append(f'[cutoff={CUTOFF_SECONDS//60}]')
OUT_FILE = f'./images/ratings{"".join(modifiers)}.png'
REVERSE = args.reverse
ZOOMER = args.zoomer
DARK = not args.light