Compare commits
2 Commits
89b7f045a4
...
ff69c329cc
Author | SHA1 | Date | |
---|---|---|---|
ff69c329cc | |||
d0accd6e0b |
@ -1 +1 @@
|
||||
2.0.6
|
||||
2.0.7
|
||||
|
@ -1,24 +1,43 @@
|
||||
|
||||
import IMCtermite
|
||||
import pandas
|
||||
import datetime
|
||||
|
||||
def add_trigger_time(trigger_time, add_time) :
|
||||
trgts = datetime.datetime.strptime(trigger_time,'%Y-%m-%dT%H:%M:%S')
|
||||
dt = datetime.timedelta(seconds=add_time)
|
||||
return (trgts + dt).strftime('%Y-%m-%dT%H:%M:%S:%f')
|
||||
|
||||
if __name__ == "__main__" :
|
||||
|
||||
# read file and extract data
|
||||
imctm = IMCtermite.imctermite(b"Measurement.raw")
|
||||
|
||||
chns = imctm.get_channels(True)
|
||||
|
||||
df = pandas.DataFrame()
|
||||
|
||||
# prepare abscissa
|
||||
xcol = "time ["+chns[0]['xunit']+"]"
|
||||
df[xcol] = pandas.Series(chns[0]['xdata'])
|
||||
#xcol = "timestamp"
|
||||
xsts = [add_trigger_time(chns[0]['trigger-time'],tm) for tm in chns[0]['xdata']]
|
||||
|
||||
for idx,chn in enumerate(chns) :
|
||||
# sort channels
|
||||
chnnms = sorted([chn['name'] for chn in chns], reverse=False)
|
||||
chnsdict = {}
|
||||
for chn in chns :
|
||||
chnsdict[chn['name']] = chn
|
||||
|
||||
# construct dataframe
|
||||
df = pandas.DataFrame()
|
||||
df[xcol] = pandas.Series(chns[0]['xdata'])
|
||||
#df[xcol] = pandas.Series(xsts)
|
||||
#for idx,chn in enumerate(chns) :
|
||||
for chnnm in chnnms :
|
||||
chn = chnsdict[chnnm]
|
||||
#xcol = (chn['xname'] if chn['xname'] != '' else "x_"+str(idx))+" ["+chn['xunit']+"]"
|
||||
#df[xcol] = pandas.Series(chn['xdata'])
|
||||
ycol = chn['yname']+" ["+chn['yunit']+"]"
|
||||
df[ycol] = pandas.Series(chn['ydata'])
|
||||
|
||||
# show entire dataframe and write file
|
||||
print(df)
|
||||
df.to_csv("Measurement.csv",header=True,sep='\t',index=False)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user