From c4b0dd1fefb511dd11b3814ad5afabae6aadfe56 Mon Sep 17 00:00:00 2001 From: Cal Wing <20716204+calw20@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:05:22 +1000 Subject: [PATCH] quick refactor and addition of README --- README.md | 19 ++++++++++++++ main.py | 74 +++++++++++++++++++++++++++---------------------------- 2 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..288cf76 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Ionization Probe Analysis Code + +> Written by Cal Wing (c.wing@uq.net.au - 45811953) in 2024 for his Thesis + +## Installation + +Run `pip install -r requirements.txt` or equivilient for your envoroment. + +## Running + +Run `main.py` it will then generate all the output graphs and put them in (a git untracked) folder called `./images`. + +By default all data graphs will be generated - you need to change the functions called at the end + +## `./data` Explanation + +I like YAML files to store information. All the data shot folders have a file call `_info.yaml` this file contained all the info about the shot so that when it would load & be graphed it would be correct. + +I hope the values are self explanatory but they may not - sorry. diff --git a/main.py b/main.py index 9d65dc9..26f70f5 100644 --- a/main.py +++ b/main.py @@ -29,22 +29,6 @@ CANNY_TIME_OFFSET = 50 #us with open(TUNNEL_INFO_FILE, 'r') as file: TUNNEL_INFO = yaml.safe_load(file) -data_to_load = [ - "x2s5823", - "x2s5824", - "x2s5827", - "x2s5829", - "x2s5830", - "x2s5831", - "x2s5832" -] - -ref_data_to_load = [ - "x2s5820", - "x2s5821", - "x2s5822" -] - # ==== Uncerts ==== # Taken from DOI: 10.1007/s00193-017-0763-3 (Implementation of a state-to-state analytical framework for the calculation of expansion tube flow properties) @@ -1134,34 +1118,50 @@ for refShot in ref_data_to_load: print("Loaded Data") +if __name__ == "__main__": + data_to_load = [ + "x2s5823", + "x2s5824", + "x2s5827", + "x2s5829", + "x2s5830", + "x2s5831", + "x2s5832" + ] -print("Graphing Data") + ref_data_to_load = [ + "x2s5820", + "x2s5821", + "x2s5822" + ] -# General Shot Graphing -for shot in loaded_data: - #print(data[shot]['info']['long_name'].rsplit("\n", 1)[-1]) - genGraph(data[shot], showPlot=False, addShockInfo=False) - genGraph(data[shot], showPlot=False, forcePlots=True) + print("Graphing Data") -combo_data = data.copy() -combo_data.pop(loaded_data[-2]) -combo_data.pop(loaded_data[-1]) + # General Shot Graphing + for shot in loaded_data: + #print(data[shot]['info']['long_name'].rsplit("\n", 1)[-1]) + genGraph(data[shot], showPlot=False, addShockInfo=False) + genGraph(data[shot], showPlot=False, forcePlots=True) -genComboDataGraph(combo_data, doShockLabels=True) + combo_data = data.copy() + combo_data.pop(loaded_data[-2]) + combo_data.pop(loaded_data[-1]) + + genComboDataGraph(combo_data, doShockLabels=True) -genX2CompGraphs(data["x2s5831"], showPlot=False) -genX2CompGraphs(data["x2s5832"], showPlot=False) + genX2CompGraphs(data["x2s5831"], showPlot=False) + genX2CompGraphs(data["x2s5832"], showPlot=False) -# Reference Data -for shot in ref_data: - genRefGraph(ref_data[shot], showPlot=False, addShockInfo=False) - genRefGraph(ref_data[shot], showPlot=False, forcePlots=True) + # Reference Data + for shot in ref_data: + genRefGraph(ref_data[shot], showPlot=False, addShockInfo=False) + genRefGraph(ref_data[shot], showPlot=False, forcePlots=True) -genComboRefGraph(ref_data, doShockLabels=True) -genComboRefGraph(ref_data, ref_data[ref_data_to_load[0]]["info"]["pcb-refs"], addShockInfo=True) + genComboRefGraph(ref_data, doShockLabels=True) + genComboRefGraph(ref_data, ref_data[ref_data_to_load[0]]["info"]["pcb-refs"], addShockInfo=True) -# This forces matplotlib to hang until I tell it to close all windows -pltKeyClose() -print("Done") \ No newline at end of file + # This forces matplotlib to hang until I tell it to close all windows + pltKeyClose() + print("Done") \ No newline at end of file