def get_all_3dinfo_dset_basic(fname): '''Input: a volume 'pon which to run 3dinfo. Output: dictionary whose keys are 3dinfo opt names relevant for a single volume (not helpy ones or comparison ones like -same*); the '-' part is part of the key here, at the moment. There is no filtering of empty fields here-- the bog standard outputs are all returned; each value in the dictionary is a list of string(s), which may be null. See "get_all_3dinfo_dset_neatly()" for some filtering/proc'ing of opts. ''' # ------- Quick check on dset being valid cmd = '''3dinfo -prefix {fff}'''.format(fff=fname) com = BASE.shell_com(cmd, capture=1, save_hist=0) com.run() if com.so[0] == 'NO-DSET': print('+* WARNING: No valid dset of that name: {fff}\n.' ' Bye.'.format(fff=fname)) return {} # ------- Get list of all opts in 3dinfo cmd = '''apsearch -list_popts 3dinfo''' com = BASE.shell_com(cmd, capture=1, save_hist=0) com.run() # filter out some ones we don't want list_3dinfo_opts = [] for x in com.so: y = x.strip() if not (list_3dinfo_ignore.__contains__(y)): list_3dinfo_opts.append(y) dict_info = {} for opt in list_3dinfo_opts: cmd = '''3dinfo {ooo} {fff}'''.format(ooo=opt, fff=fname) com = BASE.shell_com(cmd, capture=1, save_hist=0) com.run() dict_info[opt] = com.so return dict_info
# -------------------------------------------------------------------- # QC block: "warns" # item : censor fraction, per stimulus # use if: there are stim files present, and censoring ldep = ['stats_dset', 'censor_dset', 'ss_review_dset', 'xmat_stim'] if lat.check_dep(ap_ssdict, ldep): # get the ss_review_basic info as a dict rev_dict = lat.read_in_txt_to_dict(ap_ssdict['ss_review_dset'], tmp_name='__tmp_ss_rev.json') cmd = '''1d_tool.py -verb 0 -infile {xmat_stim} -show_labels '''.format(**ap_ssdict) com = BASE.shell_com(cmd, capture=1, save_hist=0) com.run() all_labels = com.so[0].split() # list of all labels ban = lat.bannerize('Censor fraction (per stim)') obase = 'qc_{:02d}'.format(idx) cmd = lat.apqc_warns_cen_stim(obase, "warns", "cen_stim", rev_dict=rev_dict, label_list=all_labels) str_FULL += ban str_FULL += cmd idx += 1