forked from RecordEvolution/IMCtermite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusage.py
More file actions
38 lines (29 loc) · 1.08 KB
/
Copy pathusage.py
File metadata and controls
38 lines (29 loc) · 1.08 KB
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
import imctermite
import json
import os
# declare and initialize instance of "imctermite" by passing a raw-file
try :
imcraw = imctermite.ImcTermite("samples/exampleB.raw")
except RuntimeError as e :
raise Exception("failed to load/parse raw-file: " + str(e))
# obtain list of channels as list of dictionaries (without data)
channels = imcraw.get_channels(False)
print(json.dumps(channels,indent=4, sort_keys=False))
# obtain data of first channel (with data)
channelsdata = imcraw.get_channels(True)
if len(channelsdata) > 0 :
chnydata = channelsdata[0]['ydata']
chnxdata = channelsdata[0]['xdata']
print(len(chnydata))
print(len(chnxdata))
print()
# print the channels into a specific directory
imcraw.print_channels("/tmp/",ord(','))
# print all channels separately
for i,chn in enumerate(channels) :
print(str(i)+" : "+chn['name']+" : "+chn['uuid'])
filname = os.path.join("/tmp/",str(i) + "_" + chn['name']+".csv")
print(filname)
imcraw.print_channel(chn['uuid'],filname,ord(','))
# print all channels in single file
imcraw.print_table("/tmp/allchannels.csv")