Basic Reference Data
This commit is contained in:
parent
bb6b47329c
commit
4864897580
@ -20,9 +20,26 @@ canny-args:
|
|||||||
- sigma: 1
|
- sigma: 1
|
||||||
post_pres: 0.2
|
post_pres: 0.2
|
||||||
|
|
||||||
|
no-graph:
|
||||||
|
- "at1"
|
||||||
|
- "at2"
|
||||||
|
- "at3"
|
||||||
|
|
||||||
|
- "at4"
|
||||||
|
- "at5"
|
||||||
|
- "at6"
|
||||||
|
|
||||||
pcb-refs:
|
pcb-refs:
|
||||||
- "st1"
|
- "st1"
|
||||||
|
|
||||||
|
- "at1"
|
||||||
|
- "at2"
|
||||||
|
- "at3"
|
||||||
|
|
||||||
|
- "at4"
|
||||||
|
- "at5"
|
||||||
|
- "at6"
|
||||||
|
|
||||||
probe-info:
|
probe-info:
|
||||||
type: "Thin"
|
type: "Thin"
|
||||||
locations: # In order of pulse
|
locations: # In order of pulse
|
||||||
|
26
main.py
26
main.py
@ -67,10 +67,10 @@ def load_data(data_path: str, data={}) -> dict:
|
|||||||
|
|
||||||
# Scope info _if it exists_
|
# Scope info _if it exists_
|
||||||
if "scope" in data_locs:
|
if "scope" in data_locs:
|
||||||
scope_data_info = dataInfo["probe-info"]["data-record"][data_locs.index("scope")]
|
scope_data_info = dataInfo["probe-info"]["data-records"][data_locs.index("scope")]
|
||||||
|
|
||||||
scope_data_path = data_path + scope_data_info["data"]
|
scope_data_path = data_path + scope_data_info["data"]
|
||||||
scope_config_path = data_path + ["config"] # [TODO] Read this file
|
scope_config_path = data_path + scope_data_info["config"] # [TODO] Read this file
|
||||||
|
|
||||||
# Generate Data Headers - This could be better
|
# Generate Data Headers - This could be better
|
||||||
with open(scope_data_path, 'r') as dfile:
|
with open(scope_data_path, 'r') as dfile:
|
||||||
@ -115,7 +115,7 @@ def load_data(data_path: str, data={}) -> dict:
|
|||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"x2": {}, # Only pop channels with a voltage scale in ./tunnel-info.yaml
|
"x2": {}, # Only pop channels with a voltage scale in ./tunnel-info.yaml
|
||||||
"probes": {} # Save probe data
|
"probes": [[None], [None]] # Save probe data in volts - [G1, G2]
|
||||||
},
|
},
|
||||||
"shock-speed": {} # Note all in us
|
"shock-speed": {} # Note all in us
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ def load_data(data_path: str, data={}) -> dict:
|
|||||||
|
|
||||||
# Scope timing _if it exists_
|
# Scope timing _if it exists_
|
||||||
if "scope" in data_locs:
|
if "scope" in data_locs:
|
||||||
scope_data_info = dataInfo["probe-info"]["data-record"][data_locs.index("scope")]
|
scope_data_info = dataInfo["probe-info"]["data-records"][data_locs.index("scope")]
|
||||||
|
|
||||||
trigger_info = scope_data_info["trigger"] # Get the scope trigger info
|
trigger_info = scope_data_info["trigger"] # Get the scope trigger info
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ def load_data(data_path: str, data={}) -> dict:
|
|||||||
|
|
||||||
# Save Probe Data
|
# Save Probe Data
|
||||||
if "scope" in data_locs:
|
if "scope" in data_locs:
|
||||||
data[x2_shot]["data"]["probes"] = data[x2_shot]["data"]["scope"][1:2]
|
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"]["probes"] = data[x2_shot]["time"]["scope"]
|
||||||
|
|
||||||
|
|
||||||
@ -251,7 +251,20 @@ def load_data(data_path: str, data={}) -> dict:
|
|||||||
data[x2_shot]["shock-point"][f"{probe}-g2"] = shock_point, first_value
|
data[x2_shot]["shock-point"][f"{probe}-g2"] = shock_point, first_value
|
||||||
|
|
||||||
# Calculate Shock Speeds
|
# Calculate Shock Speeds
|
||||||
print("="*25, x2_shot, "="*25)
|
print("="*30, x2_shot, "="*30)
|
||||||
|
print("--", dataInfo["long_name"], "--")
|
||||||
|
|
||||||
|
for i, refProbe in enumerate(dataInfo["pcb-refs"]):
|
||||||
|
if i == 0: continue
|
||||||
|
p1_time = data[x2_shot]["shock-point"][refProbe][1] / 1e6 # Convert to seconds
|
||||||
|
p2_time = data[x2_shot]["shock-point"][dataInfo["pcb-refs"][i-1]][1] / 1e6 # Convert to seconds
|
||||||
|
p2p_dist = (TUNNEL_INFO["distance"][refProbe] - TUNNEL_INFO["distance"][dataInfo["pcb-refs"][i-1]]) / 1000 # convert to m
|
||||||
|
|
||||||
|
probe_velocity = p2p_dist / abs(p2_time - p1_time) # m/s
|
||||||
|
print(f"{refProbe}-{dataInfo["pcb-refs"][i-1]} Measured a shock speed of {probe_velocity:.2f} m/s ({probe_velocity/1000:.2f} km/s)")
|
||||||
|
|
||||||
|
|
||||||
|
print()
|
||||||
for probe in dataInfo["probe-info"]["locations"]:
|
for probe in dataInfo["probe-info"]["locations"]:
|
||||||
g1_time = data[x2_shot]["shock-point"][f"{probe}-g1"][1] / 1e6 # Convert to seconds
|
g1_time = data[x2_shot]["shock-point"][f"{probe}-g1"][1] / 1e6 # Convert to seconds
|
||||||
g2_time = data[x2_shot]["shock-point"][f"{probe}-g2"][1] / 1e6 # Convert to seconds
|
g2_time = data[x2_shot]["shock-point"][f"{probe}-g2"][1] / 1e6 # Convert to seconds
|
||||||
@ -311,6 +324,7 @@ def genGraph(gData: dict, showPlot: bool = True):
|
|||||||
lims = []
|
lims = []
|
||||||
|
|
||||||
for label in gData["info"]["pcb-refs"]: # + ["trigbox"]:
|
for label in gData["info"]["pcb-refs"]: # + ["trigbox"]:
|
||||||
|
if label in gData["info"]["no-graph"]: continue
|
||||||
graphData["plots"].append({
|
graphData["plots"].append({
|
||||||
"x": gData["time"]["x2"],
|
"x": gData["time"]["x2"],
|
||||||
"y": gData["data"]["x2"][label],
|
"y": gData["data"]["x2"][label],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user