From: Alan W. I. <ir...@be...> - 2002-05-27 00:32:13
|
I can answer (see below) all but the callback question, which I leave to the others here. Alan email: ir...@be... phone: 250-727-2902 FAX: 250-721-7715 snail-mail: Dr. Alan W. Irwin Department of Physics and Astronomy, University of Victoria, P.O. Box 3055, Victoria, British Columbia, Canada, V8W 3P6 __________________________ Linux-powered astrophysics __________________________ On Sun, 26 May 2002, Gary Bishop wrote: > What is the "wrap" argument to some of the functions in the Python API? > > Is this some additional functionality that is not in the C api? Yes. It's a flag which is 0 (no wrap), 1 (wrap first coordinate), or 2 (wrap second coordinate). This coordinate wrap idea got started with the Tcl API and migrated to the python and java API's. The idea is most useful when dealing with polar coordinates (see polar examples for the contour plots (xw09.py) and the shade plots (xw16.py). When wrap is set, the first angle point is duplicated as the last point by the interface code so that contours and shades are smooth. BTW, it would be nice if this argument *was* in the C API. To the C experts here, is there a way to do that without messing up all those C users who use the current C API without a wrap argument? > > I ask because I'm making a python wrapper with SWIG and I don't know how to > handle this argument. > > I've got all the demos running with a SWIG description file that handles all > the array/length tricks and handles the PLFLT double/float trick. As I have told Gary privately before, getting double/float to work right for the python binding would be a big win for the swig approach since that would be a pain to hand code. > It is mostly > just a copy of the plplot.h file with some tricky SWIG typemaps. > > The complications are the irregular interfaces to plcont, plstyl, plshade*, > etc. I can whip them with python help functions. Are these irregular > interfaces documented anywhere? Ultimately, they should be documented in a specialized python API chapter of the documentation at http://plplot.sourceforge.net/resources/docbook-manual/plplotdoc-html-0.4.3/ similar to the current Chapter 17 which attempts to deal with the specialized fortran API. But for now, the only place where they are documented (actually not too badly if you look at the detailed comments) is plmodule.c. > > Another question. Do the callback arguments get used for much? I believe I > could set up the python interface to support python callbacks for these > functions if it is worth the effort. The "data" argument would become an > arbitrary Python object in that case. Should be fine. I cannot answer this one. Alan |