Re: [Matplotlib-users] speed up imports?

2010-04-02 Thread Andrew Kelly
Slow on my OSX machine as well.  I also get this strange warning which I
have never seen before (I usually only use MPL on my windows machine).

Warning (from warnings module):
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pytz/__init__.py",
line 29
from pkg_resources import resource_stream
UserWarning: Module numpy was already imported from
/Library/Frameworks/GDAL.framework/Versions/1.6/Python/site-packages/numpy/__init__.pyc,
but
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
is being added to sys.path



On Fri, Apr 2, 2010 at 1:41 PM, Eric Firing  wrote:

> Andrew Kelly wrote:
>
>> import pytz only took 0.0 seconds.
>>
>>
>
> Sounds like it was already imported, so you were not really timing that
> import.
>
> On linux (ubuntu 9.10, Lenovo T60 laptop) importing pytz takes longer than
> importing numpy:
>
>
> efir...@manini:~$ time python -c "import pytz"
>
> real0m0.203s
> user0m0.144s
> sys 0m0.052s
> efir...@manini:~$ time python -c "import pylab"
>
> real0m0.626s
> user0m0.480s
> sys 0m0.124s
>
> efir...@manini:~$ time python -c "import numpy"
>
> real0m0.113s
> user0m0.088s
> sys 0m0.020s
>
> (Probably everything is in cache in these tests; repeats yielded similar
> results.)
>
> Eric
>
>
>  I actually just ran that pstats module and there is one line that stuck
>> out at me:
>>  ncalls  tottime  percall  cumtime  percall filename:lineno(function)
>>10.0000.0000.0000.000
>> C:\Python26\lib\os.py:35(_get_exports_list)
>>  5603.1070.0063.1070.006 {open}
>>  That is ~50% of the load time.  I have 0 idea what this is though.
>>  Let me try this on my os machine.
>>  -Andy
>>
>> On Fri, Apr 2, 2010 at 12:31 PM, Michael Droettboom > md...@stsci.edu>> wrote:
>>
>>It looks like most of the time is being taken up by pytz (timezone
>>library), which opens ~500 files.  How does the total time of
>>"import pytz" compare?
>>
>>Mike
>>
>>Andrew Kelly wrote:
>>
>>I see.  I was wondering why it spit out a binary file.
>>
>>test.out is attached...
>>
>>-Andy
>>
>>On Fri, Apr 2, 2010 at 10:55 AM, Michael Droettboom
>>mailto:md...@stsci.edu>
>><mailto:md...@stsci.edu <mailto:md...@stsci.edu>>> wrote:
>>
>>   Can you provide the actual saved profiler data?  The output
>>of the
>>   command itself doesn't provide enough information to diagnose
>> the
>>   problem, since it doesn't have full file paths etc.
>>
>>       When you do (thanks Gökhan for the less verbose version):
>>
>>python.exe -c "import cProfile; cProfile.run('import pylab',
>>   'test.out')"
>>
>>   this should produce a binary file "test.out" that can be loaded
>>   with the pstats module and used by GUI tools such as KCacheGrind
>>   to help us get to the bottom of this.
>>
>>   Mike
>>
>>   Andrew Kelly wrote:
>>
>>   I'm back.
>>
>>   My backend is wx.  "Import wx" does not really take much
>> time
>>   to import at all.  In fact time.time() before and after =
>> 0.0
>>
>>   Some computer details:
>>   Processor: AMD Phenom IIx4 810 Processor 2.6 GHz
>>   RAM: 8.00 GB
>>
>>   As for the cProfiler output on pylab, I have attached the
>>   output as test.txt.
>>-Andy
>>
>>   On Fri, Apr 2, 2010 at 7:22 AM, Gökhan Sever
>>   mailto:gokhanse...@gmail.com>
>><mailto:gokhanse...@gmail.com <mailto:gokhanse...@gmail.com>>
>>   <mailto:gokhanse...@gmail.com
>><mailto:gokhanse...@gmail.com> <mailto:gokhanse...@gmail.com
>><mailto:gokhanse...@gmail.com>>>>
>>
>>   wrote:
>>
>>
>>
>>  On Fri, Apr 2, 2010 at 8:28 AM, Michael Droettboom
>>  mailto:md...@stsci.edu>
>><mailto:md...@stsci.edu <mailto:md...@stsci.edu>>
>>   <mailto:md...@stsci.edu <mailto:md...@stsci.edu>
>><mailto:

Re: [Matplotlib-users] speed up imports?

2010-04-02 Thread Andrew Kelly
import pytz only took 0.0 seconds.

I actually just ran that pstats module and there is one line that stuck out
at me:
  ncalls  tottime  percall  cumtime  percall filename:lineno(function)
10.0000.0000.0000.000
C:\Python26\lib\os.py:35(_get_exports_list)
  5603.1070.0063.1070.006 {open}

That is ~50% of the load time.  I have 0 idea what this is though.

Let me try this on my os machine.

-Andy

On Fri, Apr 2, 2010 at 12:31 PM, Michael Droettboom  wrote:

> It looks like most of the time is being taken up by pytz (timezone
> library), which opens ~500 files.  How does the total time of "import pytz"
> compare?
>
> Mike
>
> Andrew Kelly wrote:
>
>> I see.  I was wondering why it spit out a binary file.
>>
>> test.out is attached...
>>
>> -Andy
>>
>> On Fri, Apr 2, 2010 at 10:55 AM, Michael Droettboom > md...@stsci.edu>> wrote:
>>
>>Can you provide the actual saved profiler data?  The output of the
>>command itself doesn't provide enough information to diagnose the
>>problem, since it doesn't have full file paths etc.
>>
>>When you do (thanks Gökhan for the less verbose version):
>>
>> python.exe -c "import cProfile; cProfile.run('import pylab',
>>'test.out')"
>>
>>this should produce a binary file "test.out" that can be loaded
>>with the pstats module and used by GUI tools such as KCacheGrind
>>to help us get to the bottom of this.
>>
>>Mike
>>
>>Andrew Kelly wrote:
>>
>>I'm back.
>>
>>My backend is wx.  "Import wx" does not really take much time
>>to import at all.  In fact time.time() before and after = 0.0
>>
>>Some computer details:
>>Processor: AMD Phenom IIx4 810 Processor 2.6 GHz
>>RAM: 8.00 GB
>>
>>As for the cProfiler output on pylab, I have attached the
>>output as test.txt.
>> -Andy
>>
>>On Fri, Apr 2, 2010 at 7:22 AM, Gökhan Sever
>>mailto:gokhanse...@gmail.com>
>><mailto:gokhanse...@gmail.com <mailto:gokhanse...@gmail.com>>>
>>
>>wrote:
>>
>>
>>
>>   On Fri, Apr 2, 2010 at 8:28 AM, Michael Droettboom
>>   mailto:md...@stsci.edu>
>> <mailto:md...@stsci.edu <mailto:md...@stsci.edu>>> wrote:
>>
>>   My gut says it's probably the GUI framework import that is
>>   dominating
>>   the time.  Which backend are you using?  Does importing it
>>   take a large
>>   amount of time as well?
>>
>>   Can you provide a profiler output file we can examine
>>to narrow it
>>   down?  The following from a command prompt should be
>>   sufficient to write
>>   out a file called "import.prof":
>>
>>python.exe -c "import cProfile; prof=cProfile.Profile();
>>   prof.run('import pylab', 'import.prof')"
>>
>>   Mike
>>
>>
>>   Just for the records,
>>
>>   It reads as:
>>
>>   python -c "import cProfile; cProfile.run('import pylab',
>>   filename='test.out')
>>
>>   in Python 2.6.2
>>
>>   These helped me to load the profile output:
>>
>>   import pstats
>>   stats = pstats.Stats("test.out")
>>   stats.print_stats()
>>
>>   -- Gökhan
>>
>>
>>  
>> --
>>   Download Intel® Parallel Studio Eval
>>   Try the new software tools for yourself. Speed compiling,
>>find bugs
>>   proactively, and fine-tune applications for parallel
>>performance.
>>   See why Intel Parallel Studio got high marks during beta.
>>   http://p.sf.net/sfu/intel-sw-dev
>>   ___
>>   Matplotlib-users mailing list
>>   Matplotlib-users@lists.sourceforge.net
>><mailto:Matplotlib-users@lists.sourceforge.net>
>>   <mailto:Matplotlib-users@lists.sourceforge.net
>><mailto:Matplotlib-users@lists.sourceforge.net>>
>>
>>   https://li

Re: [Matplotlib-users] speed up imports?

2010-04-01 Thread Andrew Kelly
Eric,

I am running it on a windows 7 machine and a windows XP machine.  Odd that
it does this only on win32.

-Andy

On Thu, Apr 1, 2010 at 4:17 PM, Eric Firing  wrote:

> Andrew Kelly wrote:
>
>> Has anyone had any success in speeding up the mpl imports?
>>
>> "import matplotlib.pyplot as plt" ( or "from matplotlib.figure import
>> Figure")
>>
>> takes 6 full seconds to load.  That seems excessive.  Any ideas?
>>
>> -Andy
>>
>
> Andy,
>
> A couple replies came back directly to me (probably intended for the list,
> though), and both reported results similar to yours, on Windows machines
> only.  What OS and version are you running?
>
> Eric
>
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] speed up imports?

2010-04-01 Thread Andrew Kelly
Has anyone had any success in speeding up the mpl imports?

"import matplotlib.pyplot as plt"
( or "from matplotlib.figure import Figure")

takes 6 full seconds to load.  That seems excessive.  Any ideas?

-Andy
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Top/Right Tick Labels

2010-01-22 Thread Andrew Kelly
So twiny() is up and running with a FixedLocator and Formatter for the ticks
on the upper xAxis but am now unable to rotate these tick labels.  Is there
a special method to set the rotation, etc with FixedLocators?

On Thu, Jan 21, 2010 at 3:09 PM, Jae-Joon Lee  wrote:

> On Thu, Jan 21, 2010 at 2:31 PM, Andrew Kelly  wrote:
> > Turning label2On = true turned on the labels as directed.  However, the
> > function  label2.set_text("New Tick Label") does not update the
> > actual text.  I can set_size(), etc and it works, but set_text() does not
> > update.  Any ideas why?
> >
>
> You should not call set_text directly, instead you need to call
> Axis.set_ticklabels.
> If you want the top (right) ticks have different ticklabels than the
> bottom (left) ticks, that is not possible.
> You need to make another axes by calling twin*.
>
> -JJ
>
--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Top/Right Tick Labels

2010-01-21 Thread Andrew Kelly
Turning label2On = true turned on the labels as directed.  However, the
function  label2.set_text("New Tick Label") does not update the
actual text.  I can set_size(), etc and it works, but set_text() does not
update.  Any ideas why?

-Andrew

On Thu, Jan 21, 2010 at 10:32 AM, Jae-Joon Lee  wrote:

> On Thu, Jan 21, 2010 at 1:16 PM, Andrew Kelly  wrote:
> > (Part of my confusion stems from the fact that I can access the Tick
> > instances on the Axis but when I call Tick.set_label2("New Label") the
> label
> > does not get drawn.  Perhaps I am being daft.)
> >
>
> http://matplotlib.sourceforge.net/api/axis_api.html#matplotlib.axis.Tick
>
> You need to set label2On attribute as True.
>
> I think there is no convenient function that do this, other than
> manually iterate over the ticks.
>
> Regards,
>
> -JJ
>
--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Top/Right Tick Labels

2010-01-21 Thread Andrew Kelly
Can someone point out how to simply label the ticks on the top and right of
a plot?  twinx() and twiny() are not necessary because I don't need
independent scales and the mpl_toolkits.axes_grid.parasite_axes module is a
bit too limiting for my purposes.

(Part of my confusion stems from the fact that I can access the Tick
instances on the Axis but when I call Tick.set_label2("New Label") the label
does not get drawn.  Perhaps I am being daft.)

Thanks in advance.

-Andrew
--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Unknown Path Error

2009-08-31 Thread Andrew Kelly
I spent some time trying to cobble one together but it was taking too much
time so I tried the following and it seems to work now:

Instead of using a thick line2D and adding it to the drawing, I added a
patches.Rectangle instead.  The line2D works in 0.88.5 but not in 0.99.  The
newer version was tripping over the Artist.contains() function call when
used with line2D.

On Mon, Aug 31, 2009 at 1:28 PM, Michael Droettboom  wrote:

> Can you provide a standalone example that reproduces this error?
>
> Cheers,
> Mike
>
> Andrew Kelly wrote:
>
>> I recently re-installed matplotlib (0.99) on my vista machine and my code
>> that worked yesterday (no changes) no longer runs because of the following
>> matplotlib error:
>>
>>  File "C:\Python25\Lib\site-packages\matplotlib\lines.py", line 286, in
>> contains
>>path, affine = self._transformed_path.get_transformed_path_and_affine()
>> AttributeError: 'NoneType' object has no attribute
>> 'get_transformed_path_and_affine'
>>
>> All I am doing is initially drawing a line2D (which works) and then
>> testing if line2D.contains(event)==True if I mouse over the line.  As I said
>> this worked fine yesterday.
>>
>> I tried re-installing with an older version but to no avail.  I am totally
>> clueless as to why this is happening.  Anyone have a guess.
>>
>> -Andrew
>>
>> 
>>
>>
>> --
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day trial. Simplify your report design, integration and deployment - and
>> focus on what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> 
>>
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Unknown Path Error

2009-08-31 Thread Andrew Kelly
I recently re-installed matplotlib (0.99) on my vista machine and my code
that worked yesterday (no changes) no longer runs because of the following
matplotlib error:

  File "C:\Python25\Lib\site-packages\matplotlib\lines.py", line 286, in
contains
path, affine = self._transformed_path.get_transformed_path_and_affine()
AttributeError: 'NoneType' object has no attribute
'get_transformed_path_and_affine'

All I am doing is initially drawing a line2D (which works) and then testing
if line2D.contains(event)==True if I mouse over the line.  As I said this
worked fine yesterday.

I tried re-installing with an older version but to no avail.  I am totally
clueless as to why this is happening.  Anyone have a guess.

-Andrew
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Align Text (Relative)

2009-08-13 Thread Andrew Kelly
I am currently using the annotate() method for my data points and I was
curious if there is a way to center a line of text relative to a line of
text below it.  I am currently using two annotate() function calls in a row
(I need the text to be different colors) but I need the first one to act as
a title for the second (i.e. so I want it centered relative to the one
below.)  I have tried to use the length of the second bit of text to center
but I just cannot seem to do it.  The code looks sort of like this:

import matplotlib.pyplot as plt
...
annotateTitle='Title'
annotateText='Blah, Blah, Blah'
plt.annotate(annotateTitle, xy=(1,1), xytext=(20,50), xycoords='data',
textcoords='offset points')
plt.annotate(annotateText, xy=(1,1), xytext=(20,20), xycoords='data',
textcoords='offset points', size='small', color='black')

Any ideas?

-Andy
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Dog Ear?

2009-04-15 Thread Andrew Kelly
Hello,I am relatively new to matplotlib but I get the basics.  What I need
to do though is a slightly customized graph area.  There are two plots on
the same graph - a parabola and a straight line (with a negative slope)
north east of the parabola.  This graph has grid lines.  Simple enough, but
now I want to remove the graph area to the right of the line.  Think of a
dog-eared page in a book.  Basically that top right triangle is gone.

Can I do this in MPL or do I need to do some post processing in PIL?  Much
thanks for any help.

-Andrew
--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users