Correct for scope triggering
This commit is contained in:
parent
30376abeb9
commit
ab3547b26c
18
main.py
18
main.py
@ -136,6 +136,7 @@ def load_data(data_path: str, data={}) -> dict:
|
||||
"probes": None, # This may be x2 but may not - ie a scope was used
|
||||
"trigger_index": None,
|
||||
"probe_uncert": None, #s
|
||||
"x2-dt": None, #
|
||||
},
|
||||
"data": {
|
||||
"x2": {}, # Only pop channels with a voltage scale in ./tunnel-info.yaml
|
||||
@ -151,6 +152,7 @@ def load_data(data_path: str, data={}) -> dict:
|
||||
ns_time = time_data[:].as_datetime64('ns')
|
||||
x2_time_seconds = (ns_time - ns_time[0]) # timedelta64[ns]
|
||||
x2_time_us = x2_time_seconds.astype("float64") / 1000 # Scale to us
|
||||
x2_time_dt = np.diff(x2_time_us).mean() / 1000 # Scale to s
|
||||
|
||||
#second_fractions = np.array(time_data[:].second_fractions, dtype=int) # 2^-64 ths of a second
|
||||
#x2_time_seconds = (second_fractions - second_fractions[0]) / (2**(-64)) # 0 time data and convert to seconds
|
||||
@ -177,6 +179,7 @@ def load_data(data_path: str, data={}) -> dict:
|
||||
"x2": x2_time_us,
|
||||
"trigger_index": x2_trigger_index,
|
||||
"probes": x2_time_us, # Until otherwise overridden - probe time is x2 time
|
||||
"x2-dt": x2_time_dt
|
||||
}
|
||||
|
||||
# Setup custom scaling on the gauge values
|
||||
@ -220,6 +223,7 @@ def load_data(data_path: str, data={}) -> dict:
|
||||
|
||||
data[x2_shot]["time"]["scope"] = scope_time
|
||||
data[x2_shot]["time"]["scope-offset"] = scope_alignment
|
||||
data[x2_shot]["time"]["scope-dt"] = np.diff(scope_time).mean() / 1e6
|
||||
|
||||
data[x2_shot]["data"]["scope"] = {}
|
||||
for i, header in enumerate(scope_header):
|
||||
@ -234,7 +238,7 @@ def load_data(data_path: str, data={}) -> dict:
|
||||
if "scope" in data_locs:
|
||||
data[x2_shot]["data"]["probes"] = [data[x2_shot]["data"]["scope"][1], data[x2_shot]["data"]["scope"][2]]
|
||||
data[x2_shot]["time"]["probes"] = data[x2_shot]["time"]["scope"]
|
||||
data[x2_shot]["time"]["probe_uncert"] = scope_data_info["time-uncert"]
|
||||
data[x2_shot]["time"]["probe_uncert"] = max(scope_data_info["time-uncert"], data[x2_shot]["time"]["scope-dt"])
|
||||
|
||||
# Find Shock Times
|
||||
# X2 - Canning Edge
|
||||
@ -500,6 +504,7 @@ def load_ref_data(x2_shot: str, data_path: str, data={}) -> dict:
|
||||
ns_time = time_data[:].as_datetime64('ns')
|
||||
x2_time_seconds = (ns_time - ns_time[0]) # timedelta64[ns]
|
||||
x2_time_us = x2_time_seconds.astype("float64") / 1000 # Scale to us
|
||||
x2_time_dt = np.diff(x2_time_us).mean() / 1000 # Scale to s
|
||||
|
||||
# --- Un Scale Data ---
|
||||
for channel, vScale in TUNNEL_INFO["volt-scale"].items():
|
||||
@ -521,6 +526,7 @@ def load_ref_data(x2_shot: str, data_path: str, data={}) -> dict:
|
||||
data[x2_shot]["time"] = {
|
||||
"x2": x2_time_us,
|
||||
"trigger_index": x2_trigger_index,
|
||||
"x2-dt": x2_time_dt
|
||||
}
|
||||
|
||||
|
||||
@ -1070,6 +1076,14 @@ def genX2CompGraphs(gData: dict, showPlot: bool = True):
|
||||
makeGraph(graphData, doProgramBlock=False, showPlot=showPlot, figSavePath=f"./images/signal_comp-{gData['info']['shot-info']['name']}.png")
|
||||
|
||||
|
||||
print("-")
|
||||
scopeTime = gData["time"]["scope"]
|
||||
scopeData = gData["data"]["scope"]
|
||||
|
||||
x2Time = gData["time"]["x2"]
|
||||
#x2Data = gData["data"]["x2"]
|
||||
|
||||
pass
|
||||
|
||||
print("Loading Data")
|
||||
|
||||
@ -1118,5 +1132,5 @@ genX2CompGraphs(data["x2s5832"], showPlot=False)
|
||||
|
||||
|
||||
# This forces matplotlib to hang until I tell it to close all windows
|
||||
pltKeyClose()
|
||||
#pltKeyClose()
|
||||
print("Done")
|
Loading…
x
Reference in New Issue
Block a user