[pymvpa] Mask in from_wizard generates no data.

Yaroslav Halchenko debian at onerussian.com
Wed Dec 10 15:38:33 UTC 2014


On Wed, 10 Dec 2014, Thomas Nickson wrote:

>    Ah, I see what I have done now, after I loaded the fmri dataset and
>    checked it seems that the from_wizard function wants as input for the mask
>    the set of indices from the flattened mask array and I was not doing this.

can't be that the only way -- boolean mask must work too.
we even have a unittest ;)

@reseed_rng()
def test_feature_masking():
    mask = np.zeros((5, 3), dtype='bool')
    mask[2, 1] = True
    mask[4, 0] = True
    data = Dataset.from_wizard(np.arange(60).reshape((4, 5, 3)),
                               targets=1, chunks=1, mask=mask)

    # check simple masking
    ok_(data.nfeatures == 2)
    ...


>    I wonder if anyone knows if the numpy array function .flatten() is
>    equivalent to how the data mapper handles the flattening or I should do
>    this some other way?

I believe so (test!) -- it doesn't use 'flatten' but 'reshape' though

>    Also this function is confusingly constructed. 

I am just still confused on what is the  problem here since boolean masks
should have worked.  Once again -- if you just shared ds/mask -- we could look
and resolve the mystery.

> Should I restructure it so
>    that it just accepts nifti files? Or are people happy with it this way?

why to limit applicability?

-- 
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