-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdata_clean_v1.py
31 lines (26 loc) · 1 KB
/
data_clean_v1.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
import glob
import collections
for folder in glob.glob('metadata/*/'):
#print(folder)
folderID = folder.split('/')[1]
folderID = folderID.lstrip('0')
folderID = int(folderID)
print("FILE ID: " + str(folderID))
for file in glob.glob(folder + '/bothchroma.csv'):
with open(file) as chromaFile:
values = collections.OrderedDict()
strChromaFile = str(chromaFile.read())
# try:
# strFile = strFile.split('silence')[1]
# except IndexError:
# print("No Silence found")
strChromaFile = strChromaFile.split('\n')
#print (strChromaFile)
for line in strChromaFile:
if line != '':
vals = line.split(',')
timestamp = float(vals[1])
chromaVals = vals[2:]
chromaVals = list(map(float, chromaVals))
values[timestamp] = chromaVals
chromaFiles[folderID] = values