From cf2c826226c02a8e09547b746306ebe39c90a799 Mon Sep 17 00:00:00 2001 From: Cal Wing <20716204+calw20@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:04:35 +1000 Subject: [PATCH] swap f string notation for python 3.10 compat --- main.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 30eb93a..576da55 100644 --- a/main.py +++ b/main.py @@ -95,16 +95,26 @@ def process_data(gData): scope_time =- np.timedelta64(trigger_info["alignment-offset"], 'ns') scope_time =+ np.timedelta64(trigger_info["delay"], 'us') + #start_time = np.datetime64(f"{gData["info"]["date"]}T{gData["info"]["time"]}") + + start_time = 0 + x2_timesteps = np.array([0 for _ in x2_time]) + for i, dt in enumerate(x2_time): + dt = dt.astype("int") + if i == 0: + x2_timesteps[i] = start_time + dt # should be 0 + else: + x2_timesteps[i] = x2_timesteps[i-1] + dt - return x2_time, scope_time + return x2_time, scope_time, x2_timesteps def genGraph(gData): x2_time, scope_time = process_data(gData) graphData = { - "title": f"Shock response Time\nFor {gData["info"]["long_name"]}", + "title": f"Shock response Time\nFor {gData['info']['long_name']}", "xLabel": "Time (ns)", "yLabel": "Voltage Reading (V)", "grid": True, @@ -148,9 +158,9 @@ def genGraph(gData): gData = data[loaded_data[0]] -x2_time, scope_time = process_data(gData) +x2_time, scope_time, x2_timestamps = process_data(gData) -x2_out = canny_shock_finder(x2_time, (gData["x2"][4][:] - gData["x2"][4][0]) * 0.0148, plot=False) +x2_out = canny_shock_finder(x2_timestamps, (gData["x2"][4][:] - gData["x2"][4][0]) * 0.0148) print(x2_out) input("foo")