ValueError: Can only output finite numbers in PDF

Dear all,

I don't know much how to express this issue I am having but I will try.

We are developing an application (CING: cing.googlecodes.com) and we
have some routines to test the sanity of our code.

I am developing in python, on a mac book pro with Mac OSX tiger and FINK.

So when we were using matplotlib 0.90.1 and numpy 1.0.4 the routine
below was running fine.

Then I updated all from Fink, having now mtplib 0.98.3 and numpy 1.1.1
and problems started to appear.

I could solve all (e.g. replace verify_intervals()) but one, as shown below.

I don't have much idea at moment how to debug it better, but it seems
that I cannot generate the PDFs because mtplib functions don't guess a
finite number of pages.

I hope someone can give any idea.

Many thanks in advance.

Alan

···

======================================================================
ERROR: testMoleculePlot (cing.Libs.test.test_NTMoleculePlot.AllChecks)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/alan/workspace/cingWork/python/cing/Libs/test/test_NTMoleculePlot.py",
line 178, in testMoleculePlot
    createPngCopyToo=True )
  File "/Users/alan/workspace/cingWork/python/cing/Libs/NTmoleculePlot.py",
line 176, in renderMoleculePlotSet
    if ps.hardcopy(fileNameList[r-1]):
  File "/Users/alan/workspace/cingWork/python/cing/Libs/NTplot.py",
line 1201, in hardcopy
    savefig(fileName)
  File "/sw/lib/python2.5/site-packages/matplotlib/pyplot.py", line
342, in savefig
    return fig.savefig(*args, **kwargs)
  File "/sw/lib/python2.5/site-packages/matplotlib/figure.py", line
964, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/sw/lib/python2.5/site-packages/matplotlib/backend_bases.py",
line 1310, in print_figure
    **kwargs)
  File "/sw/lib/python2.5/site-packages/matplotlib/backend_bases.py",
line 1204, in print_pdf
    return pdf.print_pdf(*args, **kwargs)
  File "/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 1864, in print_pdf
    self.figure.draw(renderer)
  File "/sw/lib/python2.5/site-packages/matplotlib/figure.py", line 759, in draw
    for a in self.axes: a.draw(renderer)
  File "/sw/lib/python2.5/site-packages/matplotlib/axes.py", line 1523, in draw
    a.draw(renderer)
  File "/sw/lib/python2.5/site-packages/matplotlib/lines.py", line 437, in draw
    markerFunc(renderer, gc, tpath, affine.frozen())
  File "/sw/lib/python2.5/site-packages/matplotlib/lines.py", line
885, in _draw_plus
    path, path_trans)
  File "/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 1253, in draw_markers
    marker, Op.use_xobject)
  File "/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 451, in output
    self.write(fill(map(pdfRepr, data)))
  File "/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 124, in pdfRepr
    raise ValueError, "Can only output finite numbers in PDF"
ValueError: Can only output finite numbers in PDF

----------------------------------------------------------------------
--
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.

http://www.bio.cam.ac.uk/~awd28<<

We are developing an application (CING: cing.googlecodes.com) and we

  You mean http://cing.googlecode.com (no "s")

[...]

I don't have much idea at moment how to debug it better, but it seems
that I cannot generate the PDFs because mtplib functions don't guess a
finite number of pages.

[...]

"/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", line
124, in pdfRepr
    raise ValueError, "Can only output finite numbers in PDF"
ValueError: Can only output finite numbers in PDF

  Is this not a problem with non-finite *values* in your data ? Do you have
NaN of Inf numbers oin your data ?

···

On vendredi 3 octobre 2008, Alan wrote:

--
Vincent Favre-Nicolin http://vincefn.net
Université Joseph Fourier http://www.ujf-grenoble.fr
CEA/ Institut Nanosciences & Cryogénie http://inac.cea.fr
ObjCryst & Fox http://objcryst.sourceforge.net

Are you perhaps trying to plot data containing NaN or Inf? If so, this is a known bug in 0.98.3 that has seen been corrected on SVN trunk.

A workaround is to pass masked arrays (where the NaNs and Infs are masked out) to matplotlib instead.

But this bug should be gone in the next release of matplotlib. If you're comfortable building from SVN, you could even try that now.

Cheers,
Mike

Alan wrote:

···

Dear all,

I don't know much how to express this issue I am having but I will try.

We are developing an application (CING: cing.googlecodes.com) and we
have some routines to test the sanity of our code.

I am developing in python, on a mac book pro with Mac OSX tiger and FINK.

So when we were using matplotlib 0.90.1 and numpy 1.0.4 the routine
below was running fine.

Then I updated all from Fink, having now mtplib 0.98.3 and numpy 1.1.1
and problems started to appear.

I could solve all (e.g. replace verify_intervals()) but one, as shown below.

I don't have much idea at moment how to debug it better, but it seems
that I cannot generate the PDFs because mtplib functions don't guess a
finite number of pages.

I hope someone can give any idea.

Many thanks in advance.

Alan

======================================================================
ERROR: testMoleculePlot (cing.Libs.test.test_NTMoleculePlot.AllChecks)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/alan/workspace/cingWork/python/cing/Libs/test/test_NTMoleculePlot.py",
line 178, in testMoleculePlot
    createPngCopyToo=True )
  File "/Users/alan/workspace/cingWork/python/cing/Libs/NTmoleculePlot.py",
line 176, in renderMoleculePlotSet
    if ps.hardcopy(fileNameList[r-1]):
  File "/Users/alan/workspace/cingWork/python/cing/Libs/NTplot.py",
line 1201, in hardcopy
    savefig(fileName)
  File "/sw/lib/python2.5/site-packages/matplotlib/pyplot.py", line
342, in savefig
    return fig.savefig(*args, **kwargs)
  File "/sw/lib/python2.5/site-packages/matplotlib/figure.py", line
964, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/sw/lib/python2.5/site-packages/matplotlib/backend_bases.py",
line 1310, in print_figure
    **kwargs)
  File "/sw/lib/python2.5/site-packages/matplotlib/backend_bases.py",
line 1204, in print_pdf
    return pdf.print_pdf(*args, **kwargs)
  File "/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 1864, in print_pdf
    self.figure.draw(renderer)
  File "/sw/lib/python2.5/site-packages/matplotlib/figure.py", line 759, in draw
    for a in self.axes: a.draw(renderer)
  File "/sw/lib/python2.5/site-packages/matplotlib/axes.py", line 1523, in draw
    a.draw(renderer)
  File "/sw/lib/python2.5/site-packages/matplotlib/lines.py", line 437, in draw
    markerFunc(renderer, gc, tpath, affine.frozen())
  File "/sw/lib/python2.5/site-packages/matplotlib/lines.py", line
885, in _draw_plus
    path, path_trans)
  File "/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 1253, in draw_markers
    marker, Op.use_xobject)
  File "/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 451, in output
    self.write(fill(map(pdfRepr, data)))
  File "/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
line 124, in pdfRepr
    raise ValueError, "Can only output finite numbers in PDF"
ValueError: Can only output finite numbers in PDF

----------------------------------------------------------------------
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Thanks for all replies.

I got a solution by copying some files from SVN trunk revision 6155. I did as follow:

svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib

sudo cp -b matplotlib/lib/matplotlib/backends/backend_pdf.py /sw/lib/python2.5/site-packages/matplotlib/backends

sudo cp -b matplotlib/lib/matplotlib/config/mplconfig.py /sw/lib/python2.5/site-packages/matplotlib/config

sudo cp -b matplotlib/lib/matplotlib/mlab.py /sw/lib/python2.5/site-packages/matplotlib/

sudo cp -b matplotlib/lib/matplotlib/path.py /sw/lib/python2.5/site-packages/matplotlib

