Re: [Matplotlib-users] Help in solving a segfault problem?

2011-03-13 Thread Nicolas SCHEFFER
Thanks much for the reply!
I'll try your advice as soon as I can.

BTW, I don't think this is a Solaris-related problem.
If you look at the pointers in my original post, the same error can
happen on other arch (I confess it can be for other reasons though).

-n

On Sun, Mar 13, 2011 at 1:03 PM, Jouni K. Seppänen  wrote:
> Nicolas SCHEFFER  writes:
>
>> I didn't get much reply on this issue, so I'm just trying to resurrect
>> the question.
>
> Probably not many devs using Solaris, so no-one has been able to
> reproduce this.
>
>>> #12 0xfd7ff4a22fd8 in py_to_agg_transformation_matrix
>>> (obj=0x774380, errors=) at
>>> src/agg_py_transforms.cpp:22
>>> #13 0xfd7ff4a32e7c in _path_module::update_path_extents
>>> (this=, args=...) at src/path.cpp:380
>
> So it's in transforms-related code, but we can't see the locals. First
> I'd try to recompile without optimizations and (hoping it still crashes)
> inspect the local variables in these frames in gdb. Or maybe make the
> functions print out their arguments and any other relevant locals.
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
> --
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem generating pdf file with LaTeX fonts

2011-03-13 Thread Jouni K . Seppänen
Pål Gunnar Ellingsen  writes:

> This is very strange I agree. I checked the pdftex.map file and it has
> changed due to me upgrading texlive 2011 during a normal fedora update some
> days ago. I've checked the log for the update, and the update contained a
> new updmap.cfg (which is the script for generating pdftex.map), which
> explains the difference in pdftex.map, though it does not help with solving
> the problem.

So it might be caused by updmap configuration. Are you able to compile
TeX source files that contain text in cmr12 using pdftex? E.g., put

\documentclass[12pt]{article}
\begin{document}
foo bar
\end{document}

in foo.tex and try pdflatex foo.tex. If you run into errors, or if the
output file has ugly bitmap Type-3 fonts like TeX-produced pdf files
used to have in the 1990s, it's clearly a bug in your TeX installation.
If not, it's more a problem in dviread's hijacking of pdftex.map for its
own purposes.

(Oh, I see that your problem is already fixed, but maybe future
searchers will benefit from this suggestion.)

> http://www.linux.cz/pipermail/texlive/2011-March/000105.html(removing
> texlive-amsfonts (without dependencies) and installing it again)
> I tried the solution used there, and it worked, meaning that pdftex.map now
> contains cmr12 and my test.py file runs properly and gives me a nice pdf
> file.

A simpler fix might have been "sudo updmap-sys --enable MixedMap=cm.map".

> So again sorry for messing this up. I would like to thank you very much for
> your help.

No problem, and good that you got it sorted out!

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Help in solving a segfault problem?

2011-03-13 Thread Jouni K . Seppänen
Nicolas SCHEFFER  writes:

> I didn't get much reply on this issue, so I'm just trying to resurrect
> the question.

Probably not many devs using Solaris, so no-one has been able to
reproduce this.

>> #12 0xfd7ff4a22fd8 in py_to_agg_transformation_matrix
>> (obj=0x774380, errors=) at
>> src/agg_py_transforms.cpp:22
>> #13 0xfd7ff4a32e7c in _path_module::update_path_extents
>> (this=, args=...) at src/path.cpp:380

So it's in transforms-related code, but we can't see the locals. First
I'd try to recompile without optimizations and (hoping it still crashes)
inspect the local variables in these frames in gdb. Or maybe make the
functions print out their arguments and any other relevant locals.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Help in solving a segfault problem?

2011-03-13 Thread Nicolas SCHEFFER
Hi,
I didn't get much reply on this issue, so I'm just trying to resurrect
the question.
If there's no easy answer, could someone help me by giving me a
pointer, a method to resolve the problem, or any other quick
advice...?

Thanks much!


On Thu, Mar 10, 2011 at 12:29 AM, Nicolas SCHEFFER
 wrote:
