John Hunter wrote:
> But numpy.asarray, which is what mpl uses to convert inputs to
> arrays,

The whole idea of asarray, is that it should be able to convert properly
defined objects without even copying the data.

> my own custom class which contains data members, methods and an array
> of data (underlying C array)

This sounds like EXACTLY the type of object that the array interface is 
supposed to support. So what you need to do is give your object an array 
interface:

http://numpy.scipy.org/array_interface.shtml

once you've done that, asarray() should "just work" and therefore all of 
MPL should just work.

However, I would post a question about this to the numpy list -- there 
is an effort at the moment to have an n-d buffer protocol defined for 
Python 3.0.

http://projects.scipy.org/mailman/listinfo/numpy-discussion

I'm not sure at this point whether you'd be best off implementing the 
above interface or the new buffer protocol that's being discussed:

http://projects.scipy.org/scipy/numpy/browser/trunk/numpy/doc/pep_buffer.txt

The numpy folks will be able to help.

By the way, this is a good example why the above PEP is a good idea!

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[EMAIL PROTECTED]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to