[matplotlib-devel] AttributeError: 'module' object has no attribute 'CallLater'

2008-07-27 Thread Nils Wagner
Hi all,

I found a new bug

$HOME=/home/nwagner
matplotlib data path 
/usr/lib/python2.4/site-packages/matplotlib/mpl-data
loaded rc file /home/nwagner/matplotlibrc
matplotlib version 0.98.3rc1
verbose.level helpful
interactive is False
units is False
platform is linux2
CONFIGDIR=/home/nwagner/.matplotlib
Using fontManager instance from 
/home/nwagner/.matplotlib/fontManager.cache
backend WXAgg version 2.5.3.1

 spy(K_bc)
   File 
"/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", 
line 2237, in spy
 b = ishold()
   File 
"/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", 
line 466, in ishold
 return gca().ishold()
   File 
"/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", 
line 566, in gca
 ax =  gcf().gca(**kwargs)
   File 
"/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", 
line 270, in gcf
 return figure()
   File 
"/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", 
line 247, in figure
 FigureClass=FigureClass,
   File 
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py", 
line 119, in new_figure_manager
 frame = FigureFrameWxAgg(num, fig)
   File 
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py", 
line 1332, in __init__
 self.canvas = self.get_canvas(fig)
   File 
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py", 
line 32, in get_canvas
 return FigureCanvasWxAgg(self, -1, fig)
   File 
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py", 
line 734, in __init__
 self.idletimer = wx.CallLater(1,self._onDrawIdle)
AttributeError: 'module' object has no attribute 
'CallLater'


Nils

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] updated artist contains methods

2008-07-27 Thread Paul Kienzle
On Sat, Jul 26, 2008 at 7:26 PM, John Hunter <[EMAIL PROTECTED]> wrote:
> But this example revealed a serious problem for wxagg -- the wx
> backend save method was getting triggered.  So wxagg couuld display an
> image, but if we try to save it, it fails because backend_wx's
> print_figure is getting called.  I fixed this by reversing the order
> of the inheritance in FigureCanvasWXAgg so that FigureCanvasAgg is
> first.  *please test*.

That one is my fault.  I was having trouble getting start_event_loop
and draw_idle from Wx to trigger from WxAgg.  I have no explanation
why it works now with Agg before Wx --- Agg should pick up the default
draw_idle from Base so WxAgg shouldn't try to look for it in Wx.

- Paul

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] updated artist contains methods

2008-07-27 Thread John Hunter
On Sun, Jul 27, 2008 at 7:43 AM, Paul Kienzle <[EMAIL PROTECTED]> wrote:
> On Sat, Jul 26, 2008 at 7:26 PM, John Hunter <[EMAIL PROTECTED]> wrote:
>> But this example revealed a serious problem for wxagg -- the wx
>> backend save method was getting triggered.  So wxagg couuld display an
>> image, but if we try to save it, it fails because backend_wx's
>> print_figure is getting called.  I fixed this by reversing the order
>> of the inheritance in FigureCanvasWXAgg so that FigureCanvasAgg is
>> first.  *please test*.
>
> That one is my fault.  I was having trouble getting start_event_loop
> and draw_idle from Wx to trigger from WxAgg.  I have no explanation
> why it works now with Agg before Wx --- Agg should pick up the default
> draw_idle from Base so WxAgg shouldn't try to look for it in Wx.

You are right -- I just tested with the example below.  We need to be
very careful here and make sure we are getting the methods we want
start_event_loop, draw_idle and friends) from the wx base class and
not the base base class, and need to understand why it is working if
it is (my guess is it is not but I haven't dived in yet).  I think the
only way to do this is to put the wx base class first and then make
sure we override the print method in wxagg.  My aversion to multiple
inheritance grows by the day.

class Base:
def speak(self):
print 'base'

class Agg(Base):
pass

class Wx(Base):
def speak(self):
print 'wx'

class WXAgg(Agg,Wx):
pass

wxagg = WXAgg()
wxagg.speak()

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] preparing for 0.98.3 and 0.91.5

2008-07-27 Thread Sandro Tosi
> The docs require sphinx 0.4, which if I recall correctly, we got
> pushed into debian on short notice precisely to support the mpl docs.
>  What version of sphinx are you using?

I'm using v0.4.1 or it's a strict depends on 0.4 only?

I'm attaching the log for the build, it might be helpful.

Thanks,
Sandro

-- 
Sandro Tosi (aka morph, Morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi


matplotlib_0.98.3rc1-1_amd64.build.bz2
Description: BZip2 compressed data
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] updated artist contains methods

2008-07-27 Thread John Hunter
On Sun, Jul 27, 2008 at 7:43 AM, Paul Kienzle <[EMAIL PROTECTED]> wrote:
> On Sat, Jul 26, 2008 at 7:26 PM, John Hunter <[EMAIL PROTECTED]> wrote:
>> But this example revealed a serious problem for wxagg -- the wx
>> backend save method was getting triggered.  So wxagg couuld display an
>> image, but if we try to save it, it fails because backend_wx's
>> print_figure is getting called.  I fixed this by reversing the order
>> of the inheritance in FigureCanvasWXAgg so that FigureCanvasAgg is
>> first.  *please test*.
>
> That one is my fault.  I was having trouble getting start_event_loop
> and draw_idle from Wx to trigger from WxAgg.  I have no explanation
> why it works now with Agg before Wx --- Agg should pick up the default
> draw_idle from Base so WxAgg shouldn't try to look for it in Wx.

It doesn't appear to be working for me. To keep things simple, I am
working with backend_wx so there are no issues of diamond inheritance.
 It just appears that the specialization is broken.  I get this
endless loop when I try to run the demo -- I have some extra debug
prints inserted to see what is getting called.  Eg when I start the
example, a window pops up with the "you will define a triangle" title,
and the following is printed to the console

  home:~/mpl/examples/pylab_examples> python ginput_manual_clabel.py -dWX
  You will define a triangle, click to begin
  BlockingInput.__call__: calling canvas.start_event_loop
 >
  FigureCanvasWx.start_event_loop

and then it waits for me.  When I click just a single time on the axes
to select a point, before I can actually select the points for the
triangle, it enters the following loop and the console prints the
output

FigureCanvasWx.stop_event_loop
BlockingInput.__call__: finally
Select 3 corners with mouse
BlockingInput.__call__: calling canvas.start_event_loop
 >
FigureCanvasWx.start_event_loop
BlockingInput.__call__: finally
Too few points, starting over
Select 3 corners with mouse
BlockingInput.__call__: calling canvas.start_event_loop
 >
FigureCanvasWx.start_event_loop
BlockingInput.__call__: finally
Too few points, starting over
Select 3 corners with mouse
BlockingInput.__call__: calling canvas.start_event_loop
 >
FigureCanvasWx.start_event_loop
BlockingInput.__call__: finally
Too few points, starting over
Select 3 corners with mouse
BlockingInput.__call__: calling canvas.start_event_loop
 >
FigureCanvasWx.start_event_loop
FigureCanvasWx.stop_event_loop
BlockingInput.__call__: finally


and so on endlessly until I finally click 'x' to close the figure, I
get the following dead object error

raceback (most recent call last):
  File "ginput_manual_clabel.py", line 40, in 
pts = np.asarray( plt.ginput(3,timeout=-1) )
  File "/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/pyplot.py",
line 355, in ginput
return gcf().ginput(*args, **kwargs)
  File "/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/figure.py",
line 1041, in ginput
show_clicks=show_clicks)
  File 
"/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/blocking_input.py",
line 239, in __call__
BlockingInput.__call__(self,n=n,timeout=timeout)
  File 
"/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/blocking_input.py",
line 109, in __call__
self.cleanup()
  File 
"/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/blocking_input.py",
line 226, in cleanup
self.fig.canvas.draw()
  File 
