Re: plot (x,y,z) triplets as a surface? When is regridding necessary ? [message #17861] |
Sun, 14 November 1999 00:00 |
Kristian Kjaer
Messages: 58 Registered: June 1998
|
Member |
|
|
David Fanning wrote:
> I've been meaning to write an article about gridding
> data for a SURFACE plot for about 5 years now. This
> question finally pushed me over the edge. You can find
> it here:
> http://www.dfanning.com/tips/grid_surface.html
Nice, David.
You might want to include a few lines about when regridding is
necessary, and when not.
Example:
We collect x-ray scattering data INT (nx x ny array) vs. angles x
(nx-array) and y (ny-array). Then we can visualize the data by
IDL> contour INT,x,y ;or
IDL> surface INT,x,y
So far, so good. In fact, this also works with 2dimensional x and y
arrays:
IDL> xx=x#(1.+y-y)
IDL> yy=(1.+x-x)#y
IDL> contour INT,xx,yy
Now we had to non-linearly transform the angles xx and yy to zz and ww
(zz and ww reside in reciprocal space, if the truth be told).
For several years we were regridding the INT data, using trigrid, in
order to get a regular grid in (z,w) space. This gave us INT_regridded
(nz x nw array) vs. z_regridded (nz array) and w_regridded (nw array).
Then we could visualize the data (in reciprocal space) by
IDL> contour INT_regridded,z_regridded,w_regridded
Only later did we discover that
IDL> contour INT,zz,ww
gave the desired plot without interpolation of the INT observations, and
for much less cpu-time (back when that was a consideration).
In short: Even with non-rectangularly gridded data,
a) Regridding is not *always* necessary !
b) When *is* regridding necessary ?
BTW, in IDL3.6.1 there was a bug (somehow related to whether you refer
to the centre or the corner of the pixel) such that, using trigrid, we
ended up with the INT pattern displaced by one-half pixel. And,
generally, interpolation should be avoided if at all possible.
- Kristian
|
|
|