-
Notifications
You must be signed in to change notification settings - Fork 0
/
BT_timingtest.py
101 lines (82 loc) · 2.51 KB
/
BT_timingtest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 19 15:08:38 2017
@author: AICPS
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 18 17:26:42 2017
@author: AICPS
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 18 17:10:23 2017
@author: AICPS
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 18 16:17:54 2017
@author: Sujit R. Chhetri
"""
from nptdms import TdmsFile
import numpy as np
import os
originTDMSFolder = 'D:/GDrive/DT_Data/DAQ_Auto';
destinationCSVFolder = 'D:/GDrive/DT_Data/DAQ_Auto_TDMStoCSV';
tdmsFolderName = 'UM3_Corner_Wall_'+str(200)+'p';
channelNames=['Mic_1',
'Mic_2',
'Mic_3',
'Mic_4',
'Current',
'Vib_x2',
'Vib_y2',
'Vib_z2',
'Vib_x1',
'Vib_y1',
'Vib_z1',
'Vib_x0',
'Vib_y0',
'Vib_z0',
'Temperature',
'Humidity',
'Mag_x0',
'Mag_y0',
'Mag_z0',
'Mag_x1',
'Mag_y1',
'Mag_z1',
'Mag_x2',
'Mag_y2',
'Mag_z2' ];
#def tdms2csvTimingMetaData(tdmsFolderName):
tdmsFiles=[]
tdmsFolderNameFull=originTDMSFolder+'/'+tdmsFolderName;
if not os.path.exists(tdmsFolderNameFull):
exit()
for file in os.listdir(tdmsFolderNameFull):
if file.endswith(".tdms"):
tdmsFiles+= [file]
#%% Check if the destination foldername exists
destinationFolderName=destinationCSVFolder+'/'+tdmsFolderName;
if not os.path.exists(destinationFolderName):
os.makedirs(destinationFolderName)
#%%
directoryIndex=1;
for file in tdmsFiles:
print(file)
tdms_file = TdmsFile(tdmsFolderNameFull+'/'+file)
directory=destinationCSVFolder+'/'+tdmsFolderName+'/data_'+str(directoryIndex);
directoryIndex+=1;
if not os.path.exists(directory):
os.makedirs(directory)
for channelName in channelNames:
channel = tdms_file.object('data',channelName)
startTime=channel.property('wf_start_time')
samplingIncrement=channel.property('wf_increment')
#np.savetxt(directory+'/timingMetaData.csv', [startTime.hour,startTime.minute,startTime.second,startTime.microsecond, samplingIncrement], delimiter=',')
#def main():
# tdms2csvTimingMetaData(tdmsFolderName)
#
#if __name__ == '__main__':
# main()