diff --git a/data/x2s5830/_info.yaml b/data/x2s5830/_info.yaml index 3067d7f..68679db 100644 --- a/data/x2s5830/_info.yaml +++ b/data/x2s5830/_info.yaml @@ -20,9 +20,26 @@ canny-args: - sigma: 1 post_pres: 0.2 +no-graph: + - "at1" + - "at2" + - "at3" + + - "at4" + - "at5" + - "at6" + pcb-refs: - "st1" + - "at1" + - "at2" + - "at3" + + - "at4" + - "at5" + - "at6" + probe-info: type: "Thin" locations: # In order of pulse diff --git a/main.py b/main.py index 6e024ef..da2a6cf 100644 --- a/main.py +++ b/main.py @@ -67,10 +67,10 @@ def load_data(data_path: str, data={}) -> dict: # Scope info _if it exists_ 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_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 with open(scope_data_path, 'r') as dfile: @@ -115,7 +115,7 @@ def load_data(data_path: str, data={}) -> dict: }, "data": { "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 } @@ -158,7 +158,7 @@ def load_data(data_path: str, data={}) -> dict: # Scope timing _if it exists_ 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 @@ -192,7 +192,7 @@ def load_data(data_path: str, data={}) -> dict: # Save Probe Data 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"] @@ -251,7 +251,20 @@ def load_data(data_path: str, data={}) -> dict: data[x2_shot]["shock-point"][f"{probe}-g2"] = shock_point, first_value # 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"]: 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 @@ -311,6 +324,7 @@ def genGraph(gData: dict, showPlot: bool = True): lims = [] for label in gData["info"]["pcb-refs"]: # + ["trigbox"]: + if label in gData["info"]["no-graph"]: continue graphData["plots"].append({ "x": gData["time"]["x2"], "y": gData["data"]["x2"][label],