[Matplotlib-users] progress bar?

2010-06-28 Thread Carlos Grohmann
I've been searching but coudn't find any example on how to add a
progress bar to a wxpython+matplotlib app.
I'd like my app to show a progress bar while some gridding and
contouring are being done.

this is the code I'm using (without preogress bar)


funcs = {Natural Neighbor:'nn',
Triangulation:'linear',Multiquadric:'multiquadric',Inverse
Multiquadric:'inverse multiquadric',Gaussian:'gaussian',Linear
RBF:'linear',Cubic:'cubic',Quintic:'quintic',Thin-plate
Spline:'thin-plate'}

# check what kind of interpolation are we using
if interp == 'Natural Neighbor' or interp == 'Triangulation': #
Delaunay-based (mlab)
xi = yi = np.linspace(-1.1,1.1,ngrid)
zi = griddata(node_x,node_y,z,xi,yi,interp=funcs[interp])
else: # Radial basis functions (scipy)
ti = np.linspace(-1.1,1.1,ngrid)
xi, yi = np.meshgrid(ti, ti)
rbf = Rbf(node_x, node_y, z,
function=funcs[interp],epsilon=epsilon,smooth=smoothing)
zi = rbf(xi, yi)

## we only want the points that lie inside the circle,
## so we have to create a polygon to select the interpolated values
polyXY = []
u = np.arange(0,361,1)
t = np.radians(u)
x = np.cos(t)
y = np.sin(t)
polyXY.append(zip(x,y))
verts = np.array(polyXY)
verts = verts[0]
xyflat = zip(xi.flat,yi.flat)
pmask = points_inside_poly(xyflat, verts)
pmask2 = np.reshape(pmask,(ngrid,ngrid))
zmask = ma.masked_where(pmask2==False,zi)
zi = zmask

axes.contour(xi,yi,zi)


TIA
Carlos


-- 
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
http://www.igc.usp.br/pessoais/guano
http://lattes.cnpq.br/5846052449613692
Linux User #89721

Can’t stop the signal.

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] progress bar?

2010-06-28 Thread Jim Vickroy

Carlos Grohmann wrote:

I've been searching but coudn't find any example on how to add a
progress bar to a wxpython+matplotlib app.
I'd like my app to show a progress bar while some gridding and
contouring are being done.

this is the code I'm using (without preogress bar)


funcs = {Natural Neighbor:'nn',
Triangulation:'linear',Multiquadric:'multiquadric',Inverse
Multiquadric:'inverse multiquadric',Gaussian:'gaussian',Linear
RBF:'linear',Cubic:'cubic',Quintic:'quintic',Thin-plate
Spline:'thin-plate'}

# check what kind of interpolation are we using
if interp == 'Natural Neighbor' or interp == 'Triangulation': #
Delaunay-based (mlab)
xi = yi = np.linspace(-1.1,1.1,ngrid)
zi = griddata(node_x,node_y,z,xi,yi,interp=funcs[interp])
else: # Radial basis functions (scipy)
ti = np.linspace(-1.1,1.1,ngrid)
xi, yi = np.meshgrid(ti, ti)
rbf = Rbf(node_x, node_y, z,
function=funcs[interp],epsilon=epsilon,smooth=smoothing)
zi = rbf(xi, yi)

## we only want the points that lie inside the circle,
## so we have to create a polygon to select the interpolated values
polyXY = []
u = np.arange(0,361,1)
t = np.radians(u)
x = np.cos(t)
y = np.sin(t)
polyXY.append(zip(x,y))
verts = np.array(polyXY)
verts = verts[0]
xyflat = zip(xi.flat,yi.flat)
pmask = points_inside_poly(xyflat, verts)
pmask2 = np.reshape(pmask,(ngrid,ngrid))
zmask = ma.masked_where(pmask2==False,zi)
zi = zmask

axes.contour(xi,yi,zi)


TIA
Carlos


  

Hello Carlos,

Is the wx ProgressDialog class not suitable for your application?

-- jv
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] progress bar?

2010-06-28 Thread C M
On Mon, Jun 28, 2010 at 11:31 AM, Jim Vickroy jim.vick...@noaa.gov wrote:
 Carlos Grohmann wrote:

 I've been searching but coudn't find any example on how to add a
 progress bar to a wxpython+matplotlib app.
 I'd like my app to show a progress bar while some gridding and
 contouring are being done.

Or, if you don't want a separate dialog popping up, just use
wx.Gauge--it is a progress bar, and you can choose to put it near
(maybe under) your plot in the layout.

Che

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users