示例#1
0
    #set up log
    cleantime = datetime.strftime(datetime.now(),'%Y-%m-%d-%H-%M')
    logfile = os.path.join(logdir,
                           '%s%s.log'%(__file__,cleantime))

    log_settings = utils.get_logging_configdict(logfile)
    logging.config.dictConfig(log_settings)

    user = os.environ['USER']
    logging.info('###START %s :::'%__file__)
    logging.info('###USER : %s'%(user))

    # get bac2lbl mapping
    bac2lbl = bac_to_lbl(mapfile)
    # find all subjecs raw directories
    subs = mtr.glob('%s/B*_v*'%(syncdir))
    subs.sort()
    for sub in subs:
        _, sid = os.path.split(sub)
        subid, visit = sid.split('_')
        visitstr = get_realvisit(visit)
        if is_bacs(subid):
            print subid, 'is bacs'
            try:
                subid = bac2lbl[subid]
            except KeyError:
                logging.error('{0} has no LBLID, skipping'.format(subid))
                continue
        print subid, visit, sub
        globstr = os.path.join(sub, '*.tgz')
        scans = sorted(glob(globstr))
示例#2
0
    syncdir = '/home/jagust/LBL/finalMRI'
    logdir , _ = os.path.split(syncdir)
    #set up log
    cleantime = datetime.strftime(datetime.now(),'%Y-%m-%d-%H-%M')
    logfile = os.path.join(logdir,'logs',
                           '%s%s.log'%(cleantime,__file__.replace('.py','')))

    log_settings = utils.get_logging_configdict(logfile)
    logging.config.dictConfig(log_settings)

    user = os.environ['USER']
    logging.info('###START %s :::'%__file__)
    logging.info('###USER : %s'%(user))

    # find all subjecs raw scans
    scans = mtr.glob('%s/B*/raw*.tgz'%(syncdir))
    scans.sort()

    for raw in scans[:]:
        # meta data
        logging.info(raw)
        _, rawf = os.path.split(raw)
        subid = mtr.get_subid(raw)
        if subid is None:
            logging.error('no subid in %s'%(raw))
            continue
        logging.info(subid)
        visit_number = mtr.get_visit_number(raw)
        # get estimate of series field and date

        try: