From 02fc4bb079d52217ff1cac3ecb689d6d0e8b4694 Mon Sep 17 00:00:00 2001 From: Cal Wing <20716204+calw20@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:32:33 +1000 Subject: [PATCH] Fix fstrings --- main.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 034b1fb..f5b1bb0 100644 --- a/main.py +++ b/main.py @@ -117,7 +117,7 @@ def load_data(data_path: str, data={}) -> dict: # Raw Data is always added - processing comes after data[x2_shot] = { "info": dataInfo, - "shot_time": np.datetime64(f"{dataInfo["date"]}T{dataInfo["time"]}"), + "shot_time": np.datetime64(f"{dataInfo['date']}T{dataInfo['time']}"), "raw-data":{ "probe_headers": scope_header, "probes": scope_data, @@ -304,8 +304,8 @@ def load_data(data_path: str, data={}) -> dict: uncert = deltaVs(probe_velocity, p2p_dist, p2p_time, (UNCERTS["probe-dist"][refProbe], UNCERTS["probe-dist"][dataInfo["pcb-refs"][i-1]]), (p1_time_uncert, p2_time_uncert, UNCERTS["time"]["x2-daq"])) - print(f"{dataInfo["pcb-refs"][i-1]}-{refProbe} Measured a shock speed of {probe_velocity:.2f} +/- {uncert:.2f} m/s ({probe_velocity/1000:.2f} +/- {uncert/1000:.2f} km/s [{uncert/probe_velocity * 100 :.2f}%])") - data[x2_shot]["shock-speed"][f"{dataInfo["pcb-refs"][i-1]}-{refProbe}"] = probe_velocity, uncert, True # Speed, Ref + print(f"{dataInfo['pcb-refs'][i-1]}-{refProbe} Measured a shock speed of {probe_velocity:.2f} +/- {uncert:.2f} m/s ({probe_velocity/1000:.2f} +/- {uncert/1000:.2f} km/s [{uncert/probe_velocity * 100 :.2f}%])") + data[x2_shot]["shock-speed"][f"{dataInfo['pcb-refs'][i-1]}-{refProbe}"] = probe_velocity, uncert, True # Speed, Ref print() for probe in dataInfo["probe-info"]["locations"]: @@ -325,7 +325,7 @@ def load_data(data_path: str, data={}) -> dict: print(f"{probe} Measured a shock speed of {probe_velocity:.2f} +/- {uncert:.2f} m/s ({probe_velocity/1000:.2f} +/- {uncert/1000:.2f} km/s)") data[x2_shot]["shock-speed"][probe] = probe_velocity, uncert, False # Speed, Ref # m/s else: - print(f"Unable to calculate probe velocity, only have one gauge: {f"{probe}-g2" if f"{probe}-g2" in data[x2_shot]["shock-point"] else f"{probe}-g1"}") + print(f"Unable to calculate probe velocity, only have one gauge: {f'{probe}-g2' if f'{probe}-g2' in data[x2_shot]['shock-point'] else f'{probe}-g1'}") if len(dataInfo["probe-info"]["locations"]) > 1: for i in range(len(dataInfo["probe-info"]["locations"]) - 1): @@ -408,7 +408,7 @@ def genGraph(gData: dict, showPlot: bool = True, doLimits: bool = True, forcePlo graphData["plots"].append({ "type": "axvLine", "x": gData["shock-point"][label][1], - "label": f"{label} - Shock Point {gData["shock-point"][label][1]:.2f}$\\mu$s", + "label": f"{label} - Shock Point {gData['shock-point'][label][1]:.2f}$\\mu$s", "colour": "gray", "args":{"zorder":2, "linestyle":"--", "alpha":0.5} }) @@ -427,7 +427,7 @@ def genGraph(gData: dict, showPlot: bool = True, doLimits: bool = True, forcePlo graphData["plots"].append({ "type": "axvLine", "x": gData["shock-point"][f"{probe}-g1"][1],#[i], - "label": f"{probe}-Gauge 1 - Shock Point {gData["shock-point"][f"{probe}-g1"][1]:.2f}$\\mu$s", + "label": f"{probe}-Gauge 1 - Shock Point {gData['shock-point'][f'{probe}-g1'][1]:.2f}$\\mu$s", "colour": UQC["purple"].lighten(0.5), "args":{"zorder":2, "linestyle":"--", "alpha":0.5} }) @@ -437,7 +437,7 @@ def genGraph(gData: dict, showPlot: bool = True, doLimits: bool = True, forcePlo graphData["plots"].append({ "type": "axvLine", "x": gData["shock-point"][f"{probe}-g2"][1],#[i], - "label": f"{probe}-Gauge 2 - Shock Point {gData["shock-point"][f"{probe}-g2"][1]:.2f}$\\mu$s", + "label": f"{probe}-Gauge 2 - Shock Point {gData['shock-point'][f'{probe}-g2'][1]:.2f}$\\mu$s", "colour": UQC["purple"].lighten(0.5), "args":{"zorder":2, "linestyle":"--", "alpha":0.5} }) @@ -485,5 +485,4 @@ for shot in loaded_data: # This forces matplotlib to hang until I tell it to close all windows pltKeyClose() -print("Done") - +print("Done") \ No newline at end of file