timeStamp_mon_bg_orig = tdms_file_bg.object("Monitoring Vals", "t-stamp").data[win_start:-win_end] """Find boarders to clip data files to the common time stamps""" timeStamp_start = max(timeStamp_fit_626_orig[0], timeStamp_fit_636_orig[0], timeStamp_fit_bg_orig[0]) timeStamp_end = min(timeStamp_fit_626_orig[-1], timeStamp_fit_636_orig[-1], timeStamp_fit_bg_orig[-1]) ind_626 = [timeStamp_fit_626_orig.index(timeStamp_start)] ind_626.append(timeStamp_fit_626_orig.index(timeStamp_end)) ind_636 = [timeStamp_fit_636_orig.index(timeStamp_start)] ind_636.append(timeStamp_fit_636_orig.index(timeStamp_end)) ind_bg = [timeStamp_fit_bg_orig.index(timeStamp_start)] ind_bg.append(timeStamp_fit_bg_orig.index(timeStamp_end)) """Transform TimeStamp into seconds after start""" timeStamp_fit_626 = tdmsProcFuncs.TimeStampTransform( timeStamp_fit_626_orig[ind_626[0]:ind_626[1]]) timeStamp_mon_626 = tdmsProcFuncs.TimeStampTransform( timeStamp_mon_626_orig[ind_626[0]:ind_626[1]]) timeStamp_fit_636 = tdmsProcFuncs.TimeStampTransform( timeStamp_fit_636_orig[ind_636[0]:ind_636[1]]) timeStamp_mon_636 = tdmsProcFuncs.TimeStampTransform( timeStamp_mon_636_orig[ind_636[0]:ind_636[1]]) timeStamp_fit_bg = tdmsProcFuncs.TimeStampTransform( timeStamp_fit_bg_orig[ind_bg[0]:ind_bg[1]]) timeStamp_mon_bg = tdmsProcFuncs.TimeStampTransform( timeStamp_mon_bg_orig[ind_bg[0]:ind_bg[1]]) """Check if time stamp of Monitoring Vals and Fit Results fit""" if len(timeStamp_fit_626) != len(timeStamp_mon_626): warnings.warn('Time stamp of monitoring and fit values not same length!') else: if not np.allclose(timeStamp_fit_626, timeStamp_mon_626, atol=1, rtol=0):
ind_end = -1 """ Main Program """ """load file if not yet loaded and make a safety copy.""" if 'tdms_file_path' not in globals() or tdms_file_path_new != tdms_file_path: tdms_file_path = tdms_file_path_new tdms_file = tdmsProcFuncs.readtdmsfile(tdms_file_path) tdms_file_mon = copy.deepcopy(tdms_file) """find group and channel names (i.e. "Fit Results" and "Line 1Amplitude, respectively) via tdms_file.objects. Then access them as follows""" """Time Stamp""" timeStamp_mon_orig = tdms_file.object("Monitoring Values", "t-stamp").data #timeStamp_fit_orig = tdms_file.object("Fit Results" , "t-stamp").data """Transform TimeStamp into seconds after start""" timeStamp_mon = tdmsProcFuncs.TimeStampTransform(timeStamp_mon_orig) #timeStamp_fit = tdmsProcFuncs.TimeStampTransform(timeStamp_fit_orig) """Unpack parameter values and transform to temperature where necessary""" parvalues = [] for x in range(len(parlist)): parvalues.append( tdms_file.object("Monitoring Values", *parlist[x][0]).data) if parlist[x][1] == [True]: parvalues[x] = tdmsProcFuncs.VoltsToTempConvert(parvalues[x]) y = parvalues[par_ind][ind_start:ind_end] time = timeStamp_mon[ind_start:ind_end] zerofilling = 0 apodisation = 0 title_ps = 'powerspectrum' yl_lab_ps = 'signal anomaly'
timeStamp_end = min(timeStamp_fit_CH4_orig[-1], timeStamp_fit_N2O_orig[-1], timeStamp_fit_626_orig[-1], timeStamp_fit_636_orig[-1], timeStamp_fit_bg_orig[-1]) ind_CH4 = [timeStamp_fit_CH4_orig.index(timeStamp_start)] ind_CH4.append(timeStamp_fit_CH4_orig.index(timeStamp_end)) ind_N2O = [timeStamp_fit_N2O_orig.index(timeStamp_start)] ind_N2O.append(timeStamp_fit_N2O_orig.index(timeStamp_end)) ind_626 = [timeStamp_fit_626_orig.index(timeStamp_start)] ind_626.append(timeStamp_fit_626_orig.index(timeStamp_end)) ind_636 = [timeStamp_fit_636_orig.index(timeStamp_start)] ind_636.append(timeStamp_fit_636_orig.index(timeStamp_end)) ind_bg = [timeStamp_fit_bg_orig.index(timeStamp_start)] ind_bg.append(timeStamp_fit_bg_orig.index(timeStamp_end)) """Transform TimeStamp into seconds after start""" timeStamp_fit_CH4 = tdmsProcFuncs.TimeStampTransform( timeStamp_fit_CH4_orig[ind_CH4[0]:ind_CH4[1]]) timeStamp_mon_CH4 = tdmsProcFuncs.TimeStampTransform( timeStamp_mon_CH4_orig[ind_CH4[0]:ind_CH4[1]]) timeStamp_fit_N2O = tdmsProcFuncs.TimeStampTransform( timeStamp_fit_N2O_orig[ind_N2O[0]:ind_N2O[1]]) timeStamp_mon_N2O = tdmsProcFuncs.TimeStampTransform( timeStamp_mon_N2O_orig[ind_N2O[0]:ind_N2O[1]]) timeStamp_fit_626 = tdmsProcFuncs.TimeStampTransform( timeStamp_fit_626_orig[ind_626[0]:ind_626[1]]) timeStamp_mon_626 = tdmsProcFuncs.TimeStampTransform( timeStamp_mon_626_orig[ind_626[0]:ind_626[1]]) timeStamp_fit_636 = tdmsProcFuncs.TimeStampTransform( timeStamp_fit_636_orig[ind_636[0]:ind_636[1]]) timeStamp_mon_636 = tdmsProcFuncs.TimeStampTransform( timeStamp_mon_636_orig[ind_636[0]:ind_636[1]]) timeStamp_fit_bg = tdmsProcFuncs.TimeStampTransform(