diff --git a/main.py b/main.py index 942b831..9973cc7 100644 --- a/main.py +++ b/main.py @@ -219,8 +219,17 @@ def load_data(data_to_load: list[str]) -> dict: shock_point = np.where(scope_time[offset:] >= first_value)[0][0] + offset # [BUG] Seems to give n+1 data[x2_shot]["shock-point"][f"{probe}-g2"] = shock_point, first_value - + # Calculate Shock Speeds + 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") + print(f" {probe_velocity/1000:.2f} km/s") + # Return the data & the successfully loaded data keys return data, tuple(data.keys()) @@ -289,6 +298,8 @@ print("Graphing Data") genGraph(data[loaded_data[2]], showPlot=False) + + #x2_out = canny_shock_finder(x2_time, (gData["raw-data"]["x2"][16][:] - gData["raw-data"]["x2"][16][0])) #print(x2_out)