Thanks, Matt! (forwarded to list for general interest)

min_surf_interp might make a nice addition to the image library. Would you mind if
we snarfed it into the mainstream in a future release?

Cheers,
Craig


Begin forwarded message:

From: Matthew Kenworthy <[email protected]>
Date: April 30, 2009 10:12:04 AM MDT
To: Craig DeForest <[email protected]>
Subject: Re: [Perldl] Gridding irregularly sampled 2D data

Hi Craig,

I sent Steve a min_surf_interp.pdl routine I modified from IDL which
does what he wants. I' cc'ed the perldl list with the program, but I
think perldl keeps rejecting email from [email protected]
and [email protected].

If my email didn't make it to the list, I've attached the .pdl routine.

Cheers,

Matt

On Thu, Apr 30, 2009 at 9:05 AM, Craig DeForest
<[email protected]> wrote:
There's no universal way to do it.  If your data are not yet ordered,
I suggest triangulating them using one of the Delaunay triangulation
codes (for which you can Google).  That will give you a tiling of the
plane into triangles defined by nearby data points.  Once you've done
that, it's a "trivial" matter to interpolate values onto a structured
grid:  you can hop from triangle to triangle in the general direction
of the desired point, until you find the triangle that encloses your
grid point.  That triangle defines a trio of data points from which
you interpolate the value at the grid location.  If you loop
boustrophedonically down your grid then the triangle-searching step
will be extremely fast.

PDL itself is not so great at this kind of unstructured data problem
-- your best bet is to handle it in a PP or C subroutine that you
access through either the PDL::Inline module or the PP metalanguage.
You could prototype your code in Perl, but if you are going into
production it will be worth your while to write the compiled routine
to do it.

While I can't dive into the problem for the next 2-3 months, I'd be
interested in seeing this happen -- it would be a nice addition to the
PDL image library, and several other folks have had similar problems
over the years.

(Hmmm... I just realized that there's a "quick and dirty" way to to
this - once you've triangulated your data points I bet you could use
GL to do the interpolation for you.  It's intended for graphics
rendering, but GL can handle floating point "brightness" values.  It
can also render to an array in memory, which you could hand back to
the user.  That has the advantage that on most systems the
interpolation will run at GPU pipeline speed rather than plodding CPU
speed, and of course GL renders are meant to be completely
reproducible to within machine roundoff on different systems.)





On Apr 30, 2009, at 8:34 AM, Steve Longmore wrote:

Hi,

I'm trying to grid an irregularly sampled data set onto a linear 2D
grid
but am struggling to find a function to do this. I was hoping someone
could point me to a simple way of doing this.

Thanks,
Steve

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl




--
Matthew Kenworthy / Assistant Astronomer / Steward Observatory
933 N. Cherry Ave. / Tucson AZ 85721 / vox 520 626 6720

Attachment: min_curve_surf.pdl
Description: Binary data


_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to