From: Benjamin R. <ben...@ou...> - 2012-04-30 01:16:06
|
On Sunday, April 29, 2012, Ignas Anikevičius wrote: > Hello everybody, > > On 28 April 2012 12:13, julien tayon <ju...@ta... <javascript:_e({}, > 'cvml', 'ju...@ta...');>> wrote: > >> First cpp stands for C Pre Processor, this tool usually does macro >> substitution in c, objective c, c++. Hence Cpp in the object is pretty >> much confusing when it seems to be talking about C++. >> > > Sorry for my ignorance, will know it in the future > > >> There is another simpler solution however : >> Do everything in python : python is a very powerfull gluing langage, >> the GIL ensuring that non thread-safe code is thread safe, it is very >> forgiving with code not design for concurrency. >> > > I wanted to write in Python as much code as possible, it is just some plot > commands are quite slow in matplotlib. For example, I want to work in polar > coordinate system to plot a function of 2 variables. For that I want to use > the np.meshgrid function and the plot the results with the pcolor command > from pyplot. The problem is that with a lot of data points it becomes very > slow, which is not acceptable if one wants to draw a lot of plots using > this function. Because the array is not ordered and points in space are at > irregular intervals, I could not use imshow, which is much much faster. So > I was thinking if there is some internal C++ API which I could use and > maybe speed up the plotting itself a bit. > > It would actually be very nice if I could do that as most of the toolkits, > which can interface with C/C++ do not have LaTeX capabilites. Gnuplot can > be used in C/C++, but as far as I remember it is not the most elegant way > of doing it... > > Going back to the topic, is there any potential to speed up some commands > (e.g. pcolor) by rewriting/extending them in Cython or C++? If yes, then > maybe I might tinker with the code at some point, when I have more free > time. > > Anyway, thanks for such detailed answers. > > All best, > Ignas A. > Use pcolormesh(). *much* faster if you can assume certain things about the domain. Ben Root |