> Hi all,
> I am stuck on matplotlib generating a segfault when invoking 'plot'.
> I've ben trying to solve this problem for a while now but no luck.
> I've seen many duplicates of this problem on the web, some with
> solutions, some without. The solution must be something more generic
> that I'm missing.
>
> Here are some of these pointers to the same problem that I have (the
> backtrace, that I pasted further below, has the same properties)
> http://old.nabble.com/101-Point-Segmentation-Fault-td27552745.html
> http://old.nabble.com/weird-error-with-gcc-4.4,-gomp,-cython,-and-matplotlib-td27351399.html
> http://bugs.gentoo.org/show_bug.cgi?id=338513
>
> So here's my specific setup and backtrace. I hope I can find some help!
> I'm using the 'agg' backend that's it, and the build and install dir
> were cleaned up.
>
> Thanks so much!
>
> ===
> Solaris10, 64bits, Python 2.7, numpy 1.5.1, gcc 4.4.1 #all compiled from 
> source
>
> backtrace:
>
> gdb python
> (gdb) run -c 'import pylab;pylab.clf(); pylab.plot([4])'
> Starting program: python -c 'import pylab;pylab.clf(); pylab.plot([4])'
> [Thread debugging using libthread_db enabled]
> [New Thread 1 (LWP 1)]
> terminate called after throwing an instance of 'std::exception'
> terminate called recursively
>
> Program received signal SIGABRT, Aborted.
> [Switching to Thread 1 (LWP 1)]
> 0xfd7fff0ae88a in _lwp_kill () from /lib/64/libc.so.1
>
>
> #0  0xfd7fff0ae88a in _lwp_kill () from /lib/64/libc.so.1
> #1  0xfd7fff0a98b3 in thr_kill () from /lib/64/libc.so.1
> #2  0xfd7fff0577e9 in raise () from /lib/64/libc.so.1
> #3  0xfd7fff03a7d0 in abort () from /lib/64/libc.so.1
> #4  0xfd7ff46d1a56 in __gnu_cxx::__verbose_terminate_handler () at
> ../../../../../libstdc++-v3/libsupc++/vterminate.cc:48
> #5  0xfd7ff46cef6a in __cxxabiv1::__terminate (handler=0x1) at
> ../../../../../libstdc++-v3/libsupc++/eh_terminate.cc:38
> #6  0xfd7ff46cefb3 in std::terminate () at
> ../../../../../libstdc++-v3/libsupc++/eh_terminate.cc:48
> #7  0xfd7ff46cf03e in __cxxabiv1::__cxa_rethrow () at
> ../../../../../libstdc++-v3/libsupc++/eh_throw.cc:116
> #8  0xfd7ff46d1af6 in __gnu_cxx::__verbose_terminate_handler () at
> ../../../../../libstdc++-v3/libsupc++/vterminate.cc:78
> #9  0xfd7ff46cef6a in __cxxabiv1::__terminate (handler=0x1) at
> ../../../../../libstdc++-v3/libsupc++/eh_terminate.cc:38
> #10 0xfd7ff46cefb3 in std::terminate () at
> ../../../../../libstdc++-v3/libsupc++/eh_terminate.cc:48
> #11 0xfd7ff46cf0b6 in __cxxabiv1::__cxa_throw (obj= optimized out>, tinfo=, dest= out>)
>    at ../../../../../libstdc++-v3/libsupc++/eh_throw.cc:83
> #12 0xfd7ff4a22fd8 in py_to_agg_transformation_matrix
> (obj=0x774380, errors=) at
> src/agg_py_transforms.cpp:22
> #13 0xfd7ff4a32e7c in _path_module::update_path_extents
> (this=, args=...) at src/path.cpp:380
> #14 0xfd7ff4a34d90 in
> Py::ExtensionModule<_path_module>::invoke_method_varargs (this= optimized out>,
>    method_def=, args=...) at
> ./CXX/Python2/ExtensionModule.hxx:184
> #15 0xfd7ff4a209b7 in Py::method_varargs_call_handler
> (_self_and_name_tuple=, _args= out>)
>    at CXX/Python2/cxx_extensions.cxx:1714
> #16 0x004a6071 in call_function (f=0x2024770, throwflag= optimized out>)
>    at /usr/local/src/lang/Python-2.7.1/Python/ceval.c:4012
> #17 PyEval_EvalFrameEx (f=0x2024770, throwflag=)
> at /usr/local/src/lang/Python-2.7.1/Python/ceval.c:2665
> #18 0x004a79c1 in PyEval_EvalCodeEx (co=0x124e230,
> globals=, locals=,
> args=0x2024910,
>    argcount=, kws=0x3, kwcount=2,
> defs=0x155c888, defcount=3, closure=0x0)
>