sudo cp -b matplotlib/lib/matplotlib/rcsetup.py /sw/lib/python2.5/site-packages/matplotlib

Cheers,

Alan

···

On Fri, Oct 3, 2008 at 1:21 PM, Michael Droettboom <mdroe@…86…> wrote:

Are you perhaps trying to plot data containing NaN or Inf? If so, this is a known bug in 0.98.3 that has seen been corrected on SVN trunk.

A workaround is to pass masked arrays (where the NaNs and Infs are masked out) to matplotlib instead.

But this bug should be gone in the next release of matplotlib. If you’re comfortable building from SVN, you could even try that now.

Cheers,

Mike

Alan wrote:

Dear all,

I don’t know much how to express this issue I am having but I will try.

We are developing an application (CING: cing.googlecodes.com) and we

have some routines to test the sanity of our code.

I am developing in python, on a mac book pro with Mac OSX tiger and FINK.

So when we were using matplotlib 0.90.1 and numpy 1.0.4 the routine

below was running fine.

Then I updated all from Fink, having now mtplib 0.98.3 and numpy 1.1.1

and problems started to appear.

I could solve all (e.g. replace verify_intervals()) but one, as shown below.

I don’t have much idea at moment how to debug it better, but it seems

that I cannot generate the PDFs because mtplib functions don’t guess a

finite number of pages.

I hope someone can give any idea.

Many thanks in advance.

Alan

======================================================================

ERROR: testMoleculePlot (cing.Libs.test.test_NTMoleculePlot.AllChecks)


Traceback (most recent call last):

File “/Users/alan/workspace/cingWork/python/cing/Libs/test/test_NTMoleculePlot.py”,

line 178, in testMoleculePlot

createPngCopyToo=True  )

File “/Users/alan/workspace/cingWork/python/cing/Libs/NTmoleculePlot.py”,

line 176, in renderMoleculePlotSet

if ps.hardcopy(fileNameList[r-1]):

File “/Users/alan/workspace/cingWork/python/cing/Libs/NTplot.py”,

line 1201, in hardcopy

savefig(fileName)

File “/sw/lib/python2.5/site-packages/matplotlib/pyplot.py”, line

342, in savefig

return fig.savefig(*args, **kwargs)

File “/sw/lib/python2.5/site-packages/matplotlib/figure.py”, line

964, in savefig

self.canvas.print_figure(*args, **kwargs)

File “/sw/lib/python2.5/site-packages/matplotlib/backend_bases.py”,

line 1310, in print_figure

**kwargs)

File “/sw/lib/python2.5/site-packages/matplotlib/backend_bases.py”,

line 1204, in print_pdf

return pdf.print_pdf(*args, **kwargs)

File “/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py”,

line 1864, in print_pdf

self.figure.draw(renderer)

File “/sw/lib/python2.5/site-packages/matplotlib/figure.py”, line 759, in draw

for a in self.axes: a.draw(renderer)

File “/sw/lib/python2.5/site-packages/matplotlib/axes.py”, line 1523, in draw

a.draw(renderer)

File “/sw/lib/python2.5/site-packages/matplotlib/lines.py”, line 437, in draw

markerFunc(renderer, gc, tpath, affine.frozen())

File “/sw/lib/python2.5/site-packages/matplotlib/lines.py”, line

885, in _draw_plus

path, path_trans)

File “/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py”,

line 1253, in draw_markers

marker, Op.use_xobject)

File “/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py”,

line 451, in output

self.write(fill(map(pdfRepr, data)))

File “/sw/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py”,

line 124, in pdfRepr

raise ValueError, "Can only output finite numbers in PDF"

ValueError: Can only output finite numbers in PDF


Michael Droettboom

Science Software Branch

Operations and Engineering Division

Space Telescope Science Institute

Operated by AURA for NASA


Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.

http://www.bio.cam.ac.uk/~awd28<<