[pymvpa] little bugs in (Mapped)Dataset.selectFeatures ?

Michael Hanke michael.hanke at gmail.com
Tue Mar 17 19:26:28 UTC 2009


On Tue, Mar 17, 2009 at 05:45:28PM +0100, Emanuele Olivetti wrote:
> In line 130 of mvpa/datasets/mapped.py the MappedDataset.selectFeatutures()
> calls "Dataset.selectFeatures(self, ids)" to do the actual selection.
> Unfortunately the two methods has different default values for "sort":
>  MappedDataset.selectFeatutures(self, ids, plain=False, sort=False)
> while
>  Dataset.selectFeatures(self, ids=None, sort=True, groups=None)
> so the call in line 130 overrides MappedDataset with Dataset default value.
> This means that whatever choice of "sort" is made in MappedDataset, it is
> not considered when calling MappedDataset.selectFeatutures(). In other
> words you get sorted features always, even if you say sort=False.
> 
> I guess that line 130 should be simply:
>     sdata = Dataset.selectFeatures(self, ids, sort)
> But I'd like to ask your opinion on this since the Datasets architecture
> and details are not fully clear to me yet.

That sounds all sane to me (while the current behavior of that method is
not ;-).

I'd even say do 'selectFeatures(ids, sort=sort)'

> Another detail: if you choose to sort IDs (sort=True) then the vector of
> IDs "ids" passed as argument to the selectFeatures() method is sorted as
> well. When the user calls MappedDataset.selectFeatutures(ids) he/she
> gets a new dataset and... unexpectedly "ids" is sorted. This caused a
> bit of headache to me today. Is this unexpected side-effect necessary?

No, this is also a bug.

> P.S. If you prefer, you can just express your opinions and I'll made the
> fixes.

I'd very much appreciate if you do that, thanks!


Michael

-- 
GPG key:  1024D/3144BE0F Michael Hanke
http://apsy.gse.uni-magdeburg.de/hanke
ICQ: 48230050



More information about the Pkg-ExpPsy-PyMVPA mailing list