From: Doug H. <hu...@ma...> - 2003-12-15 20:15:23
|
On Mon, 15 Dec 2003, Rafael Laboissiere wrote: Rafael: Thanks for working on perl/PDL demos for plplot! The re-ordering of non-numeric arguments to the end of the parameter list is a painful necessity brought on by a limitation in the 'PP' interface language used by PDL. All non-numeric arguments must be put into a category known as 'otherpars' which must go at the end. I don't like this, but I know it would be complex to fix. Any comments from the PDL list? In most cases, I tried to keep the same interface used in C, so plstyl still has the 'count' argument which is unnecessary since one can determine the count from the PDL. When I wrote the interface, I just wrote a parser for the PLplot header file and had it automatically generate a PDL interface. I made little attempt to tune things such as redundant arguments. In the case of 'plline', I wrote an improved interface for this function which handles data with gaps and bad values, so I was able to choose to get rid of the 'count' argument. I do all my work from an object oriented higher level interface: my $pl = PDL::Graphics::PLplot(DEV => 'png', FILE => 'foo.png', etc...); $pl->xyplot($x, $y); $pl->close; So I figured I could leave some ugliness in the lower level interface which maps directly to the C interface. So, in summary: The mis-ordered arguments should be fixed, but it would require a new feature in PDL to accomplish this. Redundant arguments in some functions should be fixed, but it might break a small number of existing PDL/PLplot scripts. I'll try to get to this. My intention was that people use the higher level interface so as not to have to worry about these interface idiosyncrasies. Best Regards, Doug Hunt > [Cc:ing to plplot-devel. PLplot developers: see http://pdl.perl.org for > background.] > > Hi Doug, > > PDL 2.4 has been finally uploaded to Debian unstable and it is built with > PLplot support. I decided then to port the C demos of the main PLplot > distribution to Perl. I just committed to CVS the first translated file > (examples/perl/x01.pl), which works out of the box. I will eventually > finish this work, but progress will be slow. > > It is just great to plot directly from Perl using PLplot, specially because > of the fancy PDL constructs for vector manipulation. For instance, the `for' > loops in the C demo x01c.c: > > for (i = 0; i < 60; i++) { > x[i] = xoff + xscale * (i + 1) / 60.0; > y[i] = yoff + yscale * pow(x[i], 2.); > } > > becomes in Perl: > > $x = pdl ($xoff + $xscale * pdl ([1..60]) / 60.0); > $y = pdl ($yoff + $yscale * ($x ** 2.)); > > In the process of translating the x01.pl demo, I noticed that you changed > the prototype of plbox, by putting the xopt and yopt parameters at the end. > Is there a compelling reason for departing so much from the C prototype? I > think this may confuse the user. > > Also, I noticed that some functions that accept piddles as arguments (like > plstyl) still need a first parameter telling the length of the vectors. This > is not needed for plline, for instance, and it might be a good idea to > extend that to the other functions. > > Anyway, thanks for developing these much-needed, long overdue PDL bindings > for PLplot! > > -- dh...@uc... Software Engineer III UCAR - COSMIC, Tel. (303) 497-2611 |