[pymvpa] Copying Mappingdata from multiple datasets

Michael Hanke mih at debian.org
Wed Aug 3 08:48:08 UTC 2011


On Wed, Aug 03, 2011 at 04:11:20PM +0800, Zhen Zonglei wrote:
>  Is there a easy way to do this in 0.6 ?
> 
> Dataset.append() did not work in my test.

Yes, in the new code we removed all those adhoc functions in favor of
the more familiar numpy-like hstack() and vstack().

  >>> import mvpa2.datasets as md
  >>> ds1=md.Dataset([5,6,7])
  >>> ds2=md.Dataset([1,2,3])
  >>> md.hstack((ds1,ds2))
  Dataset(array([[5, 1],
                 [6, 2],
                 [7, 3]]),
          sa=SampleAttributesCollection(items=[]),
          fa=FeatureAttributesCollection(items=[]),
          a=DatasetAttributesCollection(items=[]))
   >>> md.vstack((ds1,ds2))
   Dataset(array([[5],
                  [6],
                  [7],
                  [1],
                  [2],
                  [3]]),
           sa=SampleAttributesCollection(items=[]),
           fa=FeatureAttributesCollection(items=[]),
           a=DatasetAttributesCollection(items=[]))

HTH,

Michael

-- 
Michael Hanke
http://mih.voxindeserto.de



More information about the Pkg-ExpPsy-PyMVPA mailing list