# Cal Wing # Sep 2024 from nptdms import TdmsFile from makeGraph import makeGraph, pltKeyClose, UQ_COLOURS as UQC # Photo Diode Things SHOT_PD = "x2s4111" # PCB Things SHOT_PCB_1 = "x2s3667" SHOT_PCB_2 = "x2s3668" # Shot DATA FILE DATA_FILE_FMT = './data/{0}/databox/{0}.tdms' def main(): graphData = { "plots": [] } for df in [SHOT_PD, SHOT_PCB_1, SHOT_PCB_2]: file_path = DATA_FILE_FMT.format(df) data = TdmsFile.read(file_path) channels = data.groups()[0].channels() for channel in channels: if df is SHOT_PD and channel.name == "st2": graphData["plots"].append({ "x": channels[0][:] - channels[0][0], "y": channel[:], "label": f"{df} - PD - st2" }) #if df is SHOT_PD and channel.name == "photodiode": # graphData["plots"].append({ # "x": channels[0][:] - channels[0][0], # "y": channel[:], # "label": f"{df} - PD - photodiode" # }) if df is not SHOT_PD and channel.name == "st2": graphData["plots"].append({ "x": channels[0][:] - channels[0][0], "y": channel[:] * 0.0148 * 10, "label": f"{df} - PCB" }) makeGraph(graphData, showPlot=True, doProgramBlock=True) if __name__ == '__main__': main() #pltKeyClose()