On 3/2/07, John Hunter <[EMAIL PROTECTED]> wrote:
John said:
...here is the minimal interface that
appears to work
class C(object):
def __init__(self):
self._data = (1,2,3,4,5)
def __getitem__(self, i):
return self._data[i]
def __len__(self):
return len(se
On 3/2/07, Alan Isaac <[EMAIL PROTECTED]> wrote:
> John asked:
> > What is the minimum interface for an object to be
> > converted to a numpy sequence via as array?
>
> The class must inherit from object.
> That will probably do it.
> If all else fails, try fromiter.
>
I know it works with fromi
On Friday 02 March 2007 14:12:24 John Hunter wrote:
> I still am not able to make my mock-up custom python class work as I
> would like with asarray (though it works with "list"). What am I
> missing? The way I read it this appears to be in support of extension
> code that wants to expose the ar
John asked:
> What is the minimum interface for an object to be
> converted to a numpy sequence via as array?
The class must inherit from object.
That will probably do it.
If all else fails, try fromiter.
Alan Isaac
-
Take
On 3/2/07, Christopher Barker <[EMAIL PROTECTED]> wrote:
> 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
I still am not able to make m
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 (
On 3/2/07, Simon Wood <[EMAIL PROTECTED]> wrote:
python > Out of the box matplotlib works great with Numeric and
numarray data types.
> However, I have my own custom class which contains data members, methods and
> an array of data (underlying C array). Is there a way to expose the C array
> data
On Fri, Mar 02, 2007 at 08:46:24AM -0600, Glen W. Mabey wrote:
> P.S. You may also need to implement functions like __len__; if these
> concepts are well-defined for your class, then it should be a very
> straightforward process.
But the problem is (if your experience is similar to mine) that then
On Fri, Mar 02, 2007 at 08:44:02AM -0600, Glen W. Mabey wrote:
> One approach that I've used recently is to simply provide functionality
> for the [] operator (done by implementing the __getslice__ member
> function) that accesses the data according to standard slicing rules.
> Then, you can use pl
On Fri, Mar 02, 2007 at 09:41:03AM -0500, Simon Wood wrote:
> Out of the box matplotlib works great with Numeric and numarray data types.
> However, I have my own custom class which contains data members, methods and
> an array of data (underlying C array). Is there a way to expose the C array
> da
Out of the box matplotlib works great with Numeric and numarray data types.
However, I have my own custom class which contains data members, methods and
an array of data (underlying C array). Is there a way to expose the C array
data to the plot() routines? For example I would like to be able to u
11 matches
Mail list logo