Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## [Plplot-general] Another conceptional issue using griddata

 [Plplot-general] Another conceptional issue using griddata From: Paul Wellner Bou - 2008-03-13 15:54:26 ```Hello, as you might have seen, after some days of trying around I am now able to create a regular grid with griddata(). Now, using griddata, I have to decide which gridding algorithm to use. As I used the delauny triangulation method in Matlab before, I would like to use this one with Plplot, too. But using GRID_DTLI (Delaunay Triangulation Linear Interpolation) I get a regular grid full of NaNs. Thats fine, but not what I need. As the cubic spline method is another possible way to get "good" data, I tried this one, too. I get a half NaN matrix. The rest of the values are ok. The linear interpolation algorithm is too bad for my case. Well, my data is from a wavefront tracing through an eye glass blank. So the result points (x, y, z) in the x-y-layer are those: http://m21s26.vlinux.de/math/datapoints.png So I would understand if there are a lot of NaNs around the data. Is there a way to use the DTLI algorithm to get a kind of data like in http://m21s26.vlinux.de/math/gsg.png? Thanks very much. Regards Paul. ```

 [Plplot-general] Another conceptional issue using griddata From: Paul Wellner Bou - 2008-03-13 15:54:26 ```Hello, as you might have seen, after some days of trying around I am now able to create a regular grid with griddata(). Now, using griddata, I have to decide which gridding algorithm to use. As I used the delauny triangulation method in Matlab before, I would like to use this one with Plplot, too. But using GRID_DTLI (Delaunay Triangulation Linear Interpolation) I get a regular grid full of NaNs. Thats fine, but not what I need. As the cubic spline method is another possible way to get "good" data, I tried this one, too. I get a half NaN matrix. The rest of the values are ok. The linear interpolation algorithm is too bad for my case. Well, my data is from a wavefront tracing through an eye glass blank. So the result points (x, y, z) in the x-y-layer are those: http://m21s26.vlinux.de/math/datapoints.png So I would understand if there are a lot of NaNs around the data. Is there a way to use the DTLI algorithm to get a kind of data like in http://m21s26.vlinux.de/math/gsg.png? Thanks very much. Regards Paul. ```
 Re: [Plplot-general] Another conceptional issue using griddata From: Alan W. Irwin - 2008-03-13 18:49:23 ```On 2008-03-13 16:54+0100 Paul Wellner Bou wrote: > Hello, > > as you might have seen, after some days of trying around I am now able > to create a regular grid with griddata(). > > Now, using griddata, I have to decide which gridding algorithm to use. > As I used the delauny triangulation method in Matlab before, I would > like to use this one with Plplot, too. > > But using GRID_DTLI (Delaunay Triangulation Linear Interpolation) I get > a regular grid full of NaNs. Thats fine, but not what I need. > > As the cubic spline method is another possible way to get "good" data, I > tried this one, too. I get a half NaN matrix. The rest of the values are ok. > > The linear interpolation algorithm is too bad for my case. > > Well, my data is from a wavefront tracing through an eye glass blank. So > the result points (x, y, z) in the x-y-layer are those: > http://m21s26.vlinux.de/math/datapoints.png > So I would understand if there are a lot of NaNs around the data. Since your pattern of points is confined to a circular area (and rather complete within that area), my suggestion is to try using polar coordinates throughout. Now example 21 obviously uses rectangular coordinates for plgriddata, but I presume plgriddata should work just as it is for any two-dimensional coordinate system. Furthermore, example 16's last page (see http://plplot.sourceforge.net/examples-data/demo16/x16.05.png) shows plshades can be used with any two-dimensional coordinate system. > > Is there a way to use the DTLI algorithm to get a kind of data like in > http://m21s26.vlinux.de/math/gsg.png? I think yes. Once you get plgriddata and plshades working for polar coordinates it should be a simple matter to use plbox to make a rectangular box around the circular area created by plshades. You can arrange the plbox call so the tick marks on the box are for rectangular coordinates corresponding to the polar coordinates used for plshades. Good luck with the polar-coordinate implementation along the lines I have suggested. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ```
 Re: [Plplot-general] Another conceptional issue using griddata From: Paul Wellner Bou - 2008-03-14 10:01:35 ```Hello, Thank you for your answer. > Since your pattern of points is confined to a circular area (and rather > complete within that area), my suggestion is to try using polar coordinates > throughout. Now example 21 obviously uses rectangular coordinates for > plgriddata, but I presume plgriddata should work just as it is for any > two-dimensional coordinate system. Yes, this should work. I will have a look. Not sure if there is the time to implement this. Perhaps it is easier to calculate the rays which intersect with the eye glass in exactly the points of a rectangular grid. > Furthermore, example 16's last page (see > http://plplot.sourceforge.net/examples-data/demo16/x16.05.png) shows > plshades can be used with any two-dimensional coordinate system. Ok, this looks good. This example shows me that it is possible to draw a graph of a circle without filling the whole rectangle. >> Is there a way to use the DTLI algorithm to get a kind of data like in >> http://m21s26.vlinux.de/math/gsg.png? > > I think yes. Once you get plgriddata and plshades working for polar > coordinates it should be a simple matter to use plbox to make a rectangular > box around the circular area created by plshades. You can arrange the plbox > call so the tick marks on the box are for rectangular coordinates > corresponding to the polar coordinates used for plshades. Puh... I don't understand this at this moment. I'll have to dive into it. Converting it to polar coordinates, ok. This should be no problem. Then I would get (I hope so...) a regular grid in polar coordinates. But if I convert it back it may not be regular, in x-y, right? Hm, not sure how to implement this, but it should be possible in any way. Thank you and regards Paul. ```
 Re: [Plplot-general] Another conceptional issue using griddata From: Arjen Markus - 2008-03-14 07:26:01 ```Paul Wellner Bou wrote: >Hello, > >as you might have seen, after some days of trying around I am now able >to create a regular grid with griddata(). > >Now, using griddata, I have to decide which gridding algorithm to use. >As I used the delauny triangulation method in Matlab before, I would >like to use this one with Plplot, too. > >But using GRID_DTLI (Delaunay Triangulation Linear Interpolation) I get >a regular grid full of NaNs. Thats fine, but not what I need. > >As the cubic spline method is another possible way to get "good" data, I >tried this one, too. I get a half NaN matrix. The rest of the values are ok. > >The linear interpolation algorithm is too bad for my case. > >Well, my data is from a wavefront tracing through an eye glass blank. So >the result points (x, y, z) in the x-y-layer are those: >http://m21s26.vlinux.de/math/datapoints.png >So I would understand if there are a lot of NaNs around the data. > >Is there a way to use the DTLI algorithm to get a kind of data like in >http://m21s26.vlinux.de/math/gsg.png? > > Quite apart from the suggestion by Alan, what platform are you working on? I have seen this type of problems before on Windows, but we (the original author and me) have not been able to figure out why this happened. Perhaps it is time to revisit this issue (in the near future at least) ... Regards, Arjen ```
 Re: [Plplot-general] Another conceptional issue using griddata From: Arjen Markus - 2008-03-14 09:53:11 ```Paul Wellner Bou wrote: > Hello, > >> Quite apart from the suggestion by Alan, what platform are you >> working on? > > > I am working on windows. I am starting now to test the code I wrote on > windows as the final application is targeted mainly for windows > systems (the company who will use the software is using windows). But > I did not try Plplot with windows yet. > >> I have seen this type of problems before on Windows, but we (the >> original author and me) have not been able to figure out why this >> happened. >> >> Perhaps it is time to revisit this issue (in the near future at >> least) ... > > > Would be great... not sure if I will find time to dive into this, but > I would like to. > > Best regards > Paul. > Hi Paul, the various gridding options are part of one of the examples - that shows the effects and would be the starting ground for any code diving, I'd say. (Apart from this issue, if it still exists, PLplot is doing fine on Windows ;)) Regards, Arjen ```
 Re: [Plplot-general] Another conceptional issue using griddata From: Paul Wellner Bou - 2008-03-14 10:19:56 ```Hello again, I thought about other possibilities... well, the nicest way would be a triangulation working like the matlab griddata function. As the griddata in matlab is a compiled mex file and the source not published I can't have a look inside it. There are a few workarounds... 1) Using polar coordinates as Alan Irwin suggested. Using this method I have to trust the triangulation alogrithm of plplot to work right with more or less rectangular data. 2) As this is a ray (wave front) tracing result it would be possible to calculate the rays in a way to produce a rectangular grid. As side effect I would save calculation time: As the intersections of rays and spline surfaces is done by iterations (newton) I would save this step if I define the intersections before and just calculate then the resulting direction. Concerning this fact, an interesting idea. 3) Converting the circular eye glass blanks to rectangles. Calculating the rays through them and using plgriddata to calculate the regular grid. As in 1) I have to assume that the plgriddata function works everytime as expected. I could cut the points outside the circle off, later, before drawing them and before defining the contour levels. Perhaps the best way would be a mixture between 2) and 3). Using a rectangular spot with rays going through a rectangular eye glass. I'll try... Thanks very much and regards Paul. ```
 Re: [Plplot-general] Another conceptional issue using griddata From: Alan W. Irwin - 2008-03-14 19:05:00 ```On 2008-03-14 11:01+0100 Paul Wellner Bou wrote: >> I think yes. Once you get plgriddata and plshades working for polar >> coordinates it should be a simple matter to use plbox to make a rectangular >> box around the circular area created by plshades. You can arrange the plbox >> call so the tick marks on the box are for rectangular coordinates >> corresponding to the polar coordinates used for plshades. > > Puh... I don't understand this at this moment. I'll have to dive into > it. Converting it to polar coordinates, ok. This should be no problem. > Then I would get (I hope so...) a regular grid in polar coordinates. But > if I convert it back it may not be regular, in x-y, right? By all means, plot the plshades result in a circular area. Set up plbox to make a square object that fits around that circular area. All my remark meant is you will have to make the x and y tick marks of the box correspond to r cos theta, r sin theta where r and theta are the polar coordinates. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ```