Finalise Graphing please?
This commit is contained in:
parent
511995830c
commit
30376abeb9
@ -2,7 +2,7 @@
|
||||
# Cal Wing - Oct 24
|
||||
|
||||
long_name: "Shot 7 (x2s5829) - Thin Probe Set (ST1, ST2 & ST3) - 2024-10-18\nProtruding ST1 & ST1, Flush ST3 (Only Gauge 1) - Low Pressure, 'Pure' Air Conditions"
|
||||
name: "Shot 6"
|
||||
name: "Shot 7"
|
||||
date: "2024-10-18"
|
||||
time: "15:58"
|
||||
|
||||
@ -28,11 +28,14 @@ canny-args:
|
||||
post_pres: 0.05
|
||||
|
||||
x2-canny:
|
||||
- sigma: 1
|
||||
post_pres: 0.02
|
||||
- sigma: 2
|
||||
post_pres: 0.03
|
||||
|
||||
- sigma: 0.5
|
||||
post_pres: 0.02
|
||||
- sigma: 1
|
||||
post_pres: 0.2
|
||||
|
||||
- sigma: 1
|
||||
post_pres: 0.05
|
||||
|
||||
no-graph:
|
||||
- "None"
|
||||
|
99
main.py
99
main.py
@ -184,13 +184,13 @@ def load_data(data_path: str, data={}) -> dict:
|
||||
for ch in dataInfo["probe-info"]["data-records"][data_locs.index("x2")]["channels"]:
|
||||
if ch in dataInfo["probe-info"]["data-records"][data_locs.index("x2")]["scaler"]:
|
||||
# Get the channel index from its name
|
||||
chIndex = x2_channel_names.index(channel)
|
||||
chIndex = x2_channel_names.index(ch)
|
||||
|
||||
# Calculate the average noise offset
|
||||
avg_noise = x2_channels[chIndex][0:SAMPLES_TO_AVG].mean()
|
||||
|
||||
# Save the channel data
|
||||
data[x2_shot]["data"]["x2"][channel] = (x2_channels[chIndex][:] - avg_noise) * dataInfo["probe-info"]["data-records"][data_locs.index("x2")]["scaler"][ch]
|
||||
data[x2_shot]["data"]["x2"][ch] = (x2_channels[chIndex][:] - avg_noise) * dataInfo["probe-info"]["data-records"][data_locs.index("x2")]["scaler"][ch]
|
||||
|
||||
#[TODO] This could be better
|
||||
#if "x2" in data_locs:
|
||||
@ -986,6 +986,91 @@ def genComboDataGraph(data: dict, showPlot: bool = False, doShockLabels:bool = F
|
||||
|
||||
makeGraph(graphData, doProgramBlock=False, showPlot=showPlot, figSavePath=f"./images/combo-my-data.png")
|
||||
|
||||
|
||||
def genX2CompGraphs(gData: dict, showPlot: bool = True):
|
||||
graphData = {
|
||||
"title": f"Signal Comparison for {gData['info']['name']} ({gData['info']['shot-info']['name']})",
|
||||
"xLabel": "Time ($\\mu$s)",
|
||||
"yLabel": "Voltage Reading (V)",
|
||||
"grid": True,
|
||||
"figSize": (16, 6.8), #(9, 6.8), #(8,6.5),
|
||||
"ledgLoc": 'upper left',
|
||||
"yLim": (-1.5, 11),
|
||||
"plots": []
|
||||
}
|
||||
|
||||
lims = []
|
||||
|
||||
for label, d in [("1 [V]", "Gauge 1 - Scope"),("2 [V]", "Gauge 2 - Scope")]: #, ("4 [V]", "Gauge Trigger")]:
|
||||
graphData["plots"].append({
|
||||
"x": gData["time"]["scope"],
|
||||
"y": gData["data"]["scope"][label],
|
||||
"label": d,
|
||||
"args":{"zorder":1}
|
||||
})
|
||||
|
||||
for label, d in [("st1", "Gauge 1 - X2 DAQ"),("st3", "Gauge 2 - X2 DAQ")]: #, ("4 [V]", "Gauge Trigger")]:
|
||||
graphData["plots"].append({
|
||||
"x": gData["time"]["x2"],
|
||||
"y": gData["data"]["x2"][label],
|
||||
"label": d,
|
||||
"args":{"zorder":1}
|
||||
})
|
||||
|
||||
|
||||
for _, probe in enumerate(gData["info"]["probe-info"]["locations"]):
|
||||
if f"{probe}-g1" in gData["shock-point"]:
|
||||
graphData["plots"].append({
|
||||
"type": "axvLine",
|
||||
"x": gData["shock-point"][f"{probe}-g1"][1],#[i],
|
||||
"label": f"{probe}-Gauge 1 - Scope - Shock Point {gData['shock-point'][f'{probe}-g1'][1]:.2f}$\\mu$s",
|
||||
"colour": UQC["purple"].lighten(0.5),
|
||||
"args":{"zorder":2, "linestyle":"--", "alpha":0.5}
|
||||
})
|
||||
lims.append(gData["shock-point"][f"{probe}-g1"][1])
|
||||
|
||||
if f"{probe}-g2" in gData["shock-point"]:
|
||||
graphData["plots"].append({
|
||||
"type": "axvLine",
|
||||
"x": gData["shock-point"][f"{probe}-g2"][1],#[i],
|
||||
"label": f"{probe}-Gauge 2 - Scope - Shock Point {gData['shock-point'][f'{probe}-g2'][1]:.2f}$\\mu$s",
|
||||
"colour": UQC["purple"].lighten(0.5),
|
||||
"args":{"zorder":2, "linestyle":":", "alpha":0.5}
|
||||
})
|
||||
|
||||
lims.append(gData["shock-point"][f"{probe}-g2"][1])
|
||||
|
||||
for _, probe in enumerate(gData["info"]["probe-info"]["locations"]):
|
||||
if f"{probe}-g1" in gData["shock-point"]["x2"]:
|
||||
graphData["plots"].append({
|
||||
"type": "axvLine",
|
||||
"x": gData["shock-point"]["x2"][f"{probe}-g1"][1],#[i],
|
||||
"label": f"{probe}-Gauge 1 - X2 DAQ - Shock Point {gData['shock-point'][f'{probe}-g1'][1]:.2f}$\\mu$s",
|
||||
"colour": UQC["dark_grey"],
|
||||
"args":{"zorder":2, "linestyle":"--", "alpha":0.5}
|
||||
})
|
||||
lims.append(gData["shock-point"]["x2"][f"{probe}-g1"][1])
|
||||
|
||||
if f"{probe}-g2" in gData["shock-point"]["x2"]:
|
||||
graphData["plots"].append({
|
||||
"type": "axvLine",
|
||||
"x": gData["shock-point"]["x2"][f"{probe}-g2"][1],#[i],
|
||||
"label": f"{probe}-Gauge 2 - X2 DAQ - Shock Point {gData['shock-point'][f'{probe}-g2'][1]:.2f}$\\mu$s",
|
||||
"colour": UQC["dark_grey"],
|
||||
"args":{"zorder":2, "linestyle":":", "alpha":0.5}
|
||||
})
|
||||
|
||||
lims.append(gData["shock-point"]["x2"][f"{probe}-g2"][1])
|
||||
|
||||
|
||||
if True and len(lims) > 1:
|
||||
OFFSET = 10 #if not forcePlots else 50
|
||||
graphData["xLim"] = (float(min(lims) - OFFSET), float(max(lims) + OFFSET))
|
||||
|
||||
makeGraph(graphData, doProgramBlock=False, showPlot=showPlot, figSavePath=f"./images/signal_comp-{gData['info']['shot-info']['name']}.png")
|
||||
|
||||
|
||||
|
||||
print("Loading Data")
|
||||
|
||||
# My Shot Data
|
||||
@ -997,9 +1082,9 @@ for dp in data_to_load:
|
||||
loaded_data = tuple(data.keys())
|
||||
|
||||
# Reference Data from Mragank
|
||||
ref_data = {}
|
||||
for refShot in ref_data_to_load:
|
||||
load_ref_data(refShot, f"./data/referance/{refShot}/{refShot}.tdms", ref_data)
|
||||
#ref_data = {}
|
||||
#for refShot in ref_data_to_load:
|
||||
# load_ref_data(refShot, f"./data/referance/{refShot}/{refShot}.tdms", ref_data)
|
||||
|
||||
print("Loaded Data")
|
||||
|
||||
@ -1019,6 +1104,10 @@ print("Graphing Data")
|
||||
#
|
||||
#genComboDataGraph(combo_data, doShockLabels=True)
|
||||
|
||||
|
||||
genX2CompGraphs(data["x2s5831"], showPlot=False)
|
||||
genX2CompGraphs(data["x2s5832"], showPlot=False)
|
||||
|
||||
# Reference Data
|
||||
#for shot in ref_data:
|
||||
# genRefGraph(ref_data[shot], showPlot=False, addShockInfo=False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user