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

Python pyhrf.get_data_file_name函数代码示例

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

本文整理汇总了Python中pyhrf.get_data_file_name函数的典型用法代码示例。如果您正苦于以下问题:Python get_data_file_name函数的具体用法?Python get_data_file_name怎么用?Python get_data_file_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_data_file_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_ward_spatial_real_data

    def test_ward_spatial_real_data(self):
        from pyhrf.glm import glm_nipy_from_files

        fn = 'subj0_parcellation.nii.gz'
        mask_file = pyhrf.get_data_file_name(fn)

        bold = 'subj0_bold_session0.nii.gz'
        bold_file = pyhrf.get_data_file_name(bold)

        paradigm_csv_file = pyhrf.get_data_file_name('paradigm_loc_av.csv')
        output_dir = self.tmp_dir
        output_file = op.join(output_dir,
                              'parcellation_output_test_real_data.nii')

        tr = 2.4
        bet = glm_nipy_from_files(bold_file, tr,
                                  paradigm_csv_file, output_dir,
                                  mask_file, session=0,
                                  contrasts=None,
                                  hrf_model='Canonical',
                                  drift_model='Cosine', hfcut=128,
                                  residuals_model='spherical',
                                  fit_method='ols', fir_delays=[0])[0]

        logger.info('betas_files: %s', ' '.join(bet))

        cmd = 'pyhrf_parcellate_glm -m %s %s -o %s -v %d -n %d '\
            '-t ward_spatial ' \
            % (mask_file, ' '.join(bet), output_file,
               logger.getEffectiveLevel(), 10)

        if os.system(cmd) != 0:
            raise Exception('"' + cmd + '" did not execute correctly')
        logger.info('cmd: %s', cmd)
开发者ID:pyhrf,项目名称:pyhrf,代码行数:34,代码来源:test_parcellation.py


示例2: test_load_fmri_surf_data

    def test_load_fmri_surf_data(self):
        """ Test surfacic data loading
        """
        mesh_file = pyhrf.get_data_file_name('real_data_surf_tiny_mesh.gii')
        bold_file = pyhrf.get_data_file_name('real_data_surf_tiny_bold.gii')
        fn = 'real_data_surf_tiny_parcellation.gii'
        parcel_file = pyhrf.get_data_file_name(fn)

        # boldFn = pyhrf.get_data_file_name('localizer_surface_bold.tex')
        # roiMaskFn = pyhrf.get_data_file_name('roimask_gyrii.tex')
        # meshFn = pyhrf.get_data_file_name('right_hemisphere.mesh')
        #g, b, ss, m, h = load_fmri_surf_data([boldFn, boldFn],  meshFn,
        #                                     roiMaskFn)


        # graph, bold, session_scans, mask, edge lengthes
        #pyhrf.verbose.set_verbosity(3)
        g, b, ss, m, el = load_fmri_surf_data([bold_file, bold_file],
                                              mesh_file,
                                              parcel_file)
        assert len(g) == len(np.unique(m))

        if 0:
            first_parcel = g.keys()[0]
            print len(g), 'g[%d]:'%first_parcel, len(g[first_parcel])
            print 'edge lengthes of roi %d:' %first_parcel
            print el[first_parcel]
            print b[first_parcel].shape
            print ss[0][0],'-',ss[0][-1],',',ss[1][0],'-',ss[1][-1]
            print m.shape, _np.unique(m)
开发者ID:thomas-vincent,项目名称:pyhrf,代码行数:30,代码来源:iotest.py


示例3: setDummyInputData

    def setDummyInputData(self, xmlFile):

        f = open(xmlFile, 'r')
        xml = f.read()
        t = xmlio.from_xml(xml)
        if t.data.data_type == 'volume':
            dataFn = pyhrf.get_data_file_name('dummySmallBOLD.nii.gz')
            maskFn = pyhrf.get_data_file_name('dummySmallMask.nii.gz')
            sd = FMRISessionVolumicData(bold_file=dataFn)
            t.set_init_param('fmri_data',
                             FmriData.from_vol_ui(mask_file=maskFn,
                                                  sessions_data=[sd]))

        elif t.data.data_type == 'surface':
            fn = 'real_data_surf_tiny_bold.gii'
            dataFn = pyhrf.get_data_file_name(fn)
            fn = 'real_data_surf_tiny_parcellation.gii'
            maskFn = pyhrf.get_data_file_name(fn)
            fn = 'real_data_surf_tiny_mesh.gii'
            meshFn = pyhrf.get_data_file_name(fn)
            sd = FMRISessionSurfacicData(bold_file=dataFn)
            t.set_init_param('fmri_data',
                             FmriData.from_surf_ui(mask_file=maskFn,
                                                   mesh_file=meshFn,
                                                   sessions_data=[sd]))
        else:
            raise Exception('Unsupported class ... todo')

        f = open(xmlFile, 'w')
        f.write(xmlio.to_xml(t))
        f.close()
开发者ID:pyhrf,项目名称:pyhrf,代码行数:31,代码来源:commandTest.py


示例4: setDummyInputData

    def setDummyInputData(self, xmlFile):

        f = open(xmlFile, "r")
        xml = f.read()
        t = xmlio.fromXML(xml)
        if t.data.data_type == "volume":
            dataFn = pyhrf.get_data_file_name("dummySmallBOLD.nii.gz")
            maskFn = pyhrf.get_data_file_name("dummySmallMask.nii.gz")
            sd = FMRISessionVolumicData(bold_file=dataFn)
            t.set_init_param("fmri_data", FmriData.from_vol_ui(mask_file=maskFn, sessions_data=[sd]))

        elif t.data.data_type == "surface":
            fn = "real_data_surf_tiny_bold.gii"
            dataFn = pyhrf.get_data_file_name(fn)
            fn = "real_data_surf_tiny_parcellation.gii"
            maskFn = pyhrf.get_data_file_name(fn)
            fn = "real_data_surf_tiny_mesh.gii"
            meshFn = pyhrf.get_data_file_name(fn)
            sd = FMRISessionSurfacicData(bold_file=dataFn)
            t.set_init_param("fmri_data", FmriData.from_surf_ui(mask_file=maskFn, mesh_file=meshFn, sessions_data=[sd]))
        else:
            raise Exception("Unsupported class ... todo")

        f = open(xmlFile, "w")
        f.write(xmlio.toXML(t, handler=NumpyXMLHandler()))
        f.close()
开发者ID:philouc,项目名称:pyhrf,代码行数:26,代码来源:commandTest.py


示例5: test_read_default_real_data_tiny

    def test_read_default_real_data_tiny(self):
        mesh_file = pyhrf.get_data_file_name('real_data_surf_tiny_mesh.gii')
        bold_file = pyhrf.get_data_file_name('real_data_surf_tiny_bold.gii')
        fn = 'real_data_surf_tiny_parcellation.gii'
        parcel_file = pyhrf.get_data_file_name(fn)

        cor, tri, mesh_gii = pio.read_mesh(mesh_file)
        bold, bold_gii = pio.read_texture(bold_file)
        parcellation, parcel_gii = pio.read_texture(parcel_file)
开发者ID:rcherbonnier,项目名称:pyhrf,代码行数:9,代码来源:iotest.py


示例6: setUp

    def setUp(self):
        tag = "subj0_%s.nii.gz"
        self.func_file = pyhrf.get_data_file_name(tag % "bold_session0")
        self.anatomy_file = pyhrf.get_data_file_name(tag % "anatomy")
        self.roi_mask_file = pyhrf.get_data_file_name(tag % "parcellation")

        self.ax_slice = 24
        self.sag_slice = 7
        self.cor_slice = 34

        self.tmp_dir = pyhrf.get_tmp_path()  #'./'
开发者ID:philouc,项目名称:pyhrf,代码行数:11,代码来源:test_plot.py


示例7: setUp

    def setUp(self):
        tag = 'subj0_%s.nii.gz'
        self.func_file = pyhrf.get_data_file_name(tag%'bold_session0')
        self.anatomy_file = pyhrf.get_data_file_name(tag%'anatomy')
        self.roi_mask_file = pyhrf.get_data_file_name(tag%'parcellation')

        self.ax_slice = 24
        self.sag_slice = 7
        self.cor_slice = 34

        self.tmp_dir = pyhrf.get_tmp_path() #'./'
开发者ID:thomas-vincent,项目名称:pyhrf,代码行数:11,代码来源:test_plot.py


示例8: test_load_fmri_surf_data

    def test_load_fmri_surf_data(self):
        """ Test surfacic data loading
        """
        mesh_file = pyhrf.get_data_file_name('real_data_surf_tiny_mesh.gii')
        bold_file = pyhrf.get_data_file_name('real_data_surf_tiny_bold.gii')
        fn = 'real_data_surf_tiny_parcellation.gii'
        parcel_file = pyhrf.get_data_file_name(fn)

        g, b, ss, m, el = pio.load_fmri_surf_data([bold_file, bold_file],
                                                  mesh_file,
                                                  parcel_file)
        assert len(g) == len(np.unique(m))
