Acually finish code?
This commit is contained in:
parent
ab3547b26c
commit
5ffbf17ac6
46
main.py
46
main.py
@ -182,6 +182,8 @@ def load_data(data_path: str, data={}) -> dict:
|
||||
"x2-dt": x2_time_dt
|
||||
}
|
||||
|
||||
data[x2_shot]["time"]["x2_uncert"] = max(UNCERTS["time"]["x2-daq"], data[x2_shot]["time"]["x2-dt"])
|
||||
|
||||
# Setup custom scaling on the gauge values
|
||||
if "x2" in data_locs:
|
||||
for ch in dataInfo["probe-info"]["data-records"][data_locs.index("x2")]["channels"]:
|
||||
@ -376,7 +378,7 @@ def load_data(data_path: str, data={}) -> dict:
|
||||
p1_time_uncert = data[x2_shot]["shock-point"][dataInfo["pcb-refs"][i-1]][2] / 1e6 # Convert to seconds
|
||||
p2_time_uncert = data[x2_shot]["shock-point"][refProbe][2] / 1e6 # Convert to seconds
|
||||
|
||||
uncert = deltaVs(probe_velocity, p2p_dist, p2p_time, (UNCERTS["probe-dist"][refProbe], UNCERTS["probe-dist"][dataInfo["pcb-refs"][i-1]]), (p1_time_uncert, p2_time_uncert, UNCERTS["time"]["x2-daq"]))
|
||||
uncert = deltaVs(probe_velocity, p2p_dist, p2p_time, (UNCERTS["probe-dist"][refProbe], UNCERTS["probe-dist"][dataInfo["pcb-refs"][i-1]]), (p1_time_uncert, p2_time_uncert, data[x2_shot]["time"]["x2_uncert"]))
|
||||
|
||||
print(f"{dataInfo['pcb-refs'][i-1]}-{refProbe} Measured a shock speed of {probe_velocity:.2f} +/- {uncert:.2f} m/s ({probe_velocity/1000:.2f} +/- {uncert/1000:.2f} km/s [{uncert/probe_velocity * 100 :.2f}%])")
|
||||
data[x2_shot]["shock-speed"][f"{dataInfo['pcb-refs'][i-1]}-{refProbe}"] = probe_velocity, uncert, True # Speed, Ref
|
||||
@ -497,6 +499,8 @@ def load_ref_data(x2_shot: str, data_path: str, data={}) -> dict:
|
||||
"shock-speed": {} # Note all in us
|
||||
}
|
||||
|
||||
data[x2_shot]["time"]["x2_uncert"] = max(UNCERTS["time"]["x2-daq"], data[x2_shot]["time"]["x2-dt"])
|
||||
|
||||
# === Process the data ===
|
||||
# Generate X2 time arrays
|
||||
time_data = x2_channels[0]
|
||||
@ -570,7 +574,7 @@ def load_ref_data(x2_shot: str, data_path: str, data={}) -> dict:
|
||||
p1_time_uncert = data[x2_shot]["shock-point"][dataInfo["pcb-refs"][i-1]][2] / 1e6 # Convert to seconds
|
||||
p2_time_uncert = data[x2_shot]["shock-point"][refProbe][2] / 1e6 # Convert to seconds
|
||||
|
||||
uncert = deltaVs(probe_velocity, p2p_dist, p2p_time, (UNCERTS["probe-dist"][refProbe], UNCERTS["probe-dist"][dataInfo["pcb-refs"][i-1]]), (p1_time_uncert, p2_time_uncert, UNCERTS["time"]["x2-daq"]))
|
||||
uncert = deltaVs(probe_velocity, p2p_dist, p2p_time, (UNCERTS["probe-dist"][refProbe], UNCERTS["probe-dist"][dataInfo["pcb-refs"][i-1]]), (p1_time_uncert, p2_time_uncert, data[x2_shot]["time"]["x2_uncert"]))
|
||||
|
||||
print(f"{dataInfo['pcb-refs'][i-1]}-{refProbe} Measured a shock speed of {probe_velocity:.2f} +/- {uncert:.2f} m/s ({probe_velocity/1000:.2f} +/- {uncert/1000:.2f} km/s [{uncert/probe_velocity * 100 :.2f}%])")
|
||||
data[x2_shot]["shock-speed"][f"{dataInfo['pcb-refs'][i-1]}-{refProbe}"] = probe_velocity, uncert, True # Speed, Ref
|
||||
@ -1096,9 +1100,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")
|
||||
|
||||
@ -1107,28 +1111,28 @@ print("Loaded Data")
|
||||
print("Graphing Data")
|
||||
|
||||
# General Shot Graphing
|
||||
#for shot in loaded_data:
|
||||
# #print(data[shot]['info']['long_name'].rsplit("\n", 1)[-1])
|
||||
# genGraph(data[shot], showPlot=False, addShockInfo=False)
|
||||
# genGraph(data[shot], showPlot=False, forcePlots=True)
|
||||
#
|
||||
#combo_data = data.copy()
|
||||
#combo_data.pop(loaded_data[-2])
|
||||
#combo_data.pop(loaded_data[-1])
|
||||
#
|
||||
#genComboDataGraph(combo_data, doShockLabels=True)
|
||||
for shot in loaded_data:
|
||||
#print(data[shot]['info']['long_name'].rsplit("\n", 1)[-1])
|
||||
genGraph(data[shot], showPlot=False, addShockInfo=False)
|
||||
genGraph(data[shot], showPlot=False, forcePlots=True)
|
||||
|
||||
combo_data = data.copy()
|
||||
combo_data.pop(loaded_data[-2])
|
||||
combo_data.pop(loaded_data[-1])
|
||||
|
||||
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)
|
||||
# genRefGraph(ref_data[shot], showPlot=False, forcePlots=True)
|
||||
#
|
||||
#genComboRefGraph(ref_data, doShockLabels=True)
|
||||
#genComboRefGraph(ref_data, ref_data[ref_data_to_load[0]]["info"]["pcb-refs"], addShockInfo=True)
|
||||
for shot in ref_data:
|
||||
genRefGraph(ref_data[shot], showPlot=False, addShockInfo=False)
|
||||
genRefGraph(ref_data[shot], showPlot=False, forcePlots=True)
|
||||
|
||||
genComboRefGraph(ref_data, doShockLabels=True)
|
||||
genComboRefGraph(ref_data, ref_data[ref_data_to_load[0]]["info"]["pcb-refs"], addShockInfo=True)
|
||||
|
||||
|
||||
# This forces matplotlib to hang until I tell it to close all windows
|
||||
|
Loading…
x
Reference in New Issue
Block a user