[pymvpa] base.py

Emanuele Olivetti emanuele at relativita.com
Mon May 11 11:14:51 UTC 2009


Valentin Haenel wrote:
> Hi,
>
> I am looking at mvpa/datasets/base.py, line 986.
>
> This call to deepcopy has turned up in my current profiling run, and I was
> thinking about optimizing this somehow.
>
> I believe that the deepcopy call is only required when the ids will actually be
> sorted. I hope I am not missing the point, but I cannot see any other need for
> the ids to be copied.
>
> What are your thought on this?
>
>   

Hi Valentin,

I did that. Dataset.selectFeatures() - the method around line 986 - had
a undesirable (and unexpected by the user) side-effect on 'ids', which
is the list of IDs of the features (i.e. the columns numbers) you want
to select. The side effect was that your input list of ids were sorted
after calling Dataset.selectFeatures() with default values. This caused
me major headaches some time ago.

The correct fix to the issue is - you are right - is to make a copy only 
when
'sort' is True. But then I read the warning message in line 1010-1011.
Since I'm not fully aware of what's going on when IDs are not sorted, and
thinking that the desirable case is to sort IDs always, I preferred to be
conservative and make a copy of 'ids' always. Yes, it is not that smart ;-)

I do believe you can change and make a conditional copy.

Ciao,

Emanuele




More information about the Pkg-ExpPsy-PyMVPA mailing list