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

Python uf.buildtree函数代码示例

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

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



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

示例1: len

                RT = line['RT']
            if len(line['ans'])>1:
                ans = line['ans'][1:]
            if cond.id[0] == 'M':
                cond_nums = (onset, RT, ans)
            if cond.id[0] == 'L':
                cond_nums = (onset, RT)
            cond.onsets.append(cond_nums)


    last_run = run_name

for subrun in subruns:
    if 'L' in subrun.id: lm = 'lrn'
    if 'M' in subrun.id: lm = 'mem'
    outpath = uf.buildtree(root, [lm, subrun.subid, subrun.runid])
    out = open(os.path.join(outpath, 'conds.txt'), 'w')
    out.write('\n'.join([cond.id for cond in subrun.conds]))
    out.close()
    for cond in subrun.conds:
        cond.onsets = sorted(cond.onsets, key=lambda tup:float(tup[0]))
        cond_out = open(os.path.join(outpath, cond.id + '.txt'), 'w')
        cond_out.write('\n'.join([str(onset[0]) for onset in cond.onsets]))
        cond_out.close()
        RT_out = open(os.path.join(outpath, cond.id + '_RT.txt'), 'w')
        RT_out.write('\n'.join([str(onset[1]) for onset in cond.onsets]))
        RT_out.close()
        if cond.id[0] == 'M':
            ans_out = open(os.path.join(outpath, cond.id + '_ans.txt'), 'w')
            ans_out.write('\n'.join([str(onset[2]) for onset in cond.onsets]))
开发者ID:nyspisoccog,项目名称:ks_scripts,代码行数:30,代码来源:onsetxtract_singtri.py


示例2:

from __future__ import with_statement
import os, csv, shutil,tarfile, uf, dcm_ops
dest_root = '/ifs/scratch/pimri/soccog/test_working'
dst_path_lst = ['7648', 'run1L4']
uf.buildtree(dest_root, dst_path_lst)
uf.copytree('/ifs/scratch/pimri/soccog/old/SocCog_Raw_Data_By_Exam_Number/3310/E3310_e161637/s167370_1904_s6', '/ifs/scratch/pimri/soccog/test_working/7648/run1L4')
t = tarfile.open(os.path.join('/ifs/scratch/pimri/soccog/test_working/7648/run1L4','MRDC_files.tar.gz'), 'r')
t.extractall('/ifs/scratch/pimri/soccog/test_working/7648/run1L4')
for f in os.listdir('/ifs/scratch/pimri/soccog/test_working/7648/run1L4'):
   if 'MRDC' in f and 'gz' not in f:
       old = os.path.join('/ifs/scratch/pimri/soccog/test_working/7648/run1L4', f)
       new = os.path.join('/ifs/scratch/pimri/soccog/test_working/7648/run1L4', f + '.dcm')
       os.rename(old, new)
qsub_cnv_out = dcm_ops.cnv_dcm('/ifs/scratch/pimri/soccog/test_working/7648/run1L4', '7648_run1L4', '/ifs/scratch/pimri/soccog/scripts/mastersort/scripts_dir/cnv')
#qsub_cln_out = dcm_ops.cnv_dcm('/ifs/scratch/pimri/soccog/test_working/7648/run1L4', '7648_run1L4', '/ifs/scratch/pimri/soccog/scripts/mastersort/scripts_dir/cln')
开发者ID:nyspisoccog,项目名称:ks_scripts,代码行数:15,代码来源:p7648_run1L4.py


示例3: str

    ser_dir = ser_dir.replace(' ', '')
    ser_id = subj_id + '_' + ser_name
    src_path = os.path.join(src_root, exam, ex_dir, ser_dir)
    notes = line['Notes']
    if 'anat' in ser_name:
        if 'best' in notes:
            dst_path_lst = [subj_id, 'anat']
        else:
            dst_path_lst = [subj_id, 'spare_anat', ser_name]

    if 'run' in ser_name:
        dst_path_lst = [subj_id, 'func', ser_name]

    ###COPY RAW DIRECTORY TO NEW DIR, SORTED BY SUBJECT###

    dst_path = uf.buildtree(dst_root, dst_path_lst)
    uf.copytree(src_path, dst_path)

    logline['CopiedRaw'] = dst_path

    ###UNTAR FILES###

    t = tarfile.open(os.path.join(dst_path,'MRDC_files.tar.gz'), 'r')
    t.extractall(dst_path)

    #cmd = 'tar -xvzf MRDC_files.tar.gz'
    #res = subprocess.check_output(cmd,cwd=dst_path,shell=True)

    files = [f for f in os.listdir(dst_path) if f[0] == 'i']
    logline['Extracted'] = 'Extracted_' + str(len(files)) + '_files_' + os.path.join(dst_path, files[0])
开发者ID:nyspisoccog,项目名称:ks_scripts,代码行数:30,代码来源:ks_mastersort_no_clust_7641.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python uf.copytree函数代码示例发布时间:2022-05-27
下一篇:
Python ueCore.AssetUtils类代码示例发布时间: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