Compare commits
No commits in common. "ff69c329ccc45c2f7ad5944f24f76573460d98cf" and "89b7f045a4ac304cedf39a72a86cc913df11515b" have entirely different histories.
ff69c329cc
...
89b7f045a4
@ -1 +1 @@
|
|||||||
2.0.7
|
2.0.6
|
||||||
|
@ -1,43 +1,24 @@
|
|||||||
|
|
||||||
import IMCtermite
|
import IMCtermite
|
||||||
import pandas
|
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__" :
|
if __name__ == "__main__" :
|
||||||
|
|
||||||
# read file and extract data
|
|
||||||
imctm = IMCtermite.imctermite(b"Measurement.raw")
|
imctm = IMCtermite.imctermite(b"Measurement.raw")
|
||||||
|
|
||||||
chns = imctm.get_channels(True)
|
chns = imctm.get_channels(True)
|
||||||
|
|
||||||
# prepare abscissa
|
|
||||||
xcol = "time ["+chns[0]['xunit']+"]"
|
|
||||||
#xcol = "timestamp"
|
|
||||||
xsts = [add_trigger_time(chns[0]['trigger-time'],tm) for tm in chns[0]['xdata']]
|
|
||||||
|
|
||||||
# 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 = pandas.DataFrame()
|
||||||
|
|
||||||
|
xcol = "time ["+chns[0]['xunit']+"]"
|
||||||
df[xcol] = pandas.Series(chns[0]['xdata'])
|
df[xcol] = pandas.Series(chns[0]['xdata'])
|
||||||
#df[xcol] = pandas.Series(xsts)
|
|
||||||
#for idx,chn in enumerate(chns) :
|
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']+"]"
|
#xcol = (chn['xname'] if chn['xname'] != '' else "x_"+str(idx))+" ["+chn['xunit']+"]"
|
||||||
#df[xcol] = pandas.Series(chn['xdata'])
|
#df[xcol] = pandas.Series(chn['xdata'])
|
||||||
ycol = chn['yname']+" ["+chn['yunit']+"]"
|
ycol = chn['yname']+" ["+chn['yunit']+"]"
|
||||||
df[ycol] = pandas.Series(chn['ydata'])
|
df[ycol] = pandas.Series(chn['ydata'])
|
||||||
|
|
||||||
# show entire dataframe and write file
|
|
||||||
print(df)
|
print(df)
|
||||||
df.to_csv("Measurement.csv",header=True,sep='\t',index=False)
|
df.to_csv("Measurement.csv",header=True,sep='\t',index=False)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user