本文整理汇总了Python中nipy.neurospin.utils.design_matrix.dmtx_light函数的典型用法代码示例。如果您正苦于以下问题:Python dmtx_light函数的具体用法?Python dmtx_light怎么用?Python dmtx_light使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dmtx_light函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_dmtx1
def test_dmtx1():
"""
basic test based on basic_paradigm and canonical hrf
"""
tr = 1.0
frametimes = np.linspace(0, 127*tr,128)
paradigm = basic_paradigm()
hrf_model='Canonical'
X, names= dm.dmtx_light(frametimes, paradigm, hrf_model=hrf_model,
drift_model='Polynomial', drift_order=3)
assert_true(len(names)==7)
开发者ID:miketrumpis,项目名称:nipy,代码行数:11,代码来源:test_dmtx.py
示例2: test_dmtx17
def test_dmtx17():
"""
Test the effect of scaling on the events
"""
tr = 1.0
frametimes = np.linspace(0, 127*tr,128)
paradigm = modulated_event_paradigm()
hrf_model = 'Canonical'
X, names= dm.dmtx_light(frametimes, paradigm, hrf_model=hrf_model,
drift_model='Polynomial', drift_order=3)
assert_true((X[paradigm.onset[paradigm.con_id=='c0'].astype(np.int)+1,0]\
> 0).all())
开发者ID:miketrumpis,项目名称:nipy,代码行数:12,代码来源:test_dmtx.py
示例3: test_dmtx11
def test_dmtx11():
"""
check that the second column of the FIR design matrix is OK indeed
"""
tr = 1.0
frametimes = np.linspace(0, 127*tr,128)
paradigm = basic_paradigm()
hrf_model='FIR'
X, names= dm.dmtx_light(frametimes, paradigm, hrf_model=hrf_model,
drift_model='Polynomial', drift_order=3,
fir_delays=range(1,5))
onset = paradigm.onset[paradigm.con_id=='c0'].astype(np.int)
assert_true(np.all(X[onset+3, 2]==1))
开发者ID:miketrumpis,项目名称:nipy,代码行数:13,代码来源:test_dmtx.py
示例4: dmtx_light
"""
import numpy as np
from nipy.neurospin.utils.design_matrix import dmtx_light
tr = 1.0
frametimes = np.linspace(0,127*tr,128)
conditions = [0,0,0,1,1,1,3,3,3]
onsets=[30,70,100,10,30,90,30,40,60]
hrf_model = 'Canonical'
motion = np.cumsum(np.random.randn(128,6),0)
add_reg_names = ['tx','ty','tz','rx','ry','rz']
#event-related design matrix
paradigm = np.vstack(([conditions, onsets])).T
x1,name1 = dmtx_light(frametimes, paradigm, drift_model='Polynomial',
drift_order=3, add_regs=motion, add_reg_names=add_reg_names)
# block design matrix
duration = 7*np.ones(9)
paradigm = np.vstack(([conditions, onsets, duration])).T
x2,name2 = dmtx_light(frametimes, paradigm, drift_model='Polynomial', drift_order=3)
# FIR model
paradigm = np.vstack(([conditions, onsets])).T
hrf_model = 'FIR'
x3,name3 = dmtx_light(frametimes, paradigm, hrf_model = 'FIR',
drift_model='Polynomial', drift_order=3,
fir_delays = range(1,6))
import matplotlib.pylab as mp
mp.figure()
开发者ID:yarikoptic,项目名称:NiPy-OLD,代码行数:32,代码来源:demo_dmtx.py
示例5:
frametimes = np.linspace(0, (n_scans-1)*tr, n_scans)
conditions = np.arange(20)%2
onsets = np.linspace(5, (n_scans-1)*tr-10, 20) # in seconds
hrf_model = 'Canonical'
motion = np.cumsum(np.random.randn(n_scans, 6),0)
add_reg_names = ['tx','ty','tz','rx','ry','rz']
# write directory
swd = tempfile.mkdtemp()
########################################
# Design matrix
########################################
paradigm = dm.EventRelatedParadigm(conditions, onsets)
X, names = dm.dmtx_light(frametimes, drift_model='Cosine', hfcut=128,
hrf_model=hrf_model, paradigm=paradigm, add_regs=motion, add_reg_names=add_reg_names)
#######################################
# Get the FMRI data
#######################################
fmri_data = surrogate_4d_dataset(shape=shape, n_scans=n_scans)[0]
# if you want to save it as an image
data_file = op.join(swd,'fmri_data.nii')
save(fmri_data, data_file)
########################################
# Perform a GLM analysis
########################################
开发者ID:JohnGriffiths,项目名称:neuroutils,代码行数:32,代码来源:example_glm.py
注:本文中的nipy.neurospin.utils.design_matrix.dmtx_light函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论