[pymvpa] mapper.reverse1

Florian Baumgartner florian.baumgartner at ovgu.de
Mon Mar 29 15:36:05 UTC 2010


Hi all,

I currently try to adapt my old PyMVPA scripts to the new snapshot
version. Using the a Event-Related Mapper on fMRI-data I am getting a
memory error when I try to remap a data vector back in the original
space. Converting all samples of the dataset back works fine. Do you
have any suggestion for the solution?

Thanks
Florian

>> ds = fmri_dataset(fmri_src,mask=brainmask_src)
>> evds = eventrelated_dataset(ds, events=evs)

>> poly_detrend(evds, polyord=1, 
>>		chunks_attr='chunks'
>>		#,opt_regs=McFlirtParams(mcpar_src)  <-- how is that
>>	working by the way
		)
>>  zscore(evds, chunks_attr='chunks')

>>evds.mapper
ChainMapper(mappers=[FlattenMapper(shape=(25, 160, 160),
inspace='voxel_indices'), FeatureSliceMapper(slicearg=array([False,
False, False, ..., False, False, False], dtype=bool), dshape=(640000,),
inspace=None), BoxcarMapper(boxlength=3, offset=0, startpoints=[  8
20  24  26  30  44  63  64  68  72  81  90 108 116 124 127 129 138 142
164 176 183 187 190 214 232 243 251 263 265 271 274 276 282 290 295 306
316 330 346 356 358 361 363 375 378 392 395 406 413 434 438 441 445 457
467 478 481 487 495 517 519 531 539 552 559 565 568 577 584 586 589 608
617 620 622 632 645 653 655 662 666 675 677 710 720 722 747 750 752 756
767 777 783 785 791], inspace='event'), FlattenMapper(shape=(3,
115211), inspace=None), PolyDetrendMapper(polyord=1,
chunks_attr='chunks', opt_regs=None, inspace=None),
ZScoreMapper(inspace=None)], inspace=None)

>>evds.shape
(96, 345633)

>>evds.mapper.reverse1(zeros(evds.shape[1]))

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

/media/data/feanor/baumgartner/binding/master2.py in <module>()
----> 1
      2
      3
      4
      5

/usr/lib/pymodules/python2.5/mvpa/mappers/base.pyc in reverse1(self,
data) 751                           "Reversing single %s-shaped input
though '%s'." 752                            % (mp.shape, str(m)))
--> 753                 mp = m.reverse1(mp)
    754             except NotImplementedError:
    755                 if __debug__:

