• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python design_matrix.dmtx_light函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python testing.assert_almost_equal函数代码示例发布时间:2022-05-27
下一篇:
Python glm.FMRILinearModel类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap