本文整理汇总了Python中mvpa2.datasets.Dataset.sa['mc_'+param]方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.sa['mc_'+param]方法的具体用法?Python Dataset.sa['mc_'+param]怎么用?Python Dataset.sa['mc_'+param]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mvpa2.datasets.Dataset
的用法示例。
在下文中一共展示了Dataset.sa['mc_'+param]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from mvpa2.datasets import Dataset [as 别名]
# 或者: from mvpa2.datasets.Dataset import sa['mc_'+param] [as 别名]
def run(args):
from mvpa2.base.hdf5 import h5save
ds = None
if not args.txt_data is None:
verbose(1, "Load data from TXT file '%s'" % args.txt_data)
samples = _load_from_txt(args.txt_data)
ds = Dataset(samples)
elif not args.npy_data is None:
verbose(1, "Load data from NPY file '%s'" % args.npy_data)
samples = _load_from_npy(args.npy_data)
ds = Dataset(samples)
elif not args.mri_data is None:
verbose(1, "Load data from MRI image(s) %s" % args.mri_data)
from mvpa2.datasets.mri import fmri_dataset
vol_attr = dict()
if not args.add_vol_attr is None:
# XXX add a way to use the mapper of an existing dataset to
# add a volume attribute without having to load the entire
# mri data again
vol_attr = dict(args.add_vol_attr)
if not len(args.add_vol_attr) == len(vol_attr):
warning("--vol-attr option with duplicate attribute name: "
"check arguments!")
verbose(2, "Add volumetric feature attributes: %s" % vol_attr)
ds = fmri_dataset(args.mri_data, mask=args.mask, add_fa=vol_attr)
if ds is None:
if args.data is None:
raise RuntimeError('no data source specific')
else:
ds = hdf2ds(args.data)[0]
else:
if args.data is not None:
verbose(1, 'ignoring dataset input in favor of other data source -- remove either one to disambiguate')
# act on all attribute options
ds = process_common_dsattr_opts(ds, args)
if not args.add_fsl_mcpar is None:
from mvpa2.misc.fsl.base import McFlirtParams
mc_par = McFlirtParams(args.add_fsl_mcpar)
for param in mc_par:
verbose(2, "Add motion regressor as sample attribute '%s'"
% ('mc_' + param))
ds.sa['mc_' + param] = mc_par[param]
verbose(3, "Dataset summary %s" % (ds.summary()))
# and store
outfilename = args.output
if not outfilename.endswith('.hdf5'):
outfilename += '.hdf5'
verbose(1, "Save dataset to '%s'" % outfilename)
h5save(outfilename, ds, mkdir=True, compression=args.hdf5_compression)