Although

http://trac.sagemath.org/sage_trac/ticket/5906

was supposed to eliminate this problem for good, sometimes random
(i.e. spring-layout) algorithms seem to trigger it, in particular when
a short path happens to get put into a straight vertical or horizontal
line. What surprises me is that it is not reproducible, even though
the doctesting framework is supposed to not be random in these types
of cases. When I ran doctests in parallel on a somewhat loaded
machine, I saw

{{{
sage -t -long sage/graphs/graph_plot.py
libpng error: Image width or height is zero in IHDR
libpng error: Image width or height is zero in IHDR
**********************************************************************
File "/scratch/rlmill/sage-4.5.rc1/devel/sage-main/sage/graphs/graph_plot.py",
line 267:
    sage: GP.plot()
Exception raised:
    Traceback (most recent call last):
      File "/scratch/rlmill/sage-4.5.rc1/local/bin/ncadoctest.py",
line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/rlmill/sage-4.5.rc1/local/bin/sagedoctest.py",
line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example,
filename, compileflags)
      File "/scratch/rlmill/sage-4.5.rc1/local/bin/ncadoctest.py",
line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_4[13]>", line 1, in <module>
        GP.plot()###line 267:
    sage: GP.plot()
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/sage/misc/displayhook.py",
line 174, in displayhook
        print_obj(sys.stdout, obj)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/sage/misc/displayhook.py",
line 142, in print_obj
        print >>out_stream, `obj`
      File "sage_object.pyx", line 101, in
sage.structure.sage_object.SageObject.__repr__
(sage/structure/sage_object.c:1370)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/sage/plot/plot.py",
line 915, in _repr_
        self.show()
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/sage/plot/plot.py",
line 1437, in show
        self.save(DOCTEST_MODE_FILE, **options)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/sage/plot/plot.py",
line 1973, in save
        figure.savefig(filename,dpi=dpi,bbox_inches='tight',**options)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/matplotlib/figure.py",
line 1032, in savefig
        self.canvas.print_figure(*args, **kwargs)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/matplotlib/backend_bases.py",
line 1455, in print_figure
        **kwargs)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/matplotlib/backends/backend_agg.py",
line 366, in print_png
        filename_or_obj, self.figure.dpi)
    RuntimeError: Error building image
**********************************************************************
File "/scratch/rlmill/sage-4.5.rc1/devel/sage-main/sage/graphs/graph_plot.py",
line 269:
    sage: GP.plot()
Exception raised:
    Traceback (most recent call last):
      File "/scratch/rlmill/sage-4.5.rc1/local/bin/ncadoctest.py",
line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/rlmill/sage-4.5.rc1/local/bin/sagedoctest.py",
line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example,
filename, compileflags)
      File "/scratch/rlmill/sage-4.5.rc1/local/bin/ncadoctest.py",
line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_4[15]>", line 1, in <module>
        GP.plot()###line 269:
    sage: GP.plot()
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/sage/misc/displayhook.py",
line 174, in displayhook
        print_obj(sys.stdout, obj)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/sage/misc/displayhook.py",
line 142, in print_obj
        print >>out_stream, `obj`
      File "sage_object.pyx", line 101, in
sage.structure.sage_object.SageObject.__repr__
(sage/structure/sage_object.c:1370)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/sage/plot/plot.py",
line 915, in _repr_
        self.show()
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/sage/plot/plot.py",
line 1437, in show
        self.save(DOCTEST_MODE_FILE, **options)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/sage/plot/plot.py",
line 1973, in save
        figure.savefig(filename,dpi=dpi,bbox_inches='tight',**options)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/matplotlib/figure.py",
line 1032, in savefig
        self.canvas.print_figure(*args, **kwargs)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/matplotlib/backend_bases.py",
line 1455, in print_figure
        **kwargs)
      File 
"/scratch/rlmill/sage-4.5.rc1/local/lib/python/site-packages/matplotlib/backends/backend_agg.py",
line 366, in print_png
        filename_or_obj, self.figure.dpi)
    RuntimeError: Error building image
**********************************************************************
}}}

Fortunately when I try it twenty times, it is triggered again:
{{{
rlm...@geom:/scratch/rlmill/sage-4.5.rc1/devel/sage-main$ for i in `seq 1 20`;
> do
>     ../../sage -t sage/graphs/graph_plot.py
> done
}}}

So at least it is somewhat reproducible. It seems as though the fix at
#5906 doesn't always work.

Either {{{ if xmax - xmin < 0.00000001: }}} has too many zeros to
catch all the relevant cases, or the adjustments following aren't
being saved in some cases...

I'm hoping someone has some ideas for a better fix. I've filed a
ticket for this:

http://trac.sagemath.org/sage_trac/ticket/9529

-- 
Robert L. Miller
http://www.rlmiller.org/

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to