[pymvpa] Multiple datasets in one hdf5 file

Yaroslav Halchenko debian at onerussian.com
Fri Jul 10 01:13:34 UTC 2015


On Fri, 10 Jul 2015, 孔令军 wrote:
>    Thank you so much for the replies!! I now have 15 subject's datasets in
>    one file

yeay!

> , but seem to still be missing something.

>    (I had used the h5save('/tmp/out.h5', [ds1, ds2]) to make the one file
>    consist of the 15 subjects. And can be loaded correctly) 

once again -- why [ds1, ds2] ?  that sounds like 2 datasets in a list
saved... Where are 15 subjects?

>    Working through the hyperalignment tutorial, after loading using h5load,
>    zscoring the individual datasets or inserting subject IDs to the
>    individual datasets doesn't work with my combined dataset file (missing
>    some attributes). It definitely works when using the example
>    hyperalignment dataset file though.The code and error display are showed
>    at the end.
>    Pardon me for the repeated questions on this. Would anyone please let me 
>    know if there is something I am neglecting to do before saving all
>    the datasets into the one file? Thank you very much!

>    >>> _ = [zscore(ds) for ds in ds_all]
>    Traceback (most recent call last):
>      File "<stdin>", line 1, in <module>
>      File "/usr/lib/pymodules/python2.7/mvpa2/mappers/zscore.py", line 286,
>    in zscore
>        zm.train(Dataset(ds))
>      File "/usr/lib/pymodules/python2.7/mvpa2/base/dataset.py", line 210, in
>    __init__
>        samples = np.array(samples)
>    ValueError: setting an array element with a sequence.

is ds_all something you loaded from that /tmp/out.h5? then it should be
a list of two datasets ([ds1, ds2]) and if those ds1, ds2 are datasets,
it should work....  what is output of 

print ds_all
? ;)
>    >>> for i,sd in enumerate(ds_all):
>    ...     sd.sa['subject'] = np.repeat(i, len(sd))
>    ...
>    Traceback (most recent call last):
>      File "<stdin>", line 2, in <module>
>    AttributeError: 'list' object has no attribute 'sa'

same here -- seems like ds_all is a list of lists, not a list of
datasets


-- 
Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist,            Psychological and Brain Sciences Dept.
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        



More information about the Pkg-ExpPsy-PyMVPA mailing list