Hi Jorge,
Nice script.
You could actually change the build/bin/doPlot
script to do the conversion instead/or together
with plotting.
Cheers,
Adrian Pop/
Jorge Cardona wrote:
Well, i already got the first one:
#!/usr/bin/python
from sys import argv
FILENAME = argv[1]
fd = open(FILENAME)
data = fd.read().split("\n")[:-1]
fd.close()
buffer = [[]]
c = -1
for d in data:
if len(d) < 1:
continue
if d[0] == "#":
continue
res = d.split(":")
if (len(res) == 2) and (res[0] =="DataSet"):
#Start a new vble.
buffer[0].append(res[1])
c += 1
i = 0
continue
res = d.split(",")
if len(res) == 2:
i+=1
if c == 0:
#First Vble.
buffer.append([])
buffer[i].append(res[1])
else:
buffer[i].append(res[1])
print "\n".join(map(" , ".join,buffer))
you just have to pass the name of the result with ptplot format, and
it print the csv file, at debian use it like this:
$ ./script.py /home/jcardona/SandBox_res.plt > file.csv
i will check the code that generate the ptplot file.
Thanks.
2008/12/9 Adrian Pop <[EMAIL PROTECTED]>:
Hi Jorge,
Well, the file returned is text in ptplot format
and you could probably build your own tool to
transform it into .csv in no time.
Alternatively, you could change the file:
c_runtime/simulation_result.cpp function
deinitializeResult to dump directly .cvs
or to dump also .cvs together with .plt
Cheers,
Adrian Pop/
Jorge Cardona wrote:
Greetings.
Is there any way that openmodelica returns the results in csv format???
Thanks.