decoder array indexing error

33 views
Skip to first unread message

Mark Orloff

unread,
Mar 18, 2020, 4:55:21 PM3/18/20
to neurosynth

Hi,


I am trying to run a decoding analysis and as far as I can tell I've been matching the tutorial:



import neurosynth as ns
import numpy
from neurosynth.base.dataset import Dataset
from neurosynth.analysis import decode

baseDir
= '/Volumes/rtpinf/'
nsDir
= '/Volumes/pinfadol/behavReplication/neurosynthData/'
saveLoc
= baseDir+'nsDecodeResults/modelResults.txt'

dataset
= Dataset.load(nsDir+'dataset.pkl')
decoder
= decode.Decoder(dataset, features=['social'])
result
= decoder.decode('social.nii.gz', save=saveLoc)


, but I keep getting these warnings/errors:


/Users/maorloff/.pyenv/versions/2.7.7/lib/python2.7/site-packages/neurosynth/analysis/meta.py:136: RuntimeWarning: invalid value encountered in divide

  pFgA = pAgF * pF / pA

/Users/maorloff/.pyenv/versions/2.7.7/lib/python2.7/site-packages/neurosynth/analysis/meta.py:141: RuntimeWarning: invalid value encountered in divide

  pFgA_prior = pAgF * prior / pA_prior

Traceback (most recent call last):

  File "decodeFromNeurosynth.py", line 19, in <module>

    result = decoder.decode('social.nii.gz', save=saveLoc)

  File "/Users/maorloff/.pyenv/versions/2.7.7/lib/python2.7/site-packages/neurosynth/analysis/decode.py", line 90, in decode

    imgs_to_decode = imageutils.load_imgs(images, self.masker)

  File "/Users/maorloff/.pyenv/versions/2.7.7/lib/python2.7/site-packages/neurosynth/base/imageutils.py", line 57, in load_imgs

    data[:, i] = masker.mask(f, nan_to_num)

  File "/Users/maorloff/.pyenv/versions/2.7.7/lib/python2.7/site-packages/neurosynth/base/mask.py", line 162, in mask

    masked_data = image[self.current_mask]

IndexError: boolean index did not match indexed array along dimension 0; dimension is 153594 but corresponding boolean dimension is 902629


Any idea what is going on? I've tried the current version as well as the version on the github repo. I've also tried with Python 2.7 (as shown above) and Python 3.5.


Thanks!

Mark

Mark Orloff

unread,
Mar 19, 2020, 1:11:03 PM3/19/20
to neurosynth
In case anyone has this same issue, I found the solution in a post in this group from 2014. The image to be decoded needs to be resampled to be 91 x 109 x 91(aligned to MNI 152 2mm template).
Reply all
Reply to author
Forward
0 new messages