def pyprf(strCsvCnfg, lgcTest=False, varRat=None, strPathHrf=None):
<EOL>print('<STR_LIT>')<EOL>varTme01 = time.time()<EOL>dicCnfg = load_config(strCsvCnfg, lgcTest=lgcTest)<EOL>cfg = cls_set_config(dicCnfg)<EOL>if cfg.strVersion == '<STR_LIT>':<EOL><INDENT>from pyprf_feature.analysis.find_prf_gpu import find_prf_gpu<EOL><DEDENT>if ((cfg.strVersion == '<STR_LIT>') or (cfg.strVersion == '<STR_LIT>')):<EOL><INDENT>from pyprf_feature.analysis.find_prf_cpu import find_prf_cpu<EOL><DEDENT>cfg.varSdSmthTmp = np.divide(cfg.varSdSmthTmp, cfg.varTr)<EOL>aryPrfTc, lgcMdlInc = model_creation(dicCnfg, varRat=varRat,<EOL>strPathHrf=strPathHrf)<EOL>cfg.varNumFtr = aryPrfTc.shape[<NUM_LIT:1>]<EOL>aryPrfTc = prep_models(aryPrfTc, varSdSmthTmp=cfg.varSdSmthTmp)<EOL>aryLgcMsk, aryLgcVar, hdrMsk, aryAff, aryFunc, tplNiiShp = prep_func(<EOL>cfg.strPathNiiMask, cfg.lstPathNiiFunc, varAvgThr=-<NUM_LIT:100>)<EOL>hdrMsk.set_data_dtype(np.float32)<EOL>if cfg.strVersion == '<STR_LIT>':<EOL><INDENT>strErrMsg = '<STR_LIT>' +'<STR_LIT>' +'<STR_LIT>'<EOL>assert cfg.varNumXval == <NUM_LIT:1>, strErrMsg<EOL><DEDENT>if cfg.strVersion == '<STR_LIT>':<EOL><INDENT>cfg.varPar = <NUM_LIT:1><EOL><DEDENT>if cfg.strVersion == '<STR_LIT>':<EOL><INDENT>strErrMsg = '<STR_LIT>' +'<STR_LIT>' +'<STR_LIT>'<EOL>assert cfg.varNumFtr in [<NUM_LIT:1>, <NUM_LIT:2>], strErrMsg<EOL><DEDENT>if np.greater(cfg.varNumXval, <NUM_LIT:1>):<EOL><INDENT>cfg.lgcXval = True<EOL><DEDENT>elif np.equal(cfg.varNumXval, <NUM_LIT:1>):<EOL><INDENT>cfg.lgcXval = False<EOL><DEDENT>strErrMsg = '<STR_LIT>' +'<STR_LIT>'<EOL>assert np.greater_equal(cfg.varNumXval, <NUM_LIT:1>), strErrMsg<EOL>print('<STR_LIT>')<EOL>cfg.varNumVoxInc = aryFunc.shape[<NUM_LIT:0>]<EOL>print('<STR_LIT>'<EOL>+ str(cfg.varNumVoxInc))<EOL>print('<STR_LIT>'<EOL>+ str(cfg.varNumFtr))<EOL>print('<STR_LIT>')<EOL>aryMdlParams = crt_mdl_prms((int(cfg.varVslSpcSzeX),<EOL>int(cfg.varVslSpcSzeY)), cfg.varNum1,<EOL>cfg.varExtXmin, cfg.varExtXmax, cfg.varNum2,<EOL>cfg.varExtYmin, cfg.varExtYmax,<EOL>cfg.varNumPrfSizes, cfg.varPrfStdMin,<EOL>cfg.varPrfStdMax, kwUnt='<STR_LIT>',<EOL>kwCrd=cfg.strKwCrd)<EOL>aryMdlParams = aryMdlParams[lgcMdlInc, :]<EOL>lstPrfRes = [None] * cfg.varPar<EOL>lstPrcs = [None] * cfg.varPar<EOL>queOut = mp.Queue()<EOL>lstFunc = np.array_split(aryFunc, cfg.varPar)<EOL>del(aryFunc)<EOL>dctKw = {'<STR_LIT>': None,<EOL>'<STR_LIT>': True}<EOL>if ((cfg.strVersion == '<STR_LIT>') or (cfg.strVersion == '<STR_LIT>')):<EOL><INDENT>print('<STR_LIT>')<EOL>print('<STR_LIT>')<EOL>for idxPrc in range(<NUM_LIT:0>, cfg.varPar):<EOL><INDENT>lstPrcs[idxPrc] = mp.Process(target=find_prf_cpu,<EOL>args=(idxPrc,<EOL>lstFunc[idxPrc],<EOL>aryPrfTc,<EOL>aryMdlParams,<EOL>cfg.strVersion,<EOL>cfg.lgcXval,<EOL>cfg.varNumXval,<EOL>queOut),<EOL>kwargs=dctKw,<EOL>)<EOL>lstPrcs[idxPrc].Daemon = True<EOL><DEDENT><DEDENT>elif cfg.strVersion == '<STR_LIT>':<EOL><INDENT>print('<STR_LIT>')<EOL>for idxPrc in range(<NUM_LIT:0>, cfg.varPar):<EOL><INDENT>lstPrcs[idxPrc] = mp.Process(target=find_prf_gpu,<EOL>args=(idxPrc,<EOL>aryMdlParams,<EOL>lstFunc[idxPrc],<EOL>aryPrfTc,<EOL>queOut),<EOL>kwargs=dctKw,<EOL>)<EOL>lstPrcs[idxPrc].Daemon = True<EOL><DEDENT><DEDENT>for idxPrc in range(<NUM_LIT:0>, cfg.varPar):<EOL><INDENT>lstPrcs[idxPrc].start()<EOL><DEDENT>del(lstFunc)<EOL>for idxPrc in range(<NUM_LIT:0>, cfg.varPar):<EOL><INDENT>lstPrfRes[idxPrc] = queOut.get(True)<EOL><DEDENT>for idxPrc in range(<NUM_LIT:0>, cfg.varPar):<EOL><INDENT>lstPrcs[idxPrc].join()<EOL><DEDENT>print('<STR_LIT>')<EOL>lstPrfRes = sorted(lstPrfRes)<EOL>aryBstXpos = joinRes(lstPrfRes, cfg.varPar, <NUM_LIT:1>, inFormat='<STR_LIT>')<EOL>aryBstYpos = joinRes(lstPrfRes, cfg.varPar, <NUM_LIT:2>, inFormat='<STR_LIT>')<EOL>aryBstSd = joinRes(lstPrfRes, cfg.varPar, <NUM_LIT:3>, inFormat='<STR_LIT>')<EOL>aryBstR2 = joinRes(lstPrfRes, cfg.varPar, <NUM_LIT:4>, inFormat='<STR_LIT>')<EOL>aryBstBts = joinRes(lstPrfRes, cfg.varPar, <NUM_LIT:5>, inFormat='<STR_LIT>')<EOL>if np.greater(cfg.varNumXval, <NUM_LIT:1>):<EOL><INDENT>aryBstR2Single = joinRes(lstPrfRes, cfg.varPar, <NUM_LIT:6>, inFormat='<STR_LIT>')<EOL><DEDENT>del(lstPrfRes)<EOL>aryPlrAng = np.arctan2(aryBstYpos, aryBstXpos)<EOL>aryEcc = np.sqrt(np.add(np.square(aryBstXpos),<EOL>np.square(aryBstYpos)))<EOL>print('<STR_LIT>')<EOL>if strPathHrf is not None:<EOL><INDENT>cfg.strPathOut = cfg.strPathOut + '<STR_LIT>'<EOL><DEDENT>aryBstMaps = np.stack([aryBstXpos, aryBstYpos, aryBstSd, aryBstR2,<EOL>aryPlrAng, aryEcc], axis=<NUM_LIT:1>)<EOL>lstNiiNames = ['<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>']<EOL>if varRat is not None:<EOL><INDENT>lstNiiNames = [strNii + '<STR_LIT:_>' + str(varRat) for strNii in lstNiiNames]<EOL><DEDENT>lstNiiNames = [cfg.strPathOut + strNii + '<STR_LIT>' for strNii in<EOL>lstNiiNames]<EOL>export_nii(aryBstMaps, lstNiiNames, aryLgcMsk, aryLgcVar, tplNiiShp,<EOL>aryAff, hdrMsk, outFormat='<STR_LIT>')<EOL>lstNiiNames = ['<STR_LIT>']<EOL>if varRat is not None:<EOL><INDENT>lstNiiNames = [strNii + '<STR_LIT:_>' + str(varRat) for strNii in lstNiiNames]<EOL><DEDENT>lstNiiNames = [cfg.strPathOut + strNii + '<STR_LIT>' for strNii in<EOL>lstNiiNames]<EOL>export_nii(aryBstBts, lstNiiNames, aryLgcMsk, aryLgcVar, tplNiiShp,<EOL>aryAff, hdrMsk, outFormat='<STR_LIT>')<EOL>if np.greater(cfg.varNumXval, <NUM_LIT:1>):<EOL><INDENT>aryBstR2Single[np.where(np.less_equal(aryBstR2Single, -<NUM_LIT:1.0>))] = -<NUM_LIT:1.0><EOL>lstNiiNames = ['<STR_LIT>']<EOL>if varRat is not None:<EOL><INDENT>lstNiiNames = [strNii + '<STR_LIT:_>' + str(varRat) for strNii in<EOL>lstNiiNames]<EOL><DEDENT>lstNiiNames = [cfg.strPathOut + strNii + '<STR_LIT>' for strNii in<EOL>lstNiiNames]<EOL>export_nii(aryBstR2Single, lstNiiNames, aryLgcMsk, aryLgcVar,<EOL>tplNiiShp, aryAff, hdrMsk, outFormat='<STR_LIT>')<EOL><DEDENT>varTme02 = time.time()<EOL>varTme03 = varTme02 - varTme01<EOL>print('<STR_LIT>' + str(varTme03) + '<STR_LIT>')<EOL>print('<STR_LIT>')<EOL>
Main function for pRF mapping.

Parameters
----------
strCsvCnfg : str
    Absolute file path of config file.
lgcTest : Boolean
    Whether this is a test (pytest). If yes, absolute path of pyprf libary
    will be prepended to config file paths.
varRat : float, default None
    Ratio of size suppressive surround to size of center pRF
strPathHrf : str or None:
    Path to npy file with custom hrf parameters. If None, default
    parameters will be used.