473,804 Members | 3,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Looking for triangulator/interpolator

I need to interpolate an irregularly spaced set of sampled
points: Given a set of x,y,z points, I need to interpolate z
values for a much finer x,y grid.

I tried using the scipy sandbox delaunay module, but the
interpolators don't work: the natural neighbor interpolator
produces a surface with "holes" in it: the interpolator returns
NaNs for no reason for certain regions within the convex hull
(the convex hull looks right, and the input Z values in that
region don't look any different that regions that work).

The linear interpolator just segfualts no matter what data I
try with it.

In the past i've used the Delny/libqhull module, but it doesn't
do interpolation, so I had to write the interpolator in Python
(which works but is very slow).

Is there any "off the shelf" module that does interpolation of
irregularly spaced data?

--
Grant Edwards grante Yow! LOOK!! Sullen
at American teens wearing
visi.com MADRAS shorts and "Flock of
Seagulls" HAIRCUTS!
May 26 '06 #1
13 2655
Grant Edwards wrote:
I need to interpolate an irregularly spaced set of sampled
points: Given a set of x,y,z points, I need to interpolate z
values for a much finer x,y grid.

I tried using the scipy sandbox delaunay module, but the
interpolators don't work: the natural neighbor interpolator
produces a surface with "holes" in it: the interpolator returns
NaNs for no reason for certain regions within the convex hull
(the convex hull looks right, and the input Z values in that
region don't look any different that regions that work).


Sounds like a great opportunity for you to contribute. The easiest
contribution would be to find as small a case as you can that
demonstrates the problem, fixing it and add a test case would be,
obviously, a greater contribution.

--Scott David Daniels
sc***********@a cm.org
May 26 '06 #2
On 2006-05-26, Scott David Daniels <sc***********@ acm.org> wrote:
I tried using the scipy sandbox delaunay module, but the
interpolators don't work: the natural neighbor interpolator
produces a surface with "holes" in it: the interpolator returns
NaNs for no reason for certain regions within the convex hull
(the convex hull looks right, and the input Z values in that
region don't look any different that regions that work).
Sounds like a great opportunity for you to contribute.


I'll try, but it looks like I'm going to be working all weekend
as it is.
The easiest contribution would be to find as small a case as
you can that demonstrates the problem, fixing it and add a
test case would be, obviously, a greater contribution.


--
Grant Edwards grante Yow! Hmmm... an arrogant
at bouquet with a subtle
visi.com suggestion of POLYVINYL
CHLORIDE...
May 27 '06 #3
On 2006-05-27, Grant Edwards <gr****@visi.co m> wrote:
On 2006-05-26, Scott David Daniels <sc***********@ acm.org> wrote:
I tried using the scipy sandbox delaunay module, but the
interpolators don't work: the natural neighbor interpolator
produces a surface with "holes" in it: the interpolator returns
NaNs for no reason for certain regions within the convex hull
(the convex hull looks right, and the input Z values in that
region don't look any different that regions that work).


Sounds like a great opportunity for you to contribute.


I'll try, but it looks like I'm going to be working all weekend
as it is.


OTOH, it looks like I'm screwed either way. My python
interpolator is so hopelessly slow it's useless in practice. It
can only process 4 points per second and I need to process
arrays of 10,000 to 50,000 elements. :(
The easiest contribution would be to find as small a case as
you can that demonstrates the problem, fixing it and add a
test case would be, obviously, a greater contribution.


--
Grant Edwards grante Yow! YOW!! Now I
at understand advanced
visi.com MICROBIOLOGY and th' new
TAX REFORM laws!!
May 27 '06 #4
Grant> OTOH, it looks like I'm screwed either way. My python
interpolator is so hopelessly slow it's useless in practice. It
can only process 4 points per second and I need to process
arrays of 10,000 to 50,000 elements. :(

Pardon my utter ignorance of scipy, but are neither psyco nor pyrex any
use?
Cheers,
John

May 27 '06 #5
On 2006-05-27, Grant Edwards <gr****@visi.co m> wrote:
On 2006-05-27, Grant Edwards <gr****@visi.co m> wrote:
On 2006-05-26, Scott David Daniels <sc***********@ acm.org> wrote:
I tried using the scipy sandbox delaunay module, but the
interpolators don't work: the natural neighbor interpolator
produces a surface with "holes" in it: the interpolator returns
NaNs for no reason for certain regions within the convex hull
(the convex hull looks right, and the input Z values in that
region don't look any different that regions that work).

Sounds like a great opportunity for you to contribute.


I'll try, but it looks like I'm going to be working all weekend
as it is.


OTOH, it looks like I'm screwed either way. My python
interpolator is so hopelessly slow it's useless in practice. It
can only process 4 points per second and I need to process
arrays of 10,000 to 50,000 elements. :(


I found another module that claims to do what I want

http://www.cdc.noaa.gov/people/jeffr.../griddata.html

But, no matter what data I pass, I get either all zeros or all
NaNs back. :/

I'm 0 for 3 now.

--
Grant Edwards grante Yow! I'm ZIPPY!! Are we
at having FUN yet??
visi.com
May 27 '06 #6
Grant Edwards wrote:
I need to interpolate an irregularly spaced set of sampled
points: Given a set of x,y,z points, I need to interpolate z
values for a much finer x,y grid.


How many x,y,z points do you have?

Did you try the fitpack function bisplrep in scipy? It can work well as
long as you don't have too many starting points.

Here is an example of how to use it
from numpy import rand, exp, ogrid
from scipy import interpolate
x = 2*rand(20)-1
y = 2*rand(20)-1
z = (x+y)*exp(-6.0*(x*x+y*y))

tck = interpolate.bis plrep(x,y,z,s=0 ,xb=-1,xe=1,yb=-1,ye=1)

xnew = r_[-1:1:70j]
ynew = r_[-1:1:70j]
znew = interpolate.bis plev(xnew,ynew, tck)
There is a buglet that is fixed in SVN scipy that means you need to
enter xb, xe, yb, and ye manually.

-Travis

May 27 '06 #7
Grant Edwards wrote:
I found another module that claims to do what I want

http://www.cdc.noaa.gov/people/jeffr.../griddata.html

But, no matter what data I pass, I get either all zeros or all
NaNs back. :/

I'm 0 for 3 now.


I pointed you to

http://www.scipy.org/Cookbook/Matplo...ly_spaced_data

earlier. Does that not do what you want?

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

May 27 '06 #8
On 2006-05-27, Grant Edwards <gr****@visi.co m> wrote:
I found another module that claims to do what I want

http://www.cdc.noaa.gov/people/jeffr.../griddata.html

But, no matter what data I pass, I get either all zeros or all
NaNs back. :/


Aaarrrggh. After some more sweating and swearing, it looks like
both the griddata module and the scipy.delaunay. nn_interpolator
do work as long as you pass the preferred brand of arrays to
them and specify the mesh/grid using the right scheme.

My problems seem to have been caused by the interaction of a
number of factors:

1) Gnuplot.py seems to like convert _some_ floating-point
arrays to integer values before plotting them -- this only
seems to happen when passing 2D arrays to splot(). That
was breaking some of my data.

2) Converting the arrays to nested lists prevents the rounding
to an integer problem but it apparently transposed the x/y
axis without my noticing. Then the "holes" in some of the
interpolated surfaces showed up. It turns out there were
NaNs in the input data that were causing the holes, but
because of the transposed x/y axis, I was looking in the
wrong place in the data.

3) Attempting to use the griddata module resulted in mixing
array objects from pylab, numpy, numeric, and scipy (some
of which may or may not be the same -- I can't keep track).
Mixing array types seems to have tripped up some
extensions. AFAICT, python code is happy with any of the
array types since they're pretty much the same if you go by
"duck" typing. But C/Fortran extensions only seem to work
with one sort or the other, and some python modules that
wrap those extensions will pass anything that quacks on
down to C/Fortran code, when then gets confused. Maybe.

4) Even when the arrays were OK, there are a couple
incompatible ways to specify a mesh/grid, and I picked the
wrong one in at least one case.

--
Grant Edwards grante Yow! MMM-MM!! So THIS is
at BIO-NEBULATION!
visi.com
May 27 '06 #9
On 2006-05-27, Robert Kern <ro*********@gm ail.com> wrote:
Grant Edwards wrote:
I found another module that claims to do what I want

http://www.cdc.noaa.gov/people/jeffr.../griddata.html

But, no matter what data I pass, I get either all zeros or all
NaNs back. :/

I'm 0 for 3 now.


I pointed you to

http://www.scipy.org/Cookbook/Matplo...ly_spaced_data

earlier. Does that not do what you want?


Yes, after installer newer versions of things and straightening out
some other issues.

--
Grant Edwards grante Yow! Are we on STRIKE yet?
at
visi.com
May 27 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
2582
by: Jason Daly | last post by:
I'm a freshman at college as a computer science major. I'm not sure it has what I want. Does anyone know if a major commonly exists in web design (focusing in server side languages)? I want to program for the internet, but don't know where to get all of my information from to be the most knowledgeable I can be. Do i find what i'm looking for in some class somewhere? if so where do i look? or do i just buy all the asp, php, xml, etc...
4
3616
by: Frank Einstein | last post by:
Looking for a tool that can edit an XML file in a browser. The basic requirement is that the XML file is rendered as an HTML form with editable fields (including add/delete, preferably in accordance with with the document's XSD/DTD or other schema definition). I don't mind the actual form of this tool - could be implemented as a JSP/Servlet, ASP component, or browser plug-in for local or remote XML file access. Alternatively, it doesn't...
2
1909
by: Wayne Wengert | last post by:
I hope this is an appropriate group for this question? I work with a non-profit group that uses SQL Server 2000 for their data backend. They have a moderate size web site with many data driven web pages (ASP at the moment but looking to move to ASP.NET). They also have several custom written Windows applications (VB) that access the database. The people that manage the business have no IT background. They depend on volunteers like me...
51
7987
by: Matt | last post by:
Hello, I'm a hiring C++ developer employer looking for existing, online C++ aptitude tests. I have not yet extensively researched this yet, but as an example, I thought this test looked pretty good: http://expertrating.com/c++test.asp
1
2590
by: Johann Blake | last post by:
I am looking for a good solution on how to implement data access in an application so that there is a clean separation between the data access layer, the business layer and the GUI layer. I am looking for a robust solution for a major application. Almost every developer seems to come up with a completely different solution. While many of them are not bad, I really want a very good one. My database is SQL Server 2000 and I am using Visual...
1
1593
by: marklinehan | last post by:
Hi, my name is Mark Linehan. About 20 years ago or so I started learning how to program on the Commodore 64 computer (anyone remember those?) heheheh. I taught myself basic on this little machine to the point that there was nothing I could not do in basic on the 64 and started learning assembly language on it. I moved up to the Amiga, and dabbled in C. Then moved to an IBM 386. At that time I literally knew plain old MS-DOS version(s) of...
2
1568
by: Matt | last post by:
Hi, I am looking for a control that will allow me to host other controls inside it but have a method of showing and hiding. I have seen plenty of horizontal controls for doing this but I am looking for a vertical one. I would like to host my navigation tree in it on the left side of my web site and allow the user to hide and show it as needed to give me more visible real estate. I visualize something like when it is closed it has a small tab...
11
2356
by: matsi.inc | last post by:
I am looking to make something like a delegate that i can use in my projects but am having a hard time getting started. The behavior I am most interested in is how a delegate changes it's Invoke method dynamically to match the arguments supplied to it when it is defined. For example... public delegate void MyDelegate(string myString, int myInt);
12
2411
by: amogan | last post by:
**If interested & qualified, please reply with your resume directly to amogan@google.com** Referrals are always welcome!! Network System Test Engineer - Mountain View This position is available in Mountain View, CA.
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.