From 8e344b7ee07aefb08f414fd812020e9ba6bdb269 Mon Sep 17 00:00:00 2001 From: Cal Wing <20716204+calw20@users.noreply.github.com> Date: Mon, 30 Sep 2024 19:30:28 +1000 Subject: [PATCH] Just do st2 for data --- main.py | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index f92ec17..9f7ac1b 100644 --- a/main.py +++ b/main.py @@ -1,32 +1,39 @@ # Cal Wing # Sep 2024 +import os + import numpy as np from nptdms import TdmsFile - from makeGraph import makeGraph, pltKeyClose, UQ_COLOURS as UQC +# Folder correction +# Make sure the relevant folders folder exists +folders = ["./images"] +for folder in folders: + if not os.path.isdir(folder): os.mkdir(folder) + # Photo Diode Things -SHOT_PD = "x2s4111", 1, "PD", np.timedelta64(1146, 'us') #np.timedelta64(1146800, 'ns') +SHOT_PD = "x2s4111", 1, "PD", np.timedelta64(1146800, 'ns') # PCB Things -SHOT_PCB_1 = "x2s3667", 0.0148 * 1000, "PCB", np.timedelta64(1643, 'us') -SHOT_PCB_2 = "x2s3668", 0.0148 * 1000, "PCB", np.timedelta64(1648600, 'ns') +SHOT_PCB_1 = "x2s3667", 0.0148 * 1000, "PCB", np.timedelta64(1643, 'us') # st1 - np.timedelta64(1608, 'us') +SHOT_PCB_2 = "x2s3668", 0.0148 * 1000, "PCB", np.timedelta64(1648600, 'ns') # st1 - np.timedelta64(1614, 'us') # Shot DATA FILE DATA_FILE_FMT = './data/{0}/databox/{0}.tdms' -TIME_OFFSET = np.timedelta64(-10, 'us'), np.timedelta64(15, 'us') # us +TIME_OFFSET = np.timedelta64(-22, 'us'), np.timedelta64(33, 'us') # us def main(): graphData = { - "title": "Shock response time of PCBs", + "title": "Shock response time of PCBs\nAt position st2", "xLabel": "Time ($\\mu$s)", "yLabel": "PCB Voltage Reading (mV)", "grid": True, - "xLim": (-10, 15), + "xLim": (-20, 20), "plots": [] } @@ -72,9 +79,21 @@ def main(): "y": channel[:] * scale, "label": f"{df} - {name}" }) - + + graphData['plots'].append( + { + "x":0, + "type":"axvLine", + #"label":"Shock", + "color": UQC["dark_grey"], + "args": { + "linestyle": "--", + "zorder": -2 + } + } + ) - makeGraph(graphData, showPlot=True, doProgramBlock=True) + makeGraph(graphData, figSavePath="./images/{0}.png", showPlot=False, doProgramBlock=False)