diff --git a/test-data/histogram_in1.tabular b/test-data/histogram_in1.tabular
new file mode 100644
index 00000000000..c1e73a28a26
--- /dev/null
+++ b/test-data/histogram_in1.tabular
@@ -0,0 +1,10 @@
+1 68 4.1
+2 71 4.6
+3 62 3.8
+4 75 4.4
+5 58 3.2
+6 60 3.1
+7 67 3.8
+8 68 4.1
+9 71 4.3
+10 69 3.7
diff --git a/test/base/twilltestcase.py b/test/base/twilltestcase.py
index 3bbeafc2afb..fc1bc6d775e 100644
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -47,6 +47,14 @@ class TwillTestCase( unittest.TestCase ):
if files_differ:
diff = difflib.unified_diff( local_file, history_data, "local_file", "history_data" )
diff_slice = list( islice( diff, 40 ) )
+ if file1.endswith( '.pdf' ) or file2.endswith( 'pdf' ):
+ # PDF files contain both a creation and modification date, so we need to
+ # handle these differences. As long as the rest of the PDF file does not differ,
+ # we're ok.
+ if len( diff_slice ) == 13 and \
+ diff_slice[6].startswith( '-/CreationDate' ) and diff_slice[7].startswith( '-/ModDate' ) \
+ and diff_slice[8].startswith( '+/CreationDate' ) and diff_slice[9].startswith( '+/ModDate' ):
+ return True
raise AssertionError( "".join( diff_slice ) )
return True
@@ -300,6 +308,7 @@ class TwillTestCase( unittest.TestCase ):
try:
self.files_diff( local_name, temp_name )
except AssertionError, err:
+ os.remove(temp_name)
errmsg = 'History item %s different than expected, difference:\n' % hid
errmsg += str( err )
raise AssertionError( errmsg )
diff --git a/tools/plotting/histogram.py b/tools/plotting/histogram.py
index dc46eee930a..a4676f41699 100644
--- a/tools/plotting/histogram.py
+++ b/tools/plotting/histogram.py
@@ -22,8 +22,10 @@ def main():
title = sys.argv[4]
xlab = sys.argv[5]
breaks = int( sys.argv[6] )
- if breaks == 0: breaks = "Sturges"
- if sys.argv[7] == "true": density = True
+ if breaks == 0:
+ breaks = "Sturges"
+ if sys.argv[7] == "true":
+ density = True
else: density = False
matrix = []
@@ -76,12 +78,12 @@ def main():
r.dev_off()
except Exception, exc:
stop_err( "%s" %str( exc ) )
- print "..on columnn %s" %sys.argv[3]
else:
- print "..all values in column %s are non-numeric." %sys.argv[3]
+ stop_err( "All values in column %s are non-numeric." %sys.argv[3] )
+ print "Histogram of column %s. " %sys.argv[3]
if skipped_lines > 0:
- print "..skipped %d invalid lines starting with line #%d containing value '%s'." % ( skipped_lines, first_invalid_line, invalid_value )
+ print "Skipped %d invalid lines starting with line #%d, '%s'." % ( skipped_lines, first_invalid_line, invalid_value )
r.quit( save="no" )
diff --git a/tools/plotting/histogram2.xml b/tools/plotting/histogram2.xml
index e6bc79f2b82..1b4529a5cb6 100644
--- a/tools/plotting/histogram2.xml
+++ b/tools/plotting/histogram2.xml
@@ -12,6 +12,17 @@
+
+
+
+
+
+
+
+
+
+
+
.. class:: infomark
diff --git a/tools/plotting/scatterplot.py b/tools/plotting/scatterplot.py
index ec909c01c8e..05da6fbd1b8 100644
--- a/tools/plotting/scatterplot.py
+++ b/tools/plotting/scatterplot.py
@@ -15,7 +15,7 @@ def main():
try:
columns = int( sys.argv[3] ) - 1, int( sys.argv[4] ) - 1
except:
- stop_err( "..Columns not specified, your query does not contain a column of numerical data." )
+ stop_err( "Columns not specified, your query does not contain a column of numerical data." )
title = sys.argv[5]
xlab = sys.argv[6]
ylab = sys.argv[7]
@@ -26,31 +26,27 @@ def main():
invalid_value = ''
invalid_column = 0
- for i, line in enumerate( file ( sys.argv[1] ) ):
+ for i, line in enumerate( file( in_fname ) ):
valid = True
- line = line.rstrip('\r\n')
+ line = line.rstrip( '\r\n' )
if line and not line.startswith( '#' ):
- # Extract values and convert to floats
row = []
+ fields = line.split( "\t" )
for column in columns:
- if not valid:
- break
- fields = line.split( "\t" )
- if len( fields ) <= column:
- stop_err( "Column %d on line %d missing, line: %s" % ( column+1, i, line ) )
- val = fields[column]
- if val.lower() == "na":
- row.append( float( "nan" ) )
- else:
- try:
+ try:
+ val = fields[column]
+ if val.lower() == "na":
+ row.append( float( "nan" ) )
+ else:
row.append( float( fields[column] ) )
- except:
- valid = False
- skipped_lines += 1
- if not first_invalid_line:
- first_invalid_line = i+1
- invalid_value = fields[column]
- invalid_column = column+1
+ except:
+ valid = False
+ skipped_lines += 1
+ if not first_invalid_line:
+ first_invalid_line = i + 1
+ invalid_value = fields[column]
+ invalid_column = column + 1
+ break
else:
valid = False
skipped_lines += 1
@@ -59,19 +55,20 @@ def main():
if valid:
matrix.append( row )
-
- r.pdf( out_fname, 8, 8 )
- r.plot( array( matrix ), type="p", main=title, xlab=xlab, ylab=ylab, col="blue", pch=19 )
- r.dev_off()
- msg = "--Scatter plot on "
- for i,col in enumerate(columns):
- col += 1
- msg += "c%d, " %col
+ if skipped_lines < i:
+ try:
+ r.pdf( out_fname, 8, 8 )
+ r.plot( array( matrix ), type="p", main=title, xlab=xlab, ylab=ylab, col="blue", pch=19 )
+ r.dev_off()
+ except Exception, exc:
+ stop_err( "%s" %str( exc ) )
+ else:
+ stop_err( "All values in both columns %s and %s are non-numeric." % ( sys.argv[3], sys.argv[4] ) )
+
+ print "Scatter plot on columns %s, %s. " % ( sys.argv[3], sys.argv[4] )
if skipped_lines > 0:
- msg += " skipped %d lines starting with line #%d. Value '%s' in column %d is not numeric." % ( skipped_lines, first_invalid_line, invalid_value, invalid_column )
-
- print msg
+ print "Skipped %d lines starting with line #%d, value '%s' in column %d is not numeric." % ( skipped_lines, first_invalid_line, invalid_value, invalid_column )
r.quit( save="no" )
diff --git a/tools/plotting/scatterplot.xml b/tools/plotting/scatterplot.xml
index b67c7057026..285cc0b73e6 100644
--- a/tools/plotting/scatterplot.xml
+++ b/tools/plotting/scatterplot.xml
@@ -12,6 +12,20 @@
+
.. class:: infomark