"//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py",
line 14029, in __getattr__
raise PyDeadObjectError(self.attrStr % self._name)
wx._core.PyDeadObjectError: The C++ part of the FigureCanvasWx object
has been deleted, attribute access no longer allowed.


On a separate note, I also see the strangeness you are seeing with the
multiple inheritance order.  When I run the example with backend
wxagg, I get the wx specialization called even though FigureCanvasAgg
is defined first in the multiple inheritance heirarchy and so the base
method should be picked up.  And yet when I try and replicate this in
test code, I always get the base class method ...  Looks like we've
got some work to do to sort all of this out.

class Base:
def speak(self, timeout):
raise NotImplementedError

class Agg(Base):
pass

class Wx(Base):
def speak(self, timeout):
print 'wx'

class WXAgg(Agg,Wx):
pass

wxagg = WXAgg()
wxagg.speak(timeout=1)


Here is my version info -- running on os x leopard with

home:~/mpl/examples/pylab_examples> python simple_plot.py
--verbose-helpful -dWX$HOME=/Users/jdhunter
CONFIGDIR=/Users/jdhunter/.matplotlib
matplotlib data path
/Users/jdhunter/dev/lib/python2.5/site-packages/matplotlib/mpl-data
loaded rc file /Users/jdhunter/.matplotlib/matplotlibrc
matplotlib version 0.98.3rc1
verbose.level helpful
interactive is False
units i

Re: [matplotlib-devel] updated artist contains methods

2008-07-27 Thread John Hunter
On Sun, Jul 27, 2008 at 11:28 AM, John Hunter <[EMAIL PROTECTED]> wrote:

> On a separate note, I also see the strangeness you are seeing with the
> multiple inheritance order.  When I run the example with backend
> wxagg, I get the wx specialization called even though FigureCanvasAgg
> is defined first in the multiple inheritance heirarchy and so the base
> method should be picked up.  And yet when I try and replicate this in
> test code, I always get the base class method ...  Looks like we've
> got some work to do to sort all of this out.

One possibility: since FigureCanvasWx inherits not only from
FigureCanvasBase, but also wx.Panel which is a SWIG object (eg look at
the repr of FigureCanvasWXAgg)

   >

is it possible that the swig part is doing some deep magic that screws
w/ the normal python mulitlple inheritance lookup ?

I just confirmed that something like this appears to be the case -- if
you add the wx panel to the multiple inheritance test case below, the
wx method gets called instead of the base

   import wx

class Base:
def __init__(self, x):
self.x = 1

def speak(self, timeout):
raise NotImplementedError

class Agg(Base):
pass

class Wx(Base, wx.Panel):
def __init__(self, x):
Base.__init__(self, x)

def speak(self, timeout):
print 'wx'

class WXAgg(Agg,Wx):
pass

wxagg = WXAgg('hi')
wxagg.speak(timeout=1)

Is this platform specific?  I am seein this on os x w/ my versions but
am curious to know if it is consistent.  God help us all.

One possibility is that since wx.Panel implemented __getattribute__,
it may be screwing up the python implementation of multiple
inheritance if it depends on getattr, eg I found the following on
__getattribute__:

__getattribute__( self, name)
Called unconditionally to implement attribute accesses for
instances of the class. If the class also defines __getattr__, it will
never be called (unless called explicitly). This method should return
the (computed) attribute value or raise an AttributeError exception. In
order to avoid infinite recursion in this method, its implementation
should always call the base class method with the same name to access
any attributes it needs, for example, "object.__getattribute__(self,
name)".
"""

Just grasping at straws here...

JDH

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] AttributeError: 'module' object has no attribute 'CallLater'

2008-07-27 Thread Eric Firing
Nils Wagner wrote:
> Hi all,
> 
> I found a new bug
> 
> $HOME=/home/nwagner
> matplotlib data path 
> /usr/lib/python2.4/site-packages/matplotlib/mpl-data
> loaded rc file /home/nwagner/matplotlibrc
> matplotlib version 0.98.3rc1
> verbose.level helpful
> interactive is False
> units is False
> platform is linux2
> CONFIGDIR=/home/nwagner/.matplotlib
> Using fontManager instance from 
> /home/nwagner/.matplotlib/fontManager.cache
> backend WXAgg version 2.5.3.1
> 
>  spy(K_bc)
>File 
> "/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", 
> line 2237, in spy
>  b = ishold()
>File 
> "/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", 
> line 466, in ishold
>  return gca().ishold()
>File 
> "/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", 
> line 566, in gca
>  ax =  gcf().gca(**kwargs)
>File 
> "/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", 
> line 270, in gcf
>  return figure()
>File 
> "/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", 
> line 247, in figure
>  FigureClass=FigureClass,
>File 
> "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py", 
> line 119, in new_figure_manager
>  frame = FigureFrameWxAgg(num, fig)
>File 
> "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py", 
> line 1332, in __init__
>  self.canvas = self.get_canvas(fig)
>File 
> "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py", 
> line 32, in get_canvas
>  return FigureCanvasWxAgg(self, -1, fig)
>File 
> "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py", 
> line 734, in __init__
>  self.idletimer = wx.CallLater(1,self._onDrawIdle)
> AttributeError: 'module' object has no attribute 
> 'CallLater'

It looks like this was introduced in wxPython 2.7.1: 
http://mail.python.org/pipermail/python-announce-list/2006-October/005326.html

I have changed backend_wx to use the backwards-compatible alias, FutureCall.

Eric

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] preparing for 0.98.3 and 0.91.5

2008-07-27 Thread John Hunter
On Sun, Jul 27, 2008 at 11:05 AM, Sandro Tosi <[EMAIL PROTECTED]> wrote:
>> The docs require sphinx 0.4, which if I recall correctly, we got
>> pushed into debian on short notice precisely to support the mpl docs.
>>  What version of sphinx are you using?
>
> I'm using v0.4.1 or it's a strict depends on 0.4 only?

OK, this is a major SNAFU.  Michael Droetboom wrote show-inheritance
for matplotlib and it was included in sphinx.  Sphinx released this in
0.4 and we got this packaged into debian in a concerted push so that
we could get mpl into debian with working docs.  In the meantime, a
point release 0.4.1  of sphinx came out that broke the automodule
support on Jul 5th, and this broken version is now the one you have in
debian. On Jul 8th, Darren noticed the breakage, reported it on the
Sphinx mailing list, and it was fixed again in svn, but there has been
no sphinx point release.

Mikhail, if you are so inclined and there is still time, you may want
to see if Georg wants to put out another point release that fixes this
problem, and push the fix into the debian pipeline.

JDH

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] preparing for 0.98.3 and 0.91.5

2008-07-27 Thread Sandro Tosi
On Sun, Jul 27, 2008 at 19:30, John Hunter <[EMAIL PROTECTED]> wrote:
> Mikhail, if you are so inclined and there is still time, you may want
> to see if Georg wants to put out another point release that fixes this
> problem, and push the fix into the debian pipeline.

Just as a note: today @ ~16.00 CEST the Lenny freeze was announced.
>From now on, it will be very difficult to have new stuff in Lenny.

-- 
Sandro Tosi (aka morph, Morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] preparing for 0.98.3 and 0.91.5

2008-07-27 Thread John Hunter
On Sun, Jul 27, 2008 at 12:39 PM, Mikhail Gusarov
<[EMAIL PROTECTED]> wrote:
> Twas brillig at 12:30:39 27.07.2008 UTC-05 when [EMAIL PROTECTED] did gyre 
> and gimble:
>
>  JH> Mikhail, if you are so inclined and there is still time, you may
>  JH> want to see if Georg wants to put out another point release that
>  JH> fixes this problem, and push the fix into the debian pipeline.
>
> Well, freeze just was declared, so I'll need to request an exception for
> sphinx, as well as you for mpl :-|
>
> It will help if you file a RC bug for sphinx :)

I'll be happy to, but should I wait until there is actually a sphinx
release out with the bugfix in it?

JDH

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] preparing for 0.98.3 and 0.91.5

2008-07-27 Thread Mikhail Gusarov
Twas brillig at 12:30:39 27.07.2008 UTC-05 when [EMAIL PROTECTED] did gyre and 
gimble:

 JH> Mikhail, if you are so inclined and there is still time, you may
 JH> want to see if Georg wants to put out another point release that
 JH> fixes this problem, and push the fix into the debian pipeline.

Well, freeze just was declared, so I'll need to request an exception for
sphinx, as well as you for mpl :-|

It will help if you file a RC bug for sphinx :)

-- 


pgpPgXEa5o2dy.pgp
Description: PGP signature
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] updated artist contains methods

2008-07-27 Thread Paul Kienzle
On Sun, Jul 27, 2008 at 10:20 AM, John Hunter <[EMAIL PROTECTED]> wrote:
> On Sun, Jul 27, 2008 at 7:43 AM, Paul Kienzle <[EMAIL PROTECTED]> wrote:
>> On Sat, Jul 26, 2008 at 7:26 PM, John Hunter <[EMAIL PROTECTED]> wrote:
>>> But this example revealed a serious problem for wxagg -- the wx
>>> backend save method was getting triggered.  So wxagg couuld display an
>>> image, but if we try to save it, it fails because backend_wx's
>>> print_figure is getting called.  I fixed this by reversing the order
>>> of the inheritance in FigureCanvasWXAgg so that FigureCanvasAgg is
>>> first.  *please test*.
>>
>> That one is my fault.  I was having trouble getting start_event_loop
>> and draw_idle from Wx to trigger from WxAgg.  I have no explanation
>> why it works now with Agg before Wx --- Agg should pick up the default
>> draw_idle from Base so WxAgg shouldn't try to look for it in Wx.
>
> You are right -- I just tested with the example below.  We need to be
> very careful here and make sure we are getting the methods we want
> start_event_loop, draw_idle and friends) from the wx base class and
> not the base base class, and need to understand why it is working if
> it is (my guess is it is not but I haven't dived in yet).  I think the
> only way to do this is to put the wx base class first and then make
> sure we override the print method in wxagg.  My aversion to multiple
> inheritance grows by the day.

Yup.  The problem is with diamond inheritance.  Mixins tend not to
have this problem since they are not defining default behaviour,
but instead are adding particular behaviours to a given class hierarchy.

For the current situation we have a couple of options.  One is
to separate the drawing backend (Renderer) completely from the
interaction backend (Canvas).  This is mostly done already, and
may not take that much effort to complete.  The faster and good
enough solution is to move the GUI parts of Wx into WxAgg and
deprecate Wx.

I don't understand why the current code seems to work.  I put
print statements in Wx.draw_idle and WxAgg.draw and both
were called.  I'll verify later if I get a chance.

  - Paul

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] updated artist contains methods

2008-07-27 Thread John Hunter
On Sat, Jul 26, 2008 at 6:26 PM, John Hunter <[EMAIL PROTECTED]> wrote:

>>  stix_fonts_demo: error
>>UnicodeDecodeError: 'rawunicodeescape' codec can't decode
>>bytes in position 39-0: \U out of range

I'm pretty sure this is the result of a python build that does not
have support for wide unicode characters (this is a build time
configuration issue).  It is not really an mpl bug, but I am going to
comment out the wide unicode line and add the example the
backend_driver (Michael, is there a way to check and see if the python
build has support for wide unicode at runtime so this line is included
conditionally?)

>>  symlog_demo: rendering causes the following error
>>File 
>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/transforms.py",
>> line 1072, in transform_point
>>  assert len(point) == self.input_dims

I created a ticket on sf
(http://sourceforge.net/tracker/index.php?func=detail&aid=2029141&group_id=80706&atid=560720)
and assigned it to Michael since this is his baby.  I also added the
demo to backend driver (currently failing)

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Clipping

2008-07-27 Thread Ryan May

Hi,

Can anyone explain how the clipping code works?  Or maybe how the 
backends decide whether to draw a line?  In working on drawing skewT's, 
I need slanted gridlines.  Through proper setting of transforms, I can 
get them to draw slanted fine, but because they are slanted, the data x 
range at the top of the plot is not equal to the data x range at the bottom.


One issue that crops up as a result (which I've mentioned before) is 
that the tickmarks at the top get drawn off past the right end of the 
plot (enabling clipping of ticklines fixes this).


The second issue, which is the focus here, is that it seems impossible 
to get matplotlib to draw any gridlines that start before the left side 
of the chart.  I can tweak Axis.draw() and get it to draw *all* the 
currently set tick marks and I can disable clipping so that the 
gridlines draw past the *right* side of the plot, but I can't seem to 
figure out how to draw a grid lines that starts from off the left side.


I've attached a small example of what I'm trying to do and an example of 
the results I'm getting with a few of the mods I've done to MPL (also 
attached).


Can anybody point me where I've gone wrong?  I traced the calls down to 
the renderer (in this case GTK), but they for some reason won't trace 
down any further.


Ryan

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
--- lib/matplotlib/axis.py	(revision 5905)
+++ lib/matplotlib/axis.py	(working copy)
@@ -123,7 +123,7 @@
 artist.Artist.set_clip_path(self, clippath, transform)
 #self.tick1line.set_clip_path(clippath, transform)
 #self.tick2line.set_clip_path(clippath, transform)
-self.gridline.set_clip_path(clippath, transform)
+#self.gridline.set_clip_path(clippath, transform)
 set_clip_path.__doc__ = artist.Artist.set_clip_path.__doc__
 
 def get_pad_pixels(self):
@@ -711,7 +711,7 @@
 interval = self.get_view_interval()
 for tick, loc, label in self.iter_ticks():
 if tick is None: continue
-if not mtransforms.interval_contains(interval, loc): continue
+#if not mtransforms.interval_contains(interval, loc): continue
 tick.update_position(loc)
 tick.set_label1(label)
 tick.set_label2(label)

<>from matplotlib.axes import Axes
from matplotlib.lines import Line2D
from matplotlib.collections import LineCollection
from matplotlib.ticker import FixedLocator, AutoLocator, ScalarFormatter, FixedLocator
from matplotlib import transforms
from matplotlib.projections import register_projection

import numpy as np

class SkewXAxes(Axes):
# The projection must specify a name.  This will be used be the
# user to select the projection, i.e. ``subplot(111,
# projection='skewx')``.
name = 'skewx'

def set_xlim(self, *args):
Axes.set_xlim(self, *args)

def draw(self, *args):
'''
draw() is overridden here to allow the data transform to be updated
before calling the Axes.draw() method.  This allows resizes to be
properly handled without registering callbacks.  The amount of
work done here is kept to a minimum.
'''
self._update_data_transform()
Axes.draw(self, *args)

def _update_data_transform(self):
'''
This separates out the creating of the data transform so that
it alone is updated at draw time.
'''
# This transforms x in pixel space to be x + the offset in y from
# the lower left corner - producing an x-axis sloped 45 degrees
# down, or x-axis grid lines sloped 45 degrees to the right
self.transProjection = transforms.Affine2D(
np.array([[1, 1, -self.bbox.ymin], [0, 1, 0], [0, 0, 1]]))

# Full data transform
self.transData.set(self._transDataNonskew + self.transProjection)

def _set_lim_and_transforms(self):
"""
This is called once when the plot is created to set up all the
transforms for the data, text and grids.
"""
#Get the standard transform setup from the Axes base class
Axes._set_lim_and_transforms(self)

#Save the unskewed data transform for our own use when regenerating
#the data transform. The user might want this as well
self._transDataNonskew = self.transData

#Create a wrapper for the data transform, so that any object that
#grabs this transform will see an updated version when we change it
self.transData = transforms.TransformWrapper(
transforms.IdentityTransform())

#Use the helper method to actually set the skewed data transform
self._update_data_transform()

def get_xaxis_transform(self):
"""
Get the transformation used for drawing x-axis labels, ticks
and gridlines.  The x-direction is in data coordinates and the
y-direction is in axis coordinates.


Re: [matplotlib-devel] preparing for 0.98.3 and 0.91.5

2008-07-27 Thread Chris Walker
"John Hunter" <[EMAIL PROTECTED]> writes:

> On Sun, Jul 27, 2008 at 12:39 PM, Mikhail Gusarov
> <[EMAIL PROTECTED]> wrote:
> > Twas brillig at 12:30:39 27.07.2008 UTC-05 when [EMAIL PROTECTED] did gyre 
> > and gimble:
> >
> >  JH> Mikhail, if you are so inclined and there is still time, you may
> >  JH> want to see if Georg wants to put out another point release that
> >  JH> fixes this problem, and push the fix into the debian pipeline.
> >
> > Well, freeze just was declared, so I'll need to request an exception for
> > sphinx, as well as you for mpl :-|
> >
> > It will help if you file a RC bug for sphinx :)
> 
> I'll be happy to, but should I wait until there is actually a sphinx
> release out with the bugfix in it?

No, don't wait. Debian packages can included patches if necessary. 

Pointing at the fix in svn (in the bug report) would be helpful.

Chris

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Clipping

2008-07-27 Thread John Hunter
On Sun, Jul 27, 2008 at 3:57 PM, Ryan May <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Can anyone explain how the clipping code works?  Or maybe how the backends
> decide whether to draw a line?  In working on drawing skewT's, I need
> slanted gridlines.  Through proper setting of transforms, I can get them to
> draw slanted fine, but because they are slanted, the data x range at the top
> of the plot is not equal to the data x range at the bottom.

The clipping code works as you would expect -- you pass it a path and
the artist is clipped to that path.  I think you are being bitten by
something else (see below)

> One issue that crops up as a result (which I've mentioned before) is that
> the tickmarks at the top get drawn off past the right end of the plot
> (enabling clipping of ticklines fixes this).

Yes, you probably want to clip them

> The second issue, which is the focus here, is that it seems impossible to
> get matplotlib to draw any gridlines that start before the left side of the
> chart.  I can tweak Axis.draw() and get it to draw *all* the currently set
> tick marks and I can disable clipping so that the gridlines draw past the
> *right* side of the plot, but I can't seem to figure out how to draw a grid
> lines that starts from off the left side.

Look in the axis at the method:

def draw(self, renderer):
if not self.get_visible(): return
renderer.open_group(self.__name__)
midPoint =
mtransforms.interval_contains(self.get_view_interval(),
self.get_loc())

if midPoint:
if self.gridOn:
self.gridline.draw(renderer)
if self.tick1On:
self.tick1line.draw(renderer)
if self.tick2On:
self.tick2line.draw(renderer)

The is midPoint is causing your troubles.  Replace that with 'if 1 or
midPoint' and your grids magically appear.  You may want to insert
some logic here so that custom classes can override this behavior.

You mentioned you were using GTK -- clipping is not properly supported
using the gdk renderer, so make sure you are using GTKAgg (or some
other Agg variant) for your UI while testing clipping.

JDH

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Clipping

2008-07-27 Thread John Hunter
On Sun, Jul 27, 2008 at 4:24 PM, John Hunter <[EMAIL PROTECTED]> wrote:

>if midPoint:
>if self.gridOn:
>self.gridline.draw(renderer)
>if self.tick1On:
>self.tick1line.draw(renderer)
>if self.tick2On:
>self.tick2line.draw(renderer)

For a little extra color on what is going on here -- we don't want to
automatically clip the tick lines to the axes bounding box because
someone might choose the tick direction 'out'.  Since we can't use
graphical clipping, this test is trying to make sure the tick location
is in the view interval before drawing it.  You may want to consider a
overridable method 'is_draw_tick' or something along those lines,
which defaults to::

  mtransforms.interval_contains(self.get_view_interval(), self.get_loc())

JDH

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] updated artist contains methods

2008-07-27 Thread Paul Kienzle
On Sun, Jul 27, 2008 at 12:28 PM, John Hunter <[EMAIL PROTECTED]>
> [ginput_manual_clabel] doesn't appear to be working for me. To keep things 
> simple, I am
> working with backend_wx so there are no issues of diamond inheritance.
>  It just appears that the specialization is broken.  I get this
> endless loop when I try to run the demo

I didn't test with multiple calls to ginput.  Apparently I can't reuse
the wx EventLoop.  I posted a fix to backend_wx which creates a
new event loop each time, and now it works for me on wx-2.8.3
for macos 10.4.

> On a separate note, I also see the strangeness you are seeing with the
> multiple inheritance order.  When I run the example with backend
> wxagg, I get the wx specialization called even though FigureCanvasAgg
> is defined first in the multiple inheritance heirarchy and so the base
> method should be picked up.  And yet when I try and replicate this in
> test code, I always get the base class method ...  Looks like we've
> got some work to do to sort all of this out.

My inclination is to avoid diamond inheritance in this case by
moving the wx base class to wxagg.  Let me know and I will
implement it.

It would be helpful to run through the tests for wx on linux and on
windows before a release.  Particularly ginput_manual_clabel
for start/stop event loop.  I can't think of how to test for draw_idle
short of putting a print statement in the window, or using a complicated
plot like multi_image and continuously resizing the window.

