Re: [Matplotlib-users] packing an app with cx_Freeze

2006-08-14 Thread Charlie Moad
Check out the py2exe page about matplotlib.

http://starship.python.net/crew/theller/moin.cgi/MatPlotLib

On 8/14/06, Christian Meesters [EMAIL PROTECTED] wrote:
 Hi,

 Yesterday I tried packing an application of mine which makes use of wxPython,
 scipy, and matplotlib with cx_Freeze.

 The Traceback I get after running FreezePython --install-dir SPlot_dir
 SPlot.py and starting the application is:

 Traceback (most recent call last):
   File /home/cm/bin/initscripts/Console.py, line 27, in ?
 exec code in m.__dict__
   File SPlot.py, line 17, in ?
   File /usr/lib64/python2.4/site-packages/matplotlib/__init__.py, line 720,
 in ?
 defaultParams = {
   File /usr/lib64/python2.4/site-packages/matplotlib/__init__.py, line 273,
 in wrapper
 ret = func(*args, **kwargs)
   File /usr/lib64/python2.4/site-packages/matplotlib/__init__.py, line 360,
 in _get_data_path
 raise RuntimeError('Could not find the matplotlib data files')
 RuntimeError: Could not find the matplotlib data files

 I should mention that the everything was done on one machine (running SuSE
 10.0 and python 2.4.1).

 Anyone tried packing an application with matplotlib before and has a hint for
 me what to change?

 TIA
 Christian

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems upgrading to mpl 0.87.4

2006-08-14 Thread Christopher Barker
John Hunter wrote:
 Charlie, since you are pretty familiar with the blitting API, perhaps
 you could take a look and see how much work it would be to do wx
 blitting w/o extension code.  I'd be happy to add some additional
 helper methods in agg if need be, as we did for qt.

Didn't MPL originally use the Python API, but with less than stellar 
performance? I'm not sure how efficient we can get without making 
changes to wx. However, I think Robin Dunn is pretty open to making some 
of those changes.

For one, he told me a while back that he was going to try to expose some 
of the API for working directly with wxBitmaps. If we could dump data 
straight into a wxBitmap, that would be the best option. That's likely 
to be tricky, however, as a wxBitmap is a wrapper around whatever the 
platform-native format is for a Bitmap. However, while there are a lot 
of possible formats for native Bitmaps, 24bit RGB is pretty darn common, 
if we could get top performance from that from that format, we'd be a 
long way in the right direction.

Another (or additional) option is for both MPL and wx to support the new 
array interface protocol in numpy. There's a lot of other reasons to do 
that, and, again, Robin has expressed his support for this. If we could 
get MPL, wx, numpy, and PIL all passing data around with this protocol, 
we'd be in great shape. Travis posted a patch to PIL for support a while 
back, I don't know if it's going to get applied or not, but it's worth 
looking at.

Another place to look for idea is Enthought's Kiva -- It's Agg back-end 
interacts well with wx -- or so I've heard. I haven't tried it yet myself.

I'm no C++ wiz, but I'd be willing to help with the wx modifications -- 
it's been on my list for a while. Should I send a note to Robin Dunn for 
ideas?

-Chris






-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/ORR/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] quiver , contourf , nans

2006-08-14 Thread Dwishen Ramanah
Dear all,

I have to quiver(x,y,u,v)  , where u,v are displacement vectors and x,y 
their position.
I also have to contourf(x,y,u)

u and v have some nan elements. how does matplotlib handle nans because it 
returns this error:

ValueError: math domain error

Thanks

Dwishen


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] quiver , contourf , nans

2006-08-14 Thread Eric Firing
Support for nan in inputs to matplotlib is presently spotty (and mostly 
accidental); use masked arrays instead.  Masked arrays have been 
supported by contourf for a long time, but I added masked array support 
to quiver (and only for u and v, not for x and y) only very recently, so 
  until a new release is made (probably very soon) it will be available 
only in svn.

To make a masked array from your array with nans, do something like this:

import pylab as P
um = P.nx.ma.masked_where(P.nx.isnan(u), u)

It might make sense to have matplotlib argument handling code do this 
automatically on all arguments that can be masked arrays, but unless or 
until we make that change, you will have to to it manually as needed.

Eric



Dwishen Ramanah wrote:
 Dear all,
 
 I have to quiver(x,y,u,v)  , where u,v are displacement vectors and x,y 
 their position.
 I also have to contourf(x,y,u)
 
 u and v have some nan elements. how does matplotlib handle nans because it 
 returns this error:
 
 ValueError: math domain error
 
 Thanks
 
 Dwishen
 
 
 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fixed wxcursor_demo.py example, please commit

2006-08-14 Thread Daniel Kornhauser

I am making a new wxcursor_demo.py example I attach it to this mail.

If anybody can help me iron those wrinkles I think we can make a great 
wxcursor_demo example.


I am not proud of invoking the SetCursor method on the wx.EVT_PAINT 
event but it works ...


The present wxcursor_demo example is broken because:
   - Does not follow wx coding standards, not pythonic at all.
   - Very complicated example to follow and long.
   - Some nonsensical code such as the Time and Price part.
   - The wx hand draw, crosshair has lots of disadvantages (you get 
the mouse pointer right next to it so it's useless for picking pixels in 
images.)
   - The users should have access to wx.StockCursor, with the current 
example every cursor has to be  hand drawn


 This said, I thank a lot the person who started the example 
since I used it as a starting point.


  Any feedback would be appreciated.


  

Daniel.
#!/usr/bin/env python

Example to draw a cursor and report the data coords in wx


import matplotlib
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure
from matplotlib.numerix import arange, sin, pi

import wx

class CanvasFrame(wx.Frame):

def __init__(self, ):
wx.Frame.__init__(self,None,-1,
 'CanvasFrame',size=(550,350))

self.SetBackgroundColour(wx.NamedColor(WHITE))

self.figure = Figure()
self.axes = self.figure.add_subplot(111)
t = arange(0.0,3.0,0.01)
s = sin(2*pi*t)

self.axes.plot(t,s)
self.axes.set_xlabel('t')
self.axes.set_ylabel('sin(t)')
self.figure_canvas = FigureCanvas(self, -1, self.figure)

# Note that event is a MplEvent
self.figure_canvas.mpl_connect('motion_notify_event', 
self.UpdateStatusBar)
self.figure_canvas.mpl_connect('motion_notify_event', self.UpdateCursor)

self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.figure_canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
self.SetSizer(self.sizer)
self.Fit()

self.statusBar = wx.StatusBar(self, -1)
self.statusBar.SetFieldsCount(1)
self.SetStatusBar(self.statusBar)

self.toolbar = NavigationToolbar2Wx(self.figure_canvas)
self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
self.toolbar.Show()

def UpdateCursor(self, event):
self.figure_canvas.SetCursor(wx.StockCursor(wx.CURSOR_BULLSEYE))

def UpdateStatusBar(self, event):
if event.inaxes:
x, y = event.xdata, event.ydata
self.statusBar.SetStatusText(( x=  + str(x) + 
 y= +str(y) ),
   0)

class App(wx.App):

def OnInit(self):
'Create the main window and insert the custom frame'
frame = CanvasFrame()
self.SetTopWindow(frame)
frame.Show(True)
return True

if __name__=='__main__':
matplotlib.use('WXAgg')
app = App(0)
app.MainLoop()
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fixed wxcursor_demo.py example, please commit

2006-08-14 Thread John Hunter
 Daniel == Daniel Kornhauser [EMAIL PROTECTED] writes:

Daniel This said, I thank a lot the person who started the
Daniel example since I used it as a starting point.

You should also thank that person because he (Jeremy O'Donoghue)
wrote the wx backend wink.  

But the example was written a long time ago and since then many wx
users have contributed new/better/more/different wx examples
(embedding_in_wx[1-4].py) to atone for the original sins.  I'm happy
to use your new/more/better/different example, but I'll first defer to
the wisdom of the resident wxperts, who may have some comments.

JDH

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fixed wxcursor_demo.py example, please commit

2006-08-14 Thread John Hunter

 John == John Hunter [EMAIL PROTECTED] writes:

John But the example was written a long time ago and since then
John many wx users have contributed new/better/more/different wx
John examples (embedding_in_wx[1-4].py) to atone for the original

Please forgive everything I wrote as the rantings of a deranged
lunatic.  I now see you were talking about the *cursor* demo, not the
*embedding* demo.

BTW, have you seen the matplotlib native cursoring, which uses
matplotlib or drawing rather than native wx.

  examples/widgets/cursor.py

JDH

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users