Good day all,

I've hit an infinite loop/hang using the delaunay package.   Unfortunately,
I haven't been able to reproduce the issue with a nice minimal dataset, so I
don't expect much help, but I did want to note it in case.

I've been working with the delaunay package, making contour plots from
mostly unstructured data.  Unfortunately, I cannot use the natgrid version
due to licensing issues, so I've been using the included delunay with mixed
results. 

I've attached a .txt file containing the data values and x,y arrays used to
create the triangulation as well as the x,y points for the grid to use for
the resulting interpolation/extrapolation results. Listing of pertinent code
is below. 

The hang occurs in the call:
        z = interp_extrap( x2, y2 )
     which, in this case is a call to the triangulations nn_interpolator(
x2, y2 )

If I use the nn_extrapolator, the hang doesn't happen, but there is a nasty
artifact.

The size of the resulting grid does not appear to matter ( so I made it
small for simplicity ).

I assume that I'm the one doing something wrong, so if there are better
approaches to this problem, don't hesitate to correct me (  please :)  ). 

--See output in attached text file.
CODE:
        print 'data values:'
        print list( data_values )
        print 'data x:'
        print list( x_data_points )
        print 'data y:'
        print list( y_data_points )

        print 'start tri'
        # triangulate data (beware this can get cranky if given concave
shape)
        try:
            ltri = Triangulation( array( x_data_points ), array(
y_data_points ) )
        except Exception, err:
            raise Exception, ( 'Triangulation failed ( %s )' % err )
        print 'end tri'

        print 'start interp/extrap'
        # it seems we want the extremes of the x and y, but double check
        bbox = ( x_model_points_sorted[ 0 ], x_model_points_sorted[ -1 ], \
         y_model_points_sorted[ 0 ], y_model_points_sorted[ -1 ] )

        print 'bounding box:'
        print bbox

        if extrapolate:
            # extrapolate
            print 'extrap'
            try:
                # bounding out to region maximums for extrapolation - then
nn interpolation is applied
                interp_extrap = ltri.nn_extrapolator( array( data_values ),
bbox = bbox )
            except Exception, err:
                raise Exception, ( 'Extrapolation/Interpolation failed ( %s
)' % err )
        else:
            # interpolate
            print 'interp'
            try:
                interp_extrap = ltri.nn_interpolator( array( data_values ) )
            except Exception, err:
                raise Exception, ( 'Interpolation failed ( %s )' % err )
        print 'end interp/extrap'

        # OVERRIDE SMOOTHNESS FOR TESTING:
        self.smoothness = 0
        num_grid_points = int( self.smoothness * 200 )
        if num_grid_points == 0:
            num_grid_points = 20

        if len( x_model_points_sorted ) > num_grid_points:
            x_model_points_sorted = linspace( x_model_points_sorted[ 0 ],
x_model_points_sorted[ -1 ], num_grid_points )

        if len( y_model_points_sorted ) > num_grid_points:
            y_model_points_sorted = linspace( y_model_points_sorted[ 0 ],
y_model_points_sorted[ -1 ], num_grid_points )

        x2,y2 = meshgrid( x_model_points_sorted, y_model_points_sorted ) #
model boundary region

        print 'do the i/e'
        print 'x2 shape and y2 shape:'
        print x2.shape, ' ', y2.shape
        print 'x, grid points:'
        print x_model_points_sorted
        print 'y, grid points:'
        print y_model_points_sorted
        # run the interp/extrap step out to the bounded region on the grid
        z = interp_extrap( x2, y2 ) # HANG ON nn_interp, but not nn_extrap!
        print 'done with i/e'
:END CODE


Python version: 2.6.4
MPL version: 0.99.1
Windows XP Pro SP3

Thanks for reading,
-Erik Schweller

http://old.nabble.com/file/p27026918/boom_mpl_delaunay_output.txt
boom_mpl_delaunay_output.txt 
-- 
View this message in context: 
http://old.nabble.com/Delaunay-nn_interpolator-hang-tp27026918p27026918.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to