/usr/lib/pymodules/python2.5/mvpa/mappers/base.pyc in reverse1(self,
data) 262         """
    263         if isinstance(data, np.ndarray):
--> 264             return self.reverse(data[np.newaxis])[0]
    265         else:
    266             return self.reverse(np.array([data]))[0]

/usr/lib/pymodules/python2.5/mvpa/mappers/base.pyc in reverse(self,
data) 251             return self._reverse_dataset(data)
    252         else:
--> 253             return self._reverse_data(data)
    254
    255

/usr/lib/pymodules/python2.5/mvpa/mappers/base.pyc in
_reverse_data(self, data) 376         # features
    377         mapped.resize(data.shape[:1] + self.__dshape +
data.shape[2:], --> 378                       refcheck=False)
    379         mapped.fill(0)
    380         mapped[:, self._slicearg] = data

MemoryError: cannot allocate memory for array

>>evds.mapper.reverse(zeros(evds.shape))

works fine


>> wtf()
     
Current date:   2010-03-29 18:26
PyMVPA:                         
 Version:       0.5.0.dev+783+gde39
 Path:          /usr/lib/pymodules/python2.5/mvpa/__init__.pyc
 Version control (GIT):                                       
 GIT information could not be obtained due
"/usr/lib/pymodules/python2.5/mvpa/.. is not under GIT"
SYSTEM: OS:            posix Linux 2.6.32-trunk-amd64 #1 SMP Sun Jan 10
22:40:40 UTC 2010 Distribution:
debian/squeeze/sid
EXTERNALS: Present:       atlas_fsl, cPickle, ctypes, good
scipy.stats.rv_discrete.ppf, griddata, gzip, libsvm, libsvm verbosity
control, lxml, matplotlib, mdp, mdp ge 2.4, nifti, nifti ge
0.20090205.1, numpy, pylab, pylab plottable, pywt, pywt wp reconstruct,
reportlab, running ipython env, scipy, sg ge 0.6.4, sg ge 0.6.5,
sg_fixedcachesize, shogun, shogun.krr, shogun.mpd Absent:
atlas_pymvpa, elasticnet, glmnet, good scipy.stats.rdist, h5py,
hcluster, lars, nipy, nose, openopt, pprocess, pywt wp reconstruct
fixed, rpy, rpy2, shogun.lightsvm, shogun.svrlight, weave Versions of
critical externals: shogun:full : 0.9.1_r4481_2009-11-16_10:14_
shogun:rev  : 4481 reportlab   : 2.4 shogun      : 0.9.1 scipy       :
0.7.0 ipython     : 0.10 mdp         : 2.5 numpy       : 1.3.0
ctypes      : 1.0.3 matplotlib  :
0.99.1.1 lxml        :
2.2.6 nifti       :
0.20090303.1 numpy       :
1.3.0 pywt        :
0.1.7 shogun      :
v0.9.1_r4481_2009-11-16_10:14_ Matplotlib backend:
TkAgg
RUNTIME: PyMVPA Environment
Variables: PyMVPA Runtime
Configuration:
[externals] have griddata =
yes have pprocess =
no have atlas_pymvpa =
no have good scipy.stats.rdist =
no have pylab plottable =
yes have pywt wp reconstruct =
yes have ctypes =
yes have lxml =
yes have running ipython env =
yes have sg_fixedcachesize =
yes have elasticnet =
no have shogun.mpd =
yes have matplotlib =
yes have pywt wp reconstruct fixed =
no have scipy =
yes have reportlab =
yes have openopt =
no have libsvm =
yes have nifti ge 0.20090205.1 =
yes have nose =
no have weave =
no have atlas_fsl =
yes have h5py =
no have hcluster =
no have sg ge 0.6.4 =
yes have sg ge 0.6.5 =
yes have good scipy.stats.rv_discrete.ppf =
yes have libsvm verbosity control =
yes have mdp ge 2.4 =
yes have shogun.svrlight =
no have rpy =
no have lars =
no have nipy =
no have glmnet = no
  have shogun = yes
  have nifti = yes
  have shogun.krr = yes
  have cpickle = yes
  have mdp = yes
  have numpy = yes
  have pylab = yes
  have rpy2 = no
  have shogun.lightsvm = no
  have pywt = yes
  have gzip = yes

  [general]
  verbose = 1
 Process Information:
  Name: ipython
  State:        R (running)
  Tgid: 14328
  Pid:  14328
  PPid: 14310
  TracerPid:    0
  Uid:  1021    1021    1021    1021
  Gid:  100     100     100     100
  FDSize:       256
  Groups:       24 29 33 44 46 100 105 1001 1003
  VmPeak:        2867388 kB
  VmSize:        2360292 kB
  VmLck:               0 kB
  VmHWM:         2414668 kB
  VmRSS:         1898968 kB
  VmData:        1954300 kB
  VmStk:             264 kB
  VmExe:            1148 kB
  VmLib:           67648 kB
  VmPTE:            4476 kB
  Threads:      2
  SigQ: 0/16382
  SigPnd:       0000000000000000
  ShdPnd:       0000000000000000
  SigBlk:       0000000000000000
  SigIgn:       0000000001001000
  SigCgt:       0000000180000002
  CapInh:       0000000000000000
  CapPrm:       0000000000000000
  CapEff:       0000000000000000
  CapBnd:       ffffffffffffffff
  Cpus_allowed: ffff
  Cpus_allowed_list:    0-15
  Mems_allowed: 00000000,00000001
  Mems_allowed_list:    0
  voluntary_ctxt_switches:      4242
  nonvoluntary_ctxt_switches:   3961
  Stack usage:  260 kB



More information about the Pkg-ExpPsy-PyMVPA mailing list