Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Chris Barker wrote: hmm -- I wonder if a post to matplotlib-devel is in order. Most of those folks are on this list, to, but may not be following this thread. I'll post to matplotlib-devel shortly and see what response I get. By the way, it sounds like your contouring code is in C++ -- is that important? Yes, it is C++ and it is important - that's what I've got and hence that's what I'm offering! Portability should be fine as I'm only using some of the basic STL containers which are already used by, for example, the matplotlib delaunay code. Ian -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Ian Thomas wrote: Chris Barker wrote: I think it would be great to have in MPL. What code are you using for the triangulation? Does it do constrained delauney? My code only does the contouring; you have to input the triangulation. In the examples included with the code I used matplotlib.delaunay to do the triangulations so as not to reinvent the wheel. To include it in MPL, I would need to improve it somewhat (there are a couple of known bugs and insufficient documentation) and there would need to be a discussion of the API. At the moment I am using tricontour(x, y, triangulation_indices, z, optional_mask) followed by the usual contour args (N or V) and kwargs. Is this OK? I've also written utility plotting functions triplot, trifill and tripcolor; are these wanted? In terms of implementation, at the python level I have a TriContourSet class which is the same as the existing ContourSet apart from a few lines that deal with input arguments and calling the appropriate underlying C++ code. Ideally it would be sensible to refactor the common python code into a new class (BaseContourSet?) and have relatively thin derived ContourSet and TriContourSet classes. But I'm not sure you'd like a relatively new mpl contributor to change such important code... Ian, As the person who fixed major bugs in cntr.c, you have wizard status, so go ahead! I have no objection to some refactoring, so long as everything works in the end, and is no more difficult to read and maintain than what is there now--which I am sure could be improved even without the Tri additions. What sort of timeline do you have in mind? One possibility would be to develop the tri* functionality at least initially as a module in lib/mpl_toolkits, like axes_grid and mplot3d; or in a module in lib/matplotlib. This could still take advantage of refactoring in contour.py. An advantage is that it would consolidate the triangle functionality so it would be easier to find, track, and document. I copied this reply to the devel list--let's continue there as needed. Eric Ian -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Chris Barker wrote: ... snip ... To summarise, you recommend the following units of functionality: 1) Triangulation class to wrap existing delaunay code. 2) Separate the storage of and creation of contour sets so that you can create your own. 3) tricontour and tricontourf functions to contour a Triangulation. 4) Python utility plotting functions for a Triangulation (triplot, tripcolor, etc). 5) Simple wrappers for 3 and 4 so you can just pass in the points and the Triangulation is created for you behind the scenes. I am happy to make a start with this; no doubt it will take me a while. I should point out that I don't intend to tinker with the delaunay code, so we'll still be left with those pathological cases that it doesn't work with. Maybe this can be revisited when I'm done. Do you want it all in one go, or one unit of functionality at a time (my preference)? Thanks for this, I'm hope I'm not alone in thinking it's really useful stuff. Let's see! I'll hold off starting until there have been some votes for it from other people. Ian -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Ian Thomas wrote: To summarise, you recommend the following units of functionality: 1) Triangulation class to wrap existing delaunay code. The idea here is that it would provide a class that holds the result of the triangulation. Yes, it would use the existing delaunay code by default, and hopefully optionally use the not-as-good-a-license code the Robert Kern put in SciPy. In the future, I hope we can find a robust and well-licensed code -- I may be able to release some in-house code of ours for that some day. 2) Separate the storage of and creation of contour sets so that you can create your own. 3) tricontour and tricontourf functions to contour a Triangulation. 4) Python utility plotting functions for a Triangulation (triplot, tripcolor, etc). 5) Simple wrappers for 3 and 4 so you can just pass in the points and the Triangulation is created for you behind the scenes. yup -- that all sounds great! I am happy to make a start with this; wonderful! no doubt it will take me a while. I should point out that I don't intend to tinker with the delaunay code, so we'll still left with those pathological cases that it doesn't work with. Maybe this can be revisited when I'm done. hopefully, there still doesn't appear to be a really good delaunay code with a flexible license out there -- pity. Do you want it all in one go, or one unit of functionality at a time (my preference)? I don't see any reason to add it piecemeal, as long as the pieces are useful by themselves. Let's see! I'll hold off starting until there have been some votes for it from other people. hmm -- I wonder if a post to matplotlib-devel is in order. Most of those folks are on this list, to, but may not be following this thread. By the way, it sounds like your contouring code is in C++ -- is that important? I don't expect it should be that computationally expensive, though maybe hard to vectorize -- C++ does make portability harder, though there's a bunch in MPL already. If I was starting from scratch, I'd use Cython, if pure Python didn't cut it. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
On 2010-03-11 13:38 PM, Chris Barker wrote: Ian Thomas wrote: To summarise, you recommend the following units of functionality: 1) Triangulation class to wrap existing delaunay code. The idea here is that it would provide a class that holds the result of the triangulation. Yes, it would use the existing delaunay code by default, and hopefully optionally use the not-as-good-a-license code the Robert Kern put in SciPy. I did what now? -- 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 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Robert Kern wrote: the triangulation. Yes, it would use the existing delaunay code by default, and hopefully optionally use the not-as-good-a-license code the Robert Kern put in SciPy. I did what now? I thought you'd put a wrapper of a delaunay code that is GPL'd or something (not BSD compatible anyway) into a scikit or something? optional -- so it doesn't screw up licensing for those that don't want it. Anyway, the point is, for any code that might be put into MPL, we want a properly licensed compatible default, but ideally with the option of easily plug in in other, better, delaunay code that may not be license compatible. Now that I've written this, I really should go and look and see if I remember correctly: I've found this: http://scikits.appspot.com/delaunay Though I see no reference to license in there, so I presume it's under the same license as scipy. So I guess I was thinking of the natgrid toolkit, which I guess is not Robert's work, and is a substitute for nn interpolation, not triangulation. Sorry for writing too quickly. While I've got your attention, though -- I suspect you have looked for license compatible delaunay code and the stuff in the scikits package is as good as it gets? Thanks, -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
On 2010-03-11 15:49 PM, Chris Barker wrote: Robert Kern wrote: the triangulation. Yes, it would use the existing delaunay code by default, and hopefully optionally use the not-as-good-a-license code the Robert Kern put in SciPy. I did what now? I thought you'd put a wrapper of a delaunay code that is GPL'd or something (not BSD compatible anyway) into a scikit or something? optional -- so it doesn't screw up licensing for those that don't want it. Anyway, the point is, for any code that might be put into MPL, we want a properly licensed compatible default, but ideally with the option of easily plug in in other, better, delaunay code that may not be license compatible. Now that I've written this, I really should go and look and see if I remember correctly: I've found this: http://scikits.appspot.com/delaunay Though I see no reference to license in there, so I presume it's under the same license as scipy. So I guess I was thinking of the natgrid toolkit, which I guess is not Robert's work, and is a substitute for nn interpolation, not triangulation. Sorry for writing too quickly. Instead of addressing the misconceptions point by point, let me just lay out the situation: natgrid is a GPLed library for doing Delaunay triangulation and natural neighbor interpolation. The author is presumed to be deceased, so this code will always be GPLed. It seems to fail less often when doing the Delaunay triangulation on datasets in the wild; however, it is not using robust geometric primitives, so there probably still are cases where it fails. I wrote a BSD library for doing natural neighbor interpolation using the Delaunay triangulation code using the sweepline algorithm. This algorithm does not (and cannot) use robust geometric primitives, so there are datasets for which it fails to produce a valid triangulation. This is the code in scikits.delaunay. I have not pushed it to a 1.0 release because of this issue. However, this *was* put into matplotlib. matplotlib can optionally use natgrid if it is installed. While I've got your attention, though -- I suspect you have looked for license compatible delaunay code and the stuff in the scikits package is as good as it gets? Pretty much. I do have some code for constructing the Delaunay triangulation using robust primitives and an insertion algorithm, but it is an order of magnitude slower than scikits.delaunay. Ideally, we would be able to find or write a divide-and-conquer algorithm using Jon Shewchuk's robust geometric primitives. -- 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 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Chris Barker wrote: I think it would be great to have in MPL. What code are you using for the triangulation? Does it do constrained delauney? My code only does the contouring; you have to input the triangulation. In the examples included with the code I used matplotlib.delaunay to do the triangulations so as not to reinvent the wheel. To include it in MPL, I would need to improve it somewhat (there are a couple of known bugs and insufficient documentation) and there would need to be a discussion of the API. At the moment I am using tricontour(x, y, triangulation_indices, z, optional_mask) followed by the usual contour args (N or V) and kwargs. Is this OK? I've also written utility plotting functions triplot, trifill and tripcolor; are these wanted? In terms of implementation, at the python level I have a TriContourSet class which is the same as the existing ContourSet apart from a few lines that deal with input arguments and calling the appropriate underlying C++ code. Ideally it would be sensible to refactor the common python code into a new class (BaseContourSet?) and have relatively thin derived ContourSet and TriContourSet classes. But I'm not sure you'd like a relatively new mpl contributor to change such important code... Ian -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Hello all, I submitted some code to matplotlib-users last September to perform contouring of triangular grids. The posts and code can be found at: http://sourceforge.net/mailarchive/forum.php?thread_name=4AB3B95B.3090903%40noaa.govforum_name=matplotlib-users Like I wrote at the time, if it is useful to enough people I'm happy to improve the code provided it can be incorporated into mpl as I have no interest in maintaining it as a standalone project. Ian On 8 March 2010 23:33, gely g...@usc.edu wrote: Christopher Barker wrote: gely wrote: As I think about it, I'm going to have to write code to do this (contour an unstructured triangular mesh) sometime soon, so please let me know if it does exist already -- if not I'll try to remember to contribute it when I get around to it. -Chris Chris, I found this old thread. Did you ever find code to directly interpolate a triangulation? sorry, no, not yet. Do you already have the triangulation? if so, it's pretty easy to contour. Thanks for the reply. Yes. I have the triangulation as a list of point coordinates and a list of triangles with indices to the points. Good to know it's not difficult. I'll have to chew on this for a bit. -Geoff -- View this message in context: http://old.nabble.com/Contour-Plotting-of-Varied-Data-on-a-Shape-tp25089018p27829342.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Ian Thomas wrote: I submitted some code to matplotlib-users last September to perform contouring of triangular grids. The posts and code can be found at: http://sourceforge.net/mailarchive/forum.php?thread_name=4AB3B95B.3090903%40noaa.govforum_name=matplotlib-users Like I wrote at the time, if it is useful to enough people I'm happy to improve the code provided it can be incorporated into mpl as I have no interest in maintaining it as a standalone project. I think it would be great to have in MPL. What code are you using for the triangulation? Does it do constrained delauney? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Christopher Barker wrote: Erik Schweller wrote: My overall goal is to generate contour plots for a wide range of input data. The data points are not regularly spaced and do not align to any grid. The data points represent measurements taken from a model that can take on a variety of shapes. To make matters more difficult, I'd prefer not to interpolate around corners of the model. It strikes me that when you are working with unstructured data like this, it may be better to keep it unstrucured -- do the delanauy triangulation and directly contour from that. It's actually prety easy to contour a triangular mesh. Unfortunately, I haven't see code to do it in scipy or MPL. Am I wrong? Is there something there. If not, there really should be it seems a bit silly to shoehorn your data to a rectangular grid just to contour it. I suppose NN interpolation is essentially doing this already, but it introduces issues with a boundary that doesnt' line up to a rectangular grid. As I think about it, I'm going to have to write code to do this (contour an unstructured triangular mesh) sometime soon, so please let me know if it does exist already -- if not I'll try to remember to contribute it when I get around to it. -Chris Chris, I found this old thread. Did you ever find code to directly interpolate a triangulation? I need to do the same thing. Thanks, Geoff -- Geoffrey Ely g...@usc.edu http://earth.usc.edu/~gely/ Department of Earth Sciences University of Southern California Los Angeles, CA 90089-0740 -- View this message in context: http://old.nabble.com/Contour-Plotting-of-Varied-Data-on-a-Shape-tp25089018p27826931.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
gely wrote: As I think about it, I'm going to have to write code to do this (contour an unstructured triangular mesh) sometime soon, so please let me know if it does exist already -- if not I'll try to remember to contribute it when I get around to it. -Chris Chris, I found this old thread. Did you ever find code to directly interpolate a triangulation? sorry, no, not yet. Do you already have the triangulation? if so, it's pretty easy to contour. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Christopher Barker wrote: gely wrote: As I think about it, I'm going to have to write code to do this (contour an unstructured triangular mesh) sometime soon, so please let me know if it does exist already -- if not I'll try to remember to contribute it when I get around to it. -Chris Chris, I found this old thread. Did you ever find code to directly interpolate a triangulation? sorry, no, not yet. Do you already have the triangulation? if so, it's pretty easy to contour. Thanks for the reply. Yes. I have the triangulation as a list of point coordinates and a list of triangles with indices to the points. Good to know it's not difficult. I'll have to chew on this for a bit. -Geoff -- View this message in context: http://old.nabble.com/Contour-Plotting-of-Varied-Data-on-a-Shape-tp25089018p27829342.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour Plotting of Varied Data on a Shape
Erik Schweller wrote: My overall goal is to generate contour plots for a wide range of input data. The data points are not regularly spaced and do not align to any grid. The data points represent measurements taken from a model that can take on a variety of shapes. To make matters more difficult, I'd prefer not to interpolate around corners of the model. It strikes me that when you are working with unstructured data like this, it may be better to keep it unstrucured -- do the delanauy triangulation and directly contour from that. It's actually prety easy to contour a triangular mesh. Unfortunately, I haven't see code to do it in scipy or MPL. Am I wrong? Is there something there. If not, there really should be it seems a bit silly to shoehorn your data to a rectangular grid just to contour it. I suppose NN interpolation is essentially doing this already, but it introduces issues with a boundary that doesnt' line up to a rectangular grid. As I think about it, I'm going to have to write code to do this (contour an unstructured triangular mesh) sometime soon, so please let me know if it does exist already -- if not I'll try to remember to contribute it when I get around to it. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users