--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Memory usage with 1M of Polygons

2011-03-13 Thread Benjamin Root
On Sunday, March 13, 2011, onet  wrote:
> On Fri, 2011-03-11 at 17:08 -1000, Eric Firing wrote:
>> On 03/11/2011 02:54 PM, onet wrote:
>> > Using matplotlib I try to plot satellite observations, which consists of
>> > roughly one million patches that are not gridded regularly.
>> > I first collect the vertices (corner points of the observations) and
>> > colors and then use PolyCollection and ax.add_collection to add these
>> > patches to the figure.
>> >
>> > On my 64bit Linux machine:
>> > # 1M patches will use>  4Gb of memory
>> >
>> > My question: how can I plot more efficiently and use less memory?
>>
>> If your data are on a quadrilateral mesh, as in your example, (or can be
>> approximately mapped onto such a mesh) then pcolormesh should be very
>> much more efficient both in time and in memory than making a PolyCollection.
>
> The data I want to plot is not as regular as in the example (this was
> just to generate lots of non-overlaping patches) but it has different
> shapes along the orbit of the satellite when projected on the map.
> Almost square at the equator and rotated near the poles. See example
> link below from a plot in IDL.
>
> http://temis.nl/o3msaf/vaac/gome2/vaac/daily/images/2011/S-O3M_GOME_NAR_02_M02_20110312000254Z_20110313000254Z_N_O_20110313024518Z.AAI_Global.Unfiltered.png
>
> But I think my satellite data along an orbit is probably piecewise
> regular enough try the pcolormesh approach.
>
> So thanks for the suggestion!
>
> Best regards,
>
>         Olaf.
>

It might be regular with respect to a particular projection.  Have you
considered checking out Basemap?

Ben Root

--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Issue with imshow and usetex

2011-03-13 Thread Jae-Joon Lee
Okay, I just confirmed that using a gs distiller greatly increases the
file size with gs 9.0.
I have no idea what's going on and I hope that someone more
knowledgeable than me steps in.
Meanwhile, using the "ps2write" device with gs seems to solve the
issue (but I'm not sure of its consequences).
So, can you test if the workaround works?

In lib/matplotlib/backends/backend_ps.py, search for the following
line in the "gs_distill" function,

command = '%s -dBATCH -dNOPAUSE -r%d -sDEVICE=pswrite %s -sOutputFile="%s" \

and replace "pswrite" with "ps2write".

Regards,

-JJ




On Sun, Mar 13, 2011 at 1:45 AM, Thomas Robitaille
 wrote:
> Hi Jae-Joon,
>
> Ok, that makes sense - I tried upgrading to 9.0.1 and it looks like there is 
> still an issue:
>
> 6204    test_1.eps
> 34104   test_2.eps
>
> Cheers,
> Tom
>
> On Mar 12, 2011, at 11:38 AM, Jae-Joon Lee wrote:
>
>> Note that, even with usetex=False,  you have a large ps file when
>> distiller is used .
>> When usetex=True, the distiller is always used (if distiller=None,
>> ghostscript is used).
>> Therefore, my guess is that the large file size is results of
>> distilling using the ghostscript.
>> I wonder if this is an issue of gs 9.0 version.
>> In my installation (gs 8.xx), the original ps file is about 6 M (both
>> usetex=True and False), and when they are distilled, their size is
>> reduced down to 4 M.
>>
>> I'll try to test gs 9.0 when I get a chance.
>> Meanwhile, can you try to upgrade to gs 9.01 and see if it changes anything?
>>
>> Regards,
>>
>> -JJ
>>
>>
>>
>> On Sat, Mar 12, 2011 at 2:46 AM, Thomas Robitaille
>>  wrote:
>>> Hi Jae-Joon,
>>>
>>> I tried inserting:
>>>
>>> mpl.rc('ps', usedistiller=None)
>>>
>>> after importing matplotlib, and I get:
>>>
>>> $ du -sk *.eps
>>> 6204    test_1.eps
>>> 34104   test_2.eps
>>>
>>> using 'ghostscript' I get:
>>>
>>> $ du -sk *.eps
>>> 34096   test_1.eps
>>> 34104   test_2.eps
>>>
>>> and using 'xpdf' raises an exception:
>>>
>>>  File 
>>> "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backends/backend_ps.py",
>>>  line 1091, in _print_figure
>>>    xpdf_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
>>>  File 
>>> "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backends/backend_ps.py",
>>>  line 1421, in xpdf_distill
>>>    image.\nHere is the full report generated by pdftops: \n\n' + fh.read())
>>> RuntimeError: pdftops was not able to process your image.
>>> Here is the full report generated by pdftops:
>>>
>>> I don't have a matplotlibrc file, and I am using:
>>>
>>> Ghostscript: GPL Ghostscript  9.00 (2010-09-14)
>>> LaTeX: Version 3.1415926-1.40.10 (TeX Live 2009)
>>>
>>> and I'm using the latest head from github for matplotlib.
>>>
>>> Cheers,
>>> Tom
>>>
>>> On Mar 8, 2011, at 7:31 AM, Jae-Joon Lee wrote:
>>>
 With current master at git repo, I cannot reproduce this.
 Both test_1.eps and test_2.eps are ~4M in size.

 Can you check if the file size varies significantly with rc parameters
 ps.usedistiller?
 I'm not sure how text setting can affect the images.

 Regards,

 -JJ



 On Tue, Mar 1, 2011 at 7:23 AM, Thomas Robitaille
  wrote:
> Hi,
>
> In the following example:
>
> ---
>
> import numpy as np
>
> import matplotlib as mpl
> mpl.use('Agg')
> import matplotlib.pyplot as plt
>
> fig = plt.figure()
> ax = fig.add_subplot(1, 1, 1)
> ax.imshow(np.random.random((1024, 1024)), interpolation='nearest')
> fig.savefig('test_1.eps')
>
> mpl.rc('text', usetex=True)
>
> fig = plt.figure()
> ax = fig.add_subplot(1, 1, 1)
> ax.imshow(np.random.random((1024, 1024)), interpolation='nearest')
> fig.savefig('test_2.eps')
>
> ---
>
> the file test_2.eps is almost 6 times larger than test_1.eps, and takes 
> much longer to draw. It looks like in the first case, the image is 
> rendered as a bitmap (the way it should be), whereas in the second case 
> each pixel is drawn individually as a polygon. Is this a bug?
>
> I am using r8988 of matplotlib.
>
> Thanks for any help!
>
> Thomas
> --
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT 
> data
> generated by your applications, servers and devices whether physical, 
> virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>>>
>>>
>
>

--
Colocation vs. Managed Hosting
A quest

Re: [Matplotlib-users] Memory usage with 1M of Polygons

2011-03-13 Thread onet
On Fri, 2011-03-11 at 17:08 -1000, Eric Firing wrote:
> On 03/11/2011 02:54 PM, onet wrote:
> > Using matplotlib I try to plot satellite observations, which consists of
> > roughly one million patches that are not gridded regularly.
> > I first collect the vertices (corner points of the observations) and
> > colors and then use PolyCollection and ax.add_collection to add these
> > patches to the figure.
> >
> > On my 64bit Linux machine:
> > # 1M patches will use>  4Gb of memory
> >
> > My question: how can I plot more efficiently and use less memory?
> 
> If your data are on a quadrilateral mesh, as in your example, (or can be 
> approximately mapped onto such a mesh) then pcolormesh should be very 
> much more efficient both in time and in memory than making a PolyCollection.

The data I want to plot is not as regular as in the example (this was
just to generate lots of non-overlaping patches) but it has different
shapes along the orbit of the satellite when projected on the map.
Almost square at the equator and rotated near the poles. See example
link below from a plot in IDL. 

http://temis.nl/o3msaf/vaac/gome2/vaac/daily/images/2011/S-O3M_GOME_NAR_02_M02_20110312000254Z_20110313000254Z_N_O_20110313024518Z.AAI_Global.Unfiltered.png

But I think my satellite data along an orbit is probably piecewise
regular enough try the pcolormesh approach. 

So thanks for the suggestion!

Best regards,

Olaf.


--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem generating pdf file with LaTeX fonts

2011-03-13 Thread Pål Gunnar Ellingsen
Hi

This is very strange I agree. I checked the pdftex.map file and it has
changed due to me upgrading texlive 2011 during a normal fedora update some
days ago. I've checked the log for the update, and the update contained a
new updmap.cfg (which is the script for generating pdftex.map), which
explains the difference in pdftex.map, though it does not help with solving
the problem.

>From now on I'll check the update list closer, I'm sorry for the
inconvenience on your part.The current pdftex.map file does not have the
cmr12 font (or any other cmr fonts). Which means that it explains the lack
of the font, but doesn't help me, so I continued looking for errors.

There was a new version of TexLive out, I updated, but it did not fix the
problem (pdftex.map still lacked cmr fonts).

I checked the Fedora TExlive maling list and found that there were similar
problems there:
http://www.linux.cz/pipermail/texlive/2011-March/000105.html(removing
texlive-amsfonts (without dependencies) and installing it again)
I tried the solution used there, and it worked, meaning that pdftex.map now
contains cmr12 and my test.py file runs properly and gives me a nice pdf
file.

So again sorry for messing this up. I would like to thank you very much for
your help.

If CC-d this e-mail to the  TexLive mailing list, in case others have the
same problem, and I also figured that this problem with the pdftex.map file
should be fixed.

Regards

Pål



On 12 March 2011 22:24, Jouni K. Seppänen  wrote:

> Jouni K. Seppänen  writes:
>
> > Set verbose to debug-annoying and catch the output in a file; there will
> > be lots of it, so please email it to me off-list.
>
> Got it, thanks. Unfortunately I have no idea what's going on. The debug
> information indicates that the PsfontsMap._register function (which only
> gets called from within the loop in PsfontsMap._parse) is called with
> pdftex.map lines out of order, and lacking some of the lines.
>
> The pdftex.map file you sent me starts with some comments followed by
> these entries:
>
>ASCII ASCII Acorn AcornInitials AlphaDia ChessAlphaDiagram AmiciLogo AmiciLogo 
> The log messages, on the other hand, start like this:
>
>PsfontsMap: register ['Acorn', 'AcornInitials', 'PsfontsMap: register ['aealbattar', 'ae_AlBattar',
> 'ArabeyesArabicEncoding ReEncodeFont', ' 'PsfontsMap: register ['aealmateen', 'ae_AlMateen',
> 'ArabeyesArabicEncoding ReEncodeFont', ' '
> Here's a small table. The first column is just line numbers within that
> part of the debug log, the second is the number of the entry in
> pdftex.map referenced, the third is the first word of that entry:
>
>1 2 Acorn
>2 279 aealbattar
>3 280 aealmateen
>4 281 aealmohanadb
>5 282 aealmohanadbolditalic
>6 278 ae_almohanad_xxbold
>7 283 aealmothnna
>8 284 aealyermook
>9 285 aearab
>
> So it first gets entry #2 (Acorn) from the file, then jumps to entry
> #279 (aealbattar) and starts going forward from there, except #278 gets
> between #282 and #283. It goes on like this for a while, then:
>
>32 308 aetarablus
>33 309 aetholoth
>34 3 AlphaDia
>35 4 AmiciLogo
>36 5 AmiciLogoBold
>37 6 AmiciLogoBoldRslant
>38 7 AmiciLogoBoldSlant
>39 8 AmiciLogoRslant
>40 9 AmiciLogoSlant
>41 310 andlso
>42 10 AnnSton
>43 311 aram10
>
> So after #309 it jumps back to #3 for a while, etc., and the critical
> font cmr12 is skipped altogether.
>
> Hmm. The ordering is almost consistent with sorting the font names
> case-insensitively, but that wouldn't explain the missing fonts.
>
> Could you double-check that you sent me the correct pdftex.map file?
> Run on the system where you have this problem e.g. the following
> commands:
>
>kpsewhich pdftex.map
>head `kpsewhich pdftex.map`
>
> and check that ASCII, Acorn, and AlphaDia are the first three
> non-comment entries.
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
>
> --
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users