开发者ID:rcherbonnier,项目名称:pyhrf,代码行数:12,代码来源:iotest.py


示例9: test_frmi_vol

 def test_frmi_vol(self):
     """ Test volumic data loading
     """
     boldFn = get_data_file_name('subj0_bold_session0.nii.gz')
     roiMaskFn = get_data_file_name('subj0_parcellation.nii.gz')
     g, b, ss, m, h = pio.load_fmri_vol_data([boldFn, boldFn], roiMaskFn)
     if 0:
         print len(g), g[1]
         print b[1].shape
         print ss
         print m.shape, np.unique(m)
         print h
开发者ID:rcherbonnier,项目名称:pyhrf,代码行数:12,代码来源:iotest.py


示例10: test_read_default_real_data_tiny

    def test_read_default_real_data_tiny(self):
        mesh_file = pyhrf.get_data_file_name('real_data_surf_tiny_mesh.gii')
        bold_file = pyhrf.get_data_file_name('real_data_surf_tiny_bold.gii')
        fn = 'real_data_surf_tiny_parcellation.gii'
        parcel_file = pyhrf.get_data_file_name(fn)

        cor, tri, mesh_gii = read_mesh(mesh_file)
        bold, bold_gii = read_texture(bold_file)
        parcellation, parcel_gii = read_texture(parcel_file)

        if 0:
            print 'cor:', cor.shape, cor.dtype
            print 'tri:', tri.shape, tri.dtype
            print 'bold:', bold.shape, bold.dtype
            print 'parcellation:', parcellation.shape, parcellation.dtype
开发者ID:thomas-vincent,项目名称:pyhrf,代码行数:15,代码来源:iotest.py


示例11: load_many_hrf_territories

def load_many_hrf_territories(nb_hrf_territories):
    from pyhrf.tools._io import read_volume

    fn = pyhrf.get_data_file_name("simu_hrf_%d_territories.nii" % nb_hrf_territories)
    assert op.exists(fn)
    territories = read_volume(fn)[0]
    return territories[np.where(np.ones_like(territories))]
开发者ID:pyhrf,项目名称:pyhrf,代码行数:7,代码来源:scenarios.py


示例12: _test_spm_option_parse

    def _test_spm_option_parse(self, spm_ver):
        """
        Test parsing of option "-s SPM.mat" with given SPM version (int)
        """
        spm_file = op.join(self.tmp_dir, 'SPM_v{}.mat'.format(spm_ver))
        tools._io._zip.gunzip(pyhrf.get_data_file_name('SPM_v%d.mat.gz' % spm_ver),
                              outFileName=spm_file)

        options = ['-s', spm_file]
        from optparse import OptionParser
        parser = OptionParser()
        ptr.append_common_treatment_options(parser)

        fd = ptr.parse_data_options(parser.parse_args(options)[0])

        self.assertEqual(fd.tr, 2.4)  # nb sessions
        p = fd.paradigm
        # nb sessions
        self.assertEqual(len(p.stimOnsets[p.stimOnsets.keys()[0]]), 2)
        npt.assert_almost_equal(p.stimOnsets['audio'][0],
                                ppar.onsets_loc_av['audio'][0])
        npt.assert_almost_equal(p.stimOnsets['audio'][1],
                                ppar.onsets_loc_av['audio'][0])
        npt.assert_almost_equal(p.stimOnsets['video'][1],
                                ppar.onsets_loc_av['video'][0])
开发者ID:pyhrf,项目名称:pyhrf,代码行数:25,代码来源:test_treatment.py


示例13: test_paradigm_csv2

 def test_paradigm_csv2(self):
     pfn = get_data_file_name('paradigm_loc_av.csv')
     o, d = pio.load_paradigm_from_csv(pfn, " ")
     if 0:
         print 'onsets:'
         print o
         print 'durations:'
         print d
开发者ID:rcherbonnier,项目名称:pyhrf,代码行数:8,代码来源:iotest.py


示例14: test_split4DVol

    def test_split4DVol(self):
        s = 'subj0_bold_session0.nii.gz'
        bfn = pyhrf.get_data_file_name(s)
        bold_files = pio.split4DVol(bfn, output_dir=self.tmp_dir)
        i, meta = pio.read_volume(bold_files[0])

        for bf in bold_files:
            os.remove(bf)
开发者ID:rcherbonnier,项目名称:pyhrf,代码行数:8,代码来源:iotest.py


示例15: _test_load_regnames

 def _test_load_regnames(self, spm_ver):
     spm_file = op.join(pyhrf.get_tmp_path(), 'SPM.mat')
     pio._zip.gunzip(pyhrf.get_data_file_name('SPM_v%d.mat.gz' % spm_ver),
                     outFileName=spm_file)
     expected = ['Sn(1) audio*bf(1)', 'Sn(1) video*bf(1)',
                 'Sn(2) audio*bf(1)', 'Sn(2) video*bf(1)',
                 'Sn(1) constant', 'Sn(2) constant']
     self.assertEqual(pio.spmio.load_regnames(spm_file), expected)
开发者ID:rcherbonnier,项目名称:pyhrf,代码行数:8,代码来源:iotest.py


示例16: load_drawn_labels

def load_drawn_labels(name):
    fn = pyhrf.get_data_file_name('simu_labels_%s.png' %name)
    if not op.exists(fn):
        raise Exception('Unknown label map %s (%s)' %(name,fn))

    from scipy.misc import fromimage
    from PIL import Image
    labels = fromimage(Image.open(fn))
    return labels[np.newaxis,:,:]
开发者ID:pmesejo,项目名称:pyhrf,代码行数:9,代码来源:scenarios.py


示例17: test_glm_with_files

    def test_glm_with_files(self):

        output_dir = self.tmp_dir

        bold_name = 'subj0_bold_session0.nii.gz'
        bold_file = pyhrf.get_data_file_name(bold_name)
        tr = 2.4

        paradigm_name = 'paradigm_loc_av.csv'
        paradigm_file = pyhrf.get_data_file_name(paradigm_name)

        mask_name = 'subj0_parcellation.nii.gz'
        mask_file = pyhrf.get_data_file_name(mask_name)

        from pyhrf.glm import glm_nipy_from_files
        glm_nipy_from_files(bold_file, tr, paradigm_file, output_dir,
                            mask_file)

        self.assertTrue(op.exists(output_dir))
开发者ID:pyhrf,项目名称:pyhrf,代码行数:19,代码来源:test_glm.py


示例18: load_hrf_territories

def load_hrf_territories(nb_hrf_territories=0, hrf_territories_name=None):
    if hrf_territories_name is not None:
        fn = pyhrf.get_data_file_name("simu_hrf_%s.png" % hrf_territories_name)
        if not op.exists(fn):  # HACK #TODO improve this
            fn = pyhrf.get_data_file_name(hrf_territories_name)

    else:
        fn = pyhrf.get_data_file_name("simu_hrf_%d_territories.png" % nb_hrf_territories)
    assert op.exists(fn)
    from scipy.misc import fromimage
    from PIL import Image

    territories = fromimage(Image.open(fn))
    territories = territories[np.newaxis, :, :]
    t = territories[np.where(np.ones_like(territories))]
    labels = np.unique(territories)
    for ilab, lab in enumerate(labels):
        t[np.where(t == lab)] = ilab
    return t
开发者ID:pyhrf,项目名称:pyhrf,代码行数:19,代码来源:scenarios.py


示例19: load_drawn_labels

def load_drawn_labels(name):
    fn = pyhrf.get_data_file_name("simu_labels_%s.png" % name)
    if not op.exists(fn):
        raise Exception("Unknown label map %s (%s)" % (name, fn))

    from scipy.misc import fromimage
    from PIL import Image

    labels_image = Image.open(fn)
    labels_image = labels_image.convert("L")
    labels = fromimage(labels_image)
    return labels[np.newaxis, :, :]
开发者ID:pyhrf,项目名称:pyhrf,代码行数:12,代码来源:scenarios.py


示例20: test_split4DVol

    def test_split4DVol(self):
        s = 'subj0_bold_session0.nii.gz'
        bfn = pyhrf.get_data_file_name(s)
        bold_files = split4DVol(bfn, output_dir=self.tmp_dir)
        #print bold_files
        i,meta = read_volume(bold_files[0])

        if 0:
            affine, header = meta
            print ''
            print 'one vol shape:'
            print i.shape
            print 'header:'
            pprint.pprint(dict(header))

        for bf in bold_files:
            os.remove(bf)
开发者ID:thomas-vincent,项目名称:pyhrf,代码行数:17,代码来源:iotest.py



注:本文中的pyhrf.get_data_file_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python pyhrf.get_tmp_path函数代码示例发布时间:2022-05-25
下一篇:
Python utils.decode_entities函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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