Thanks again for your super quick and super helpful reply! There is still one thing that I don't quite get at the moment:
As expected, 'dsall' is a numpy.ndarray of dimensions 1*(numberVoxels*numberSubjects*numberParameters) - so just a really long vector. Since this is 'only' a vector, it does not have any attributes or other information associated with it. This information is still contained in 'dss', which is a list of size (numberSubjects*numberParameters) containing the respective datasets. I don't see right now how to bridge this information to the 'dsall'-array. After all, 'sphere_searchlight()' should also be called with a dataset, using this dataset's coordinates to determine the local neighborhoods, right? So I guess I still need the 'glue' to get it all together... ;-) Can you give me a hint on that? Cheers, Ulrike ----- Original Message ----- From: "Yaroslav Halchenko" <[email protected]> To: "pkg-exppsy-pymvpa" <[email protected]> Sent: Thursday, 5 November, 2015 15:14:24 Subject: Re: [pymvpa] Dataset with multidimensional feature vector per voxel On Thu, 05 Nov 2015, Ulrike Kuhl wrote: > Dear Yaroslav, > thanks a lot for your reply. > With your snipped it was really easy for me to set up the matrix as you > described it. :-) > For those interested, this is the code that works for me: > sub_list = [list of subjects] > param_list = [list of parameters] > dss = [] > for sub_index, sub in enumerate(sub_list): > for suf_index, suf in enumerate(param_list): > ds = fmri_dataset('/path/to/image/file',mask='/path/to/mask/file') > ds.fa['modality'] = [suf] * ds.nfeatures # for each > feature, set the modality attribute > ds.fa['modality_index'] = [suf_index] * ds.nfeatures # this as > numeric might come handy for searchlights later > if sub.startswith('L'): > learn = 1 > elif sub.startswith('N'): > learn = 0 > ds.sa['targets'] = [learn] > ds.sa['chunks'] = [sub_index] > dss.append(ds) > dsall = hstack(dss) Here is my tune up with # yoh: comments #################################### sub_list = [list of subjects] param_list = [list of parameters] dss = [] for sub_index, sub in enumerate(sub_list): for suf_index, suf in enumerate(param_list): ds = fmri_dataset('/path/to/image/file',mask='/path/to/mask/file') # yoh: no need to broadcast -- should do automagically ds.fa['modality'] = [suf] # for each feature, set the modality attribute ds.fa['modality_index'] = [suf_index] # this as numeric might come handy for searchlights later if sub.startswith('L'): learn = 1 elif sub.startswith('N'): learn = 0 else: # yoh: make it explicit, otherwise you would assign previous learn to next one not L or N raise ValueError("Do not know what to do with %s" % sub) # yoh: seems it was incorrectly indented into elif ds.sa['targets'] = [learn] ds.sa['chunks'] = [sub_index] dss.append(ds) dsall = hstack(dss) #################################### cheers -- Yaroslav O. Halchenko Center for Open Neuroscience http://centerforopenneuroscience.org Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755 Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419 WWW: http://www.linkedin.com/in/yarik _______________________________________________ Pkg-ExpPsy-PyMVPA mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa -- Max Planck Institute for Human Cognitive and Brain Sciences Department of Neuropsychology (A219) Stephanstraße 1a 04103 Leipzig Phone: +49 (0) 341 9940 2625 Mail: [email protected] Internet: http://www.cbs.mpg.de/staff/kuhl-12160 _______________________________________________ Pkg-ExpPsy-PyMVPA mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa

