From 5b1bf0eedbfaf38b54a3bd6570ebfdeb42f2112a Mon Sep 17 00:00:00 2001 From: Cal Wing <20716204+calw20@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:42:38 +1000 Subject: [PATCH] Order Graphs --- main.py | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/main.py b/main.py index 2de0d8a..5c15d3c 100644 --- a/main.py +++ b/main.py @@ -397,33 +397,15 @@ def genGraph(gData: dict, showPlot: bool = True, doLimits: bool = True, forcePlo lims = [] - for label in gData["info"]["pcb-refs"]: # + ["trigbox"]: - if not forcePlots and label in gData["info"]["no-graph"]: continue - graphData["plots"].append({ - "x": gData["time"]["x2"], - "y": gData["data"]["x2"][label], - "label": label - }) - - if label in gData["info"]["pcb-refs"]: - graphData["plots"].append({ - "type": "axvLine", - "x": gData["shock-point"][label][1], - "label": f"{label} - Shock Point {gData['shock-point'][label][1]:.2f}$\\mu$s", - "colour": "gray", - "args":{"zorder":2, "linestyle":"--", "alpha":0.5} - }) - lims.append(gData["shock-point"][label][1]) # [TODO this but better] - - for label, d in [("1 [V]", "Gauge 1"),("2 [V]", "Gauge 2")]: #, ("4 [V]", "Gauge Trigger")]: graphData["plots"].append({ "x": gData["time"]["scope"], "y": gData["data"]["scope"][label], - "label": d + "label": d, + "args":{"zorder":1} }) - for i, probe in enumerate(gData["info"]["probe-info"]["locations"]): + for _, probe in enumerate(gData["info"]["probe-info"]["locations"]): if f"{probe}-g1" in gData["shock-point"]: graphData["plots"].append({ "type": "axvLine", @@ -445,6 +427,23 @@ def genGraph(gData: dict, showPlot: bool = True, doLimits: bool = True, forcePlo lims.append(gData["shock-point"][f"{probe}-g2"][1]) + for label in gData["info"]["pcb-refs"]: # + ["trigbox"]: + if not forcePlots and label in gData["info"]["no-graph"]: continue + graphData["plots"].append({ + "x": gData["time"]["x2"], + "y": gData["data"]["x2"][label], + "label": label + }) + + if label in gData["info"]["pcb-refs"]: + graphData["plots"].append({ + "type": "axvLine", + "x": gData["shock-point"][label][1], + "label": f"{label} - Shock Point {gData['shock-point'][label][1]:.2f}$\\mu$s", + "colour": "gray", + "args":{"zorder":2, "linestyle":"--", "alpha":0.5} + }) + lims.append(gData["shock-point"][label][1]) # [TODO this but better] if addShockInfo: probeText = ""