progress bar?

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.

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

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

···

On Mon, Jun 28, 2010 at 11:31 AM, Jim Vickroy <Jim.Vickroy@...259...> 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.