Dear Nick

Thanks a lot. I've fully understood your code. It is very helpful for me. Plese 
send my best regards to the people at Rovereto and Mattarello.

Best

Hiroyuki
-----Original message-----
From:Nick Oosterhof <[email protected]>
To:[email protected],Development and support pf PyMVPA 
<[email protected]>
Date:Tue, 25 Mar 2014 18:24:11
Subject:Re: [pymvpa] Extracting a part of dataset for a re-selection of voxels 
in the already selected features


On Mar 25, 2014, at 2:58 AM, akama.h.aa <[email protected]> wrote:

> Dear PyMVPA people
> 
> I'd like to extract from a Dataset only a corresponding part of some newly 
> re-selected voxels which should be a subset of (already) selected features.
> Is the following one I've made is good? Or did you already implemented a 
> similar one in the package? (I am not so self-confident)
> 
> def 
> getNewEventDatasetWithOnlyReselectedVoxels(OriginalEventDataset,ReslectedVoxelsIndices):
>   [...]

Your code may work (I did not see anything wrong in particular), but it can be 
implemented in an easier and faster fashion.

For example:

def select_subset(ds, reselected_indices):
    ds_indices_tuple=map(tuple, ds.fa.voxel_indices)
    reselected_indices_tuple=map(tuple, reselected_indices)

    ds_keep_indices=[i for i, index in enumerate(ds_indices_tuple)
                    if index in reselected_indices_tuple]
    return ds[:,ds_keep_indices]

I hope that helps.

Nick



_______________________________________________
Pkg-ExpPsy-PyMVPA mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa

Reply via email to