[pymvpa] Error running dissimilarity analysis
Valentin Haenel
valentin.haenel at gmx.de
Wed Dec 16 11:04:28 UTC 2009
Would anyone of the senior developers like to comment on this, please.
V-
* Michael W. Cole <mwcole at gmail.com> [091214]:
> Hello Valentin,
>
> Thanks for the reply.
>
> I'm including the requested info:
> PyMVPA 0.4.3 on Fedora 10 x86_64.
>
> Here is the relevant part of the script:
>
> blockavged_dataset = NiftiDataset(samples=niftiFile,
> > labels=attrs.labels, chunks=attrs.chunks, labels_map={'cat1': 0,
> > 'cat2': 1, 'cat3': 2, 'cat4': 3, 'cat5': 4},
> > mask=maskFile)
> >
> > # remove first category from dataset
> > blockavged_dataset = blockavged_dataset.selectSamples(N.array([l != 0
> > for l in blockavged_dataset.labels],
> > dtype='bool'))
> >
> > """Create a dissimilarity matrix based on the labels of the data points
> > in our test dataset. This will allow us to see if there is a
> > correlation
> > between any given searchlight sphere and the experimental
> > conditions."""
> >
> > # create dissimilarity matrix using the 'confusion' distance
> > # metric
> > dsm = DSMatrix(blockavged_dataset.labels, 'confusion')
>
>
> #
> > # Run Searchlight
> > #
> >
> > # choose classifier
> > dsmetric = DSMDatasetMeasure(dsm, 'pearson', 'pearson')
> >
> > for radius in [6.4,9.6]:
> >
> > # tell which one we are doing
> > print "Running searchlight with radius: %.2fmm..." % (radius)
> >
> > # setup Searchlight with a custom radius
> > # radius has to be in the same unit as the nifti file's pixdim
> > # property.
> > sl = Searchlight(dsmetric, radius=radius)
> >
> > # run searchlight on example dataset and retrieve error map
> > sl_map = sl(blockavged_dataset)
> >
>
>
> Thank you,
> Michael
>
>
> On Sun, Dec 13, 2009 at 3:43 PM, Valentin Haenel <valentin.haenel at gmx.de>wrote:
>
> > Dear Micheal,
> >
> > could you please post pymvpa version, operating system, and the script you
> > are
> > using (if possible).
> >
> > The sphere size might not be the issue, since the searchlight will have
> > less
> > features at the edges of the brain, but its hard to tell from the error
> > message alone.
> >
> > thanks.
> >
> > V-
> >
> > * Michael W. Cole <mwcole at gmail.com> [091213]:
> > > I am trying to run a searchlight analysis based on the searchlight_dsm.py
> > > example. I'm doing a 4-way classification with 2-voxel radius spheres.
> > >
> > > It will run for a few spheres, then crash with this error:
> > >
> > > Traceback (most recent call last):
> > > File "<stdin>", line 1, in <module>
> > > File "pymvpa_script1.py", line 154, in <module>
> > > sl_map = sl(blockavged_dataset)
> > > File "/usr/lib64/python2.5/site-packages/mvpa/measures/base.py", line
> > 105,
> > > in __call__
> > > result = self._call(dataset)
> > > File "/usr/lib64/python2.5/site-packages/mvpa/measures/searchlight.py",
> > > line 108, in _call
> > > measure = self.__datameasure(sphere)
> > > File "/usr/lib64/python2.5/site-packages/mvpa/measures/ds.py", line 47,
> > in
> > > __call__
> > > test_mat = N.asarray([in_vec, dset_vec])
> > > File "/usr/lib64/python2.5/site-packages/numpy/core/numeric.py", line
> > 230,
> > > in asarray
> > > return array(a, dtype, copy=False, order=order)
> > > ValueError: setting an array element with a sequence.
> > >
> > > I've found that the spheres that work have 1830 values each in in_vec and
> > > dset_vec, but the sphere it crashes on only has 1540 values. I'm not sure
> > if
> > > this is related to the crash or not.
> > >
> > > Any ideas on how to get around this error?
> > >
> > > Thanks in advance!
> > >
> > > Michael
> > >
> > >
> > > --
> > > Michael W. Cole, Ph.D.
> > > Post-doctoral researcher
> > > Cognitive Control & Psychopathology Lab
> > > Washington University in St. Louis
> >
> > > _______________________________________________
> > > Pkg-ExpPsy-PyMVPA mailing list
> > > Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> > > http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa
> >
> >
> > _______________________________________________
> > Pkg-ExpPsy-PyMVPA mailing list
> > Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa
> >
>
>
>
> --
> Michael W. Cole, Ph.D.
> Post-doctoral researcher
> Cognitive Control & Psychopathology Lab
> Washington University in St. Louis
> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa
More information about the Pkg-ExpPsy-PyMVPA
mailing list