# HG changeset patch # User bergstrj@iro.umontreal.ca # Date 1206466731 14400 # Node ID 88168361a5ab12a2cf52598c187283d562ba6e04 # Parent 80bf5492e571d48cc7cfc5c0b914fb4d9fd9ea2a comment re: ArrayDataSet.__array__ diff -r 80bf5492e571 -r 88168361a5ab dataset.py --- a/dataset.py Tue Mar 25 11:39:02 2008 -0400 +++ b/dataset.py Tue Mar 25 13:38:51 2008 -0400 @@ -191,6 +191,15 @@ return ArrayDataSet(data=self.data[apply(slice,slice_args)],fields=self.fields) def __array__(self): + """Return an view of this dataset which is an numpy.ndarray + + Numpy uses this special function name to retrieve an ndarray view for + function such as numpy.sum, numpy.dot, numpy.asarray, etc. + + If this dataset has no fields, then we simply return self.data, + otherwise things are complicated. + - why do we want this behaviour when there are fields? (JB) + """ if not self.fields: return self.data # else, select subsets of columns mapped by the fields