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