diff --git a/main.py b/main.py index 9973cc7..735b597 100644 --- a/main.py +++ b/main.py @@ -220,15 +220,31 @@ def load_data(data_to_load: list[str]) -> dict: data[x2_shot]["shock-point"][f"{probe}-g2"] = shock_point, first_value # Calculate Shock Speeds + print("-"*10, '\n') 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 c2c_dist = dataInfo["probe-info"]["c2c"] / 1000 # convert to m probe_velocity = c2c_dist / abs(g2_time - g1_time) # m/s + + print(f"{probe} Measured a shock speed of {probe_velocity:.2f} m/s ({probe_velocity/1000:.2f} km/s)") + + if len(dataInfo["probe-info"]["locations"]) > 1: + foo = dataInfo["probe-info"]["locations"] + p1_g1_time = data[x2_shot]["shock-point"][f"{foo[0]}-g1"][1] / 1e6 # Convert to seconds + p1_g2_time = data[x2_shot]["shock-point"][f"{foo[0]}-g2"][1] / 1e6 # Convert to seconds - print(f"{probe} Measured a shock speed of {probe_velocity:.2f} m/s") - print(f" {probe_velocity/1000:.2f} km/s") + p2_g1_time = data[x2_shot]["shock-point"][f"{foo[1]}-g1"][1] / 1e6 # Convert to seconds + p2_g2_time = data[x2_shot]["shock-point"][f"{foo[1]}-g2"][1] / 1e6 # Convert to seconds + + p2p = (TUNNEL_INFO["distance"][foo[1]] - TUNNEL_INFO["distance"][foo[0]]) / 1000 # convert to m + + p2p_1 = p2p / abs(p2_g1_time - p1_g1_time) # m/s + p2p_2 = p2p / abs(p2_g2_time - p1_g2_time) # m/s + + print(f"{foo[0]} - {foo[1]} - G1 - Measured a shock speed of {p2p_1:.2f} m/s ({p2p_1/1000:.2f} km/s)") + print(f"{foo[0]} - {foo[1]} - G2 - Measured a shock speed of {p2p_2:.2f} m/s ({p2p_2/1000:.2f} km/s)") # Return the data & the successfully loaded data keys @@ -305,7 +321,8 @@ genGraph(data[loaded_data[2]], showPlot=False) #print(x2_out) # This forces matplotlib to hang until I tell it to close all windows -pltKeyClose() +#pltKeyClose() + print("Done")