+ script to plot on ggobi

This commit is contained in:
Caner Candan 2010-08-24 18:40:49 +02:00
commit 799a8f01f3
4 changed files with 71 additions and 3 deletions

View file

@ -25,4 +25,4 @@ FILE(GLOB SOURCES *.cpp)
SET(EXECUTABLE_OUTPUT_PATH ${DO_BINARY_DIR})
ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} do ${EO_LIBRARIES} ${MO_LIBRARIES} ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} do doutils ${EO_LIBRARIES} ${MO_LIBRARIES} ${Boost_LIBRARIES})

View file

@ -0,0 +1,68 @@
#!/usr/bin/env python
from pprint import *
import sys, os
if __name__ == '__main__':
# parameter phase
if len(sys.argv) < 2:
print 'Usage: %s [FILE]' % sys.argv[0]
sys.exit()
filename = sys.argv[1]
lines = open(filename).readlines()
# formatting phase
try:
results = [ x.split() for x in lines[1:-1] ]
except IOError, e:
print 'Error: %s' % e
sys.exit()
# dimension estimating phase
popsize = int(lines[0].split()[0])
dimsize = int(results[0][1])
# printing phase
print 'popsize: %d' % popsize
print 'dimsize: %d' % dimsize
print
pprint( results )
# cvs converting phase
i = 1
for x in results:
x.insert(0, '"%d"' % i)
i += 1
header = ['""', '"fitness"', '"dimsize"']
for i in range(0, dimsize):
header.append( '"dim%d"' % i )
results.insert(0, header)
# cvs printing phase
file_results = '\n'.join( [ ','.join( x ) for x in results ] )
print
print file_results
try:
open('%s.csv' % filename, 'w').write(file_results + '\n')
except IOError, e:
print 'Error: %s' % e
sys.exit()
# ggobi plotting phase
os.system('ggobi %s.csv' % filename)

2
do.pc
View file

@ -8,5 +8,5 @@ includedir=${prefix}/include/do
Name: Distribution Object
Description: Distribution Object
Version: 1.0
Libs: -L${libdir} -ldo
Libs: -L${libdir} -ldo -ldoutils
Cflags: -I${includedir}

View file

@ -62,7 +62,7 @@ doFileSnapshot::doFileSnapshot(std::string dirname,
}
else if (!res && rmFiles)
{
s = std::string("/bin/rm ") + _dirname+ "/" + _filename + "*";
s = std::string("/bin/rm -f ") + _dirname+ "/" + _filename + "*";
}
else
{