Order Graphs

This commit is contained in:
Cal Wing 2024-10-22 21:42:38 +10:00
parent 2e5dc27055
commit 5b1bf0eedb

41
main.py
View File

@ -397,33 +397,15 @@ def genGraph(gData: dict, showPlot: bool = True, doLimits: bool = True, forcePlo
lims = [] 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")]: for label, d in [("1 [V]", "Gauge 1"),("2 [V]", "Gauge 2")]: #, ("4 [V]", "Gauge Trigger")]:
graphData["plots"].append({ graphData["plots"].append({
"x": gData["time"]["scope"], "x": gData["time"]["scope"],
"y": gData["data"]["scope"][label], "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"]: if f"{probe}-g1" in gData["shock-point"]:
graphData["plots"].append({ graphData["plots"].append({
"type": "axvLine", "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]) 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: if addShockInfo:
probeText = "" probeText = ""