def main():
    parser = argparse.ArgumentParser(description='QC reporting for in vivo fMRI timeseries')
    parser.add_argument('-i', '--qc_dir', help='CBICQClive directory (*.qclive)')
    args = parser.parse_args()
    qc_dir = args.qc_dir
    print(('  Creating in vivo QC report for ' + qc_dir))
    qc_dir_abs = os.path.abspath(qc_dir)
    info_fname = os.path.join(qc_dir, 'qc_info.csv')
    info = genfromtxt(info_fname, delimiter=',')
    qc_dict = dict([('qc_dir_abs', ('%s' % qc_dir_abs)), ('TR_secs', ('%0.3f' % info[1])), ('N_vols', ('%d' % info[2])), ('tSFNR', ('%0.1f' % info[3])), ('signal_tmean', ('%0.1f' % info[4])), ('signal_thresh', ('%0.1f' % info[5])), ('signal_pout', ('%0.1f' % info[6])), ('ghost_tmean', ('%0.1f' % info[7])), ('ghost_thresh', ('%0.1f' % info[8])), ('ghost_pout', ('%0.1f' % info[9])), ('air_tmean', ('%0.1f' % info[10])), ('air_thresh', ('%0.1f' % info[11])), ('air_pout', ('%0.1f' % info[12])), ('dvars_tmean', ('%0.1f' % info[13])), ('dvars_thresh', ('%0.1f' % info[14])), ('dvars_pout', ('%0.1f' % info[15])), ('dd_um_tmean', ('%0.1f' % info[16])), ('dd_um_thresh', ('%0.1f' % info[17])), ('dd_um_pout', ('%0.1f' % info[18])), ('dr_mdeg_tmean', ('%0.1f' % info[19])), ('dr_mdeg_thresh', ('%0.1f' % info[20])), ('dr_mdeg_pout', ('%0.1f' % info[21]))])
    TEMPLATE = string.Template(TEMPLATE_FORMAT)
    html_data = TEMPLATE.safe_substitute(qc_dict)
    qc_report_html = os.path.join(qc_dir, 'index.html')
    open(qc_report_html, 'w').write(html_data)
def main():
    parser = argparse.ArgumentParser(description='QC reporting for in vivo fMRI timeseries')
    parser.add_argument('-i', '--qc_dir', help='CBICQClive directory (*.qclive)')
    args = parser.parse_args()
    qc_dir = args.qc_dir
    print(('  Creating in vivo QC report for ' + qc_dir))
    qc_dir_abs = os.path.abspath(qc_dir)
    info_fname = os.path.join(qc_dir, 'qc_info.csv')
    info = genfromtxt(info_fname, delimiter=',')
    qc_dict = dict([('qc_dir_abs', ('%s' % qc_dir_abs)), ('TR_secs', ('%0.3f' % info[1])), ('N_vols', ('%d' % info[2])), ('tSFNR', ('%0.1f' % info[3])), ('signal_tmean', ('%0.1f' % info[4])), ('signal_thresh', ('%0.1f' % info[5])), ('signal_pout', ('%0.1f' % info[6])), ('ghost_tmean', ('%0.1f' % info[7])), ('ghost_thresh', ('%0.1f' % info[8])), ('ghost_pout', ('%0.1f' % info[9])), ('air_tmean', ('%0.1f' % info[10])), ('air_thresh', ('%0.1f' % info[11])), ('air_pout', ('%0.1f' % info[12])), ('dvars_tmean', ('%0.1f' % info[13])), ('dvars_thresh', ('%0.1f' % info[14])), ('dvars_pout', ('%0.1f' % info[15])), ('dd_um_tmean', ('%0.1f' % info[16])), ('dd_um_thresh', ('%0.1f' % info[17])), ('dd_um_pout', ('%0.1f' % info[18])), ('dr_mdeg_tmean', ('%0.1f' % info[19])), ('dr_mdeg_thresh', ('%0.1f' % info[20])), ('dr_mdeg_pout', ('%0.1f' % info[21]))])
    TEMPLATE = string.Template(TEMPLATE_FORMAT)
    html_data = TEMPLATE.safe_substitute(qc_dict)
    qc_report_html = os.path.join(qc_dir, 'index.html')
    open(qc_report_html, 'w').write(html_data)