[pymvpa] Extracting a part of dataset for a re-selection of voxels in the already selected features
akama.h.aa
akama.h.aa at m.titech.ac.jp
Wed Mar 26 04:46:53 UTC 2014
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 <nikolaas.oosterhof at unitn.it>
To:akama.h.aa at m.titech.ac.jp,Development and support pf PyMVPA <pkg-exppsy-pymvpa at lists.alioth.debian.org>
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 <akama.h.aa at m.titech.ac.jp> 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
More information about the Pkg-ExpPsy-PyMVPA
mailing list