[pymvpa] IndexError from gnbsearchlight analysis

Zhen Zonglei zonglei.fsl at gmail.com
Mon Jul 25 05:53:49 UTC 2011


Hi,guys

I used the following code to do GNB searchlight analysis,
# GNB searchlight analysis
dataset = alldata[timeselect,spatialslelect ]
sl=
sphere_gnbsearchlight(GNB(),NFoldPartitioner(),radius=3,postproc=mean_sample())
 res  = sl(dataset)
sphere_errors = res.samples[0]

BUT,  the errors were reported(see bellow). The version I used is pymvpa
0.6.
In addition, with the similar code, the general searchlight analysis can run
sucessfully.
 # Genearal searchlight analysis
 75                 cv =
CrossValidation(linearCSVMC(),NFoldPartitioner(),errorfx=lambda p, t:
np.mean(p == t),enabl    e_ca=['stats'])
 76                 sl =
sphere_searchlight(cv,radius=3,postproc=mean_sample())
 77                 res  = sl(dataset)
 78                 sphere_errors = res.samples[0]


So, what happened in GNB searchlight analysis?

Zonglei Zhen


-----------------IndexError from GNB searchlight
analysis------------------------

In [2]: from gnbsearchlight import *
Warning: divide by zero encountered in log
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (43, 0))

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

//mystudy/code/python/<ipython console> in <module>()
//mystudy/code/python/gnbsearchlight.py in <module>()
     70                 #GNB searchlight
sl =
sphere_gnbsearchlight(GNB(),NFoldPartitioner(),radius=3,postproc=mean_sample())
---> 72                 res  = sl(dataset)
     73                 sphere_errors = res.samples[0]
     74

/usr/local/neurosoft/lib/python2.6/site-packages/mvpa/base/learner.pyc in
__call__(self, ds)
    220                                    "used and auto training is
disabled."
    221                                    % str(self))
--> 222         return super(Learner, self).__call__(ds)
    223
    224

/usr/local/neurosoft/lib/python2.6/site-packages/mvpa/base/node.pyc in
__call__(self, ds)
     74
     75         self._precall(ds)
---> 76         result = self._call(ds)
     77         result = self._postcall(ds, result)
     78

/usr/local/neurosoft/lib/python2.6/site-packages/mvpa/measures/searchlight.pyc
in _call(self, dataset)
    108
    109         # pass to subclass

--> 110         results, roi_sizes = self._sl_call(dataset, roi_ids, nproc)
    111
    112         if not roi_sizes is None:

/usr/local/neurosoft/lib/python2.6/site-packages/mvpa/measures/gnbsearchlight.pyc
in _sl_call(self, dataset, roi_ids, nproc)
    459             norm_weight = -0.5 * np.log(2*np.pi*variances)
    460             # last added dimension would be for ROIs

--> 461             logpriors = np.log(priors[:, np.newaxis, np.newaxis])
    462
    463             if __debug__:

IndexError: 0-d arrays can only use a single () or a list of newaxes (and a
single ...) as an index
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20110725/45b90442/attachment.html>


More information about the Pkg-ExpPsy-PyMVPA mailing list