Just do st2 for data

This commit is contained in:
Cal Wing 2024-09-30 19:30:28 +10:00
parent 504d8b3f6a
commit 8e344b7ee0

37
main.py
View File

@ -1,32 +1,39 @@
# Cal Wing # Cal Wing
# Sep 2024 # Sep 2024
import os
import numpy as np import numpy as np
from nptdms import TdmsFile from nptdms import TdmsFile
from makeGraph import makeGraph, pltKeyClose, UQ_COLOURS as UQC 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 # 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 # PCB Things
SHOT_PCB_1 = "x2s3667", 0.0148 * 1000, "PCB", np.timedelta64(1643, 'us') 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') SHOT_PCB_2 = "x2s3668", 0.0148 * 1000, "PCB", np.timedelta64(1648600, 'ns') # st1 - np.timedelta64(1614, 'us')
# Shot DATA FILE # Shot DATA FILE
DATA_FILE_FMT = './data/{0}/databox/{0}.tdms' 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(): def main():
graphData = { graphData = {
"title": "Shock response time of PCBs", "title": "Shock response time of PCBs\nAt position st2",
"xLabel": "Time ($\\mu$s)", "xLabel": "Time ($\\mu$s)",
"yLabel": "PCB Voltage Reading (mV)", "yLabel": "PCB Voltage Reading (mV)",
"grid": True, "grid": True,
"xLim": (-10, 15), "xLim": (-20, 20),
"plots": [] "plots": []
} }
@ -72,9 +79,21 @@ def main():
"y": channel[:] * scale, "y": channel[:] * scale,
"label": f"{df} - {name}" "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)