There is one more outstanding change to wx before I can stop
subclassing the WxAgg canvas in my own applications, which is
that draw is being called too often.  Putting a print statement in
WxAgg draw and _onPaint I get the following:

$ python mri_demo.py
wxPaintEvt
WxAgg draw
WxAgg draw
wxPaintEvt
WxAgg draw
WxAgg draw

wxPaintEvt
WxAgg draw
wxPaintEvt
WxAgg draw

By contrast TkAgg shows:

$ python mri_demo.py
tk draw


I don't have a patch for this ready, though I can get it down to two
draws by putting a draw_idle in _onPaint.  I'll hold off committing
until I get it down to one.

  - Paul

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] updated artist contains methods

2008-07-27 Thread John Hunter
On Sun, Jul 27, 2008 at 4:57 PM, Paul Kienzle <[EMAIL PROTECTED]> wrote:

> My inclination is to avoid diamond inheritance in this case by
> moving the wx base class to wxagg.  Let me know and I will
> implement it.

My weak preference would be to do this as a mixin factorint out the
renderer from the GUI stuff.  If this is only marginally harder, it
makes it easier down the road if someone wants to mixin a different
renderer from agg, or if the wx renderer ever improces sufficiently to
make it usable.  But if this seems like a lot more work, I am not
averse to simply deprecating the wx renderer, though factoring
everything to make mixing in a different renderer later will still be
useful.  In the end, whatever you decide will be fine.

> There is one more outstanding change to wx before I can stop
> subclassing the WxAgg canvas in my own applications, which is
> that draw is being called too often.  Putting a print statement in
> WxAgg draw and _onPaint I get the following:

OK, now that we have missed the debian freeze, the pressure to get
something out sooner is lessened, do we'll just work on getting it
right.

JDH

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] preparing for 0.98.3 and 0.91.5

2008-07-27 Thread Mikhail Gusarov
Twas brillig at 12:51:35 27.07.2008 UTC-05 when [EMAIL PROTECTED] did gyre and 
gimble:

 >> It will help if you file a RC bug for sphinx :)

 JH> I'll be happy to, but should I wait until there is actually a
 JH> sphinx release out with the bugfix in it?

No, just file a bug describing the problem with sphinx 0.4.1 and that it
is fixed in svn.

-- 


pgpGFzu6sAsj8.pgp
Description: PGP signature
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel