def model_creation(dicCnfg, varRat=None, strPathHrf=None):
<EOL>cfg = cls_set_config(dicCnfg)<EOL>if cfg.lgcCrteMdl:<EOL><INDENT>print('<STR_LIT>')<EOL>arySptExpInf = np.load(cfg.strSptExpInf)<EOL>arySptExpInf = np.rot90(arySptExpInf, k=<NUM_LIT:3>)<EOL>aryStimArea = np.sum(arySptExpInf, axis=-<NUM_LIT:1>).astype(np.bool)<EOL>print('<STR_LIT>')<EOL>aryTmpExpInf = np.load(cfg.strTmpExpInf)<EOL>if aryTmpExpInf.shape[-<NUM_LIT:1>] == <NUM_LIT:3>:<EOL><INDENT>print('<STR_LIT>')<EOL>vecNewCol = np.greater(aryTmpExpInf[:, <NUM_LIT:0>], <NUM_LIT:0>).astype(np.float16)<EOL>aryTmpExpInf = np.concatenate(<EOL>(aryTmpExpInf, np.expand_dims(vecNewCol, axis=<NUM_LIT:1>)), axis=<NUM_LIT:1>)<EOL><DEDENT>aryMdlParams = crt_mdl_prms((int(cfg.varVslSpcSzeX),<EOL>int(cfg.varVslSpcSzeY)), cfg.varNum1,<EOL>cfg.varExtXmin, cfg.varExtXmax,<EOL>cfg.varNum2, cfg.varExtYmin,<EOL>cfg.varExtYmax, cfg.varNumPrfSizes,<EOL>cfg.varPrfStdMin, cfg.varPrfStdMax,<EOL>kwUnt='<STR_LIT>', kwCrd=cfg.strKwCrd)<EOL>if varRat is not None:<EOL><INDENT>aryMdlParamsSur = np.copy(aryMdlParams)<EOL>aryMdlParamsSur[:, <NUM_LIT:2>] = aryMdlParamsSur[:, <NUM_LIT:2>] * varRat<EOL><DEDENT>print('<STR_LIT>')<EOL>varNumMdlBfr = aryMdlParams.shape[<NUM_LIT:0>]<EOL>lgcMdlInc = aryStimArea[aryMdlParams[:, <NUM_LIT:0>].astype(np.int32),<EOL>aryMdlParams[:, <NUM_LIT:1>].astype(np.int32)]<EOL>aryMdlParams = aryMdlParams[lgcMdlInc, :]<EOL>if varRat is not None:<EOL><INDENT>aryMdlParamsSur = aryMdlParamsSur[lgcMdlInc, :]<EOL><DEDENT>print('<STR_LIT>' +<EOL>str(varNumMdlBfr-aryMdlParams.shape[<NUM_LIT:0>]))<EOL>print('<STR_LIT>')<EOL>aryMdlRsp = crt_mdl_rsp(arySptExpInf, (int(cfg.varVslSpcSzeX),<EOL>int(cfg.varVslSpcSzeY)),<EOL>aryMdlParams, cfg.varPar)<EOL>if varRat is not None:<EOL><INDENT>aryMdlRspSur = crt_mdl_rsp(arySptExpInf, (int(cfg.varVslSpcSzeX),<EOL>int(cfg.varVslSpcSzeY)),<EOL>aryMdlParamsSur, cfg.varPar)<EOL><DEDENT>del(arySptExpInf)<EOL>print('<STR_LIT>')<EOL>if strPathHrf is not None:<EOL><INDENT>print('<STR_LIT>')<EOL>aryCstPrm = np.load(strPathHrf)<EOL>dctPrm = {}<EOL>dctPrm['<STR_LIT>'] = aryCstPrm[<NUM_LIT:0>]<EOL>dctPrm['<STR_LIT>'] = aryCstPrm[<NUM_LIT:1>]<EOL>dctPrm['<STR_LIT>'] = aryCstPrm[<NUM_LIT:2>]<EOL>dctPrm['<STR_LIT>'] = aryCstPrm[<NUM_LIT:3>]<EOL>dctPrm['<STR_LIT>'] = aryCstPrm[<NUM_LIT:4>]<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>')<EOL>dctPrm = None<EOL><DEDENT>aryPrfTc = crt_prf_ftr_tc(aryMdlRsp, aryTmpExpInf, cfg.varNumVol,<EOL>cfg.varTr, cfg.varTmpOvsmpl,<EOL>cfg.switchHrfSet, (int(cfg.varVslSpcSzeX),<EOL>int(cfg.varVslSpcSzeY)),<EOL>cfg.varPar, dctPrm=dctPrm)<EOL>if varRat is not None:<EOL><INDENT>print('<STR_LIT>')<EOL>aryPrfTcSur = crt_prf_ftr_tc(aryMdlRspSur, aryTmpExpInf,<EOL>cfg.varNumVol, cfg.varTr,<EOL>cfg.varTmpOvsmpl, cfg.switchHrfSet,<EOL>(int(cfg.varVslSpcSzeX),<EOL>int(cfg.varVslSpcSzeY)),<EOL>cfg.varPar, dctPrm=dctPrm)<EOL>aryPrfTc = np.concatenate((aryPrfTc, aryPrfTcSur), axis=<NUM_LIT:1>)<EOL><DEDENT>print('<STR_LIT>')<EOL>strNmeExtMdl = '<STR_LIT>'<EOL>strNmeExtPrm = '<STR_LIT>'<EOL>strNmeExtRsp = '<STR_LIT>'<EOL>strNmeExtMdlInc = '<STR_LIT>'<EOL>if varRat is not None:<EOL><INDENT>strNmeExtMdl = strNmeExtMdl + '<STR_LIT:_>' + str(varRat)<EOL>strNmeExtPrm = strNmeExtPrm + '<STR_LIT:_>' + str(varRat)<EOL>strNmeExtRsp = strNmeExtRsp + '<STR_LIT:_>' + str(varRat)<EOL>aryMdlParams = np.stack((aryMdlParams, aryMdlParamsSur),<EOL>axis=<NUM_LIT:1>)<EOL>aryMdlRsp = np.stack((aryMdlRsp, aryMdlRspSur),<EOL>axis=<NUM_LIT:1>)<EOL>strNmeExtMdlInc = '<STR_LIT>' + strNmeExtMdlInc<EOL><DEDENT>np.save(cfg.strPathMdl + strNmeExtMdl, aryPrfTc)<EOL>np.save(cfg.strPathMdl + strNmeExtPrm, aryMdlParams)<EOL>np.save(cfg.strPathMdl + strNmeExtRsp, aryMdlRsp)<EOL>np.save(cfg.strPathMdl + strNmeExtMdlInc, lgcMdlInc)<EOL>del(aryMdlParams)<EOL>del(aryMdlRsp)<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>')<EOL>aryPrfTc = np.load((cfg.strPathMdl + '<STR_LIT>'))<EOL>vecPrfTcShp = aryPrfTc.shape<EOL>strErrMsg = ('<STR_LIT>' +<EOL>'<STR_LIT>')<EOL>assert vecPrfTcShp[<NUM_LIT:0>] == cfg.varNum1 *cfg.varNum2 * cfg.varNumPrfSizes, strErrMsg<EOL>assert vecPrfTcShp[-<NUM_LIT:1>] == cfg.varNumVol, strErrMsg<EOL>if varRat is None:<EOL><INDENT>assert vecPrfTcShp[<NUM_LIT:1>] == cfg.switchHrfSet, strErrMsg<EOL><DEDENT>else:<EOL><INDENT>assert vecPrfTcShp[<NUM_LIT:1>] == cfg.switchHrfSet*<NUM_LIT:2>, strErrMsg<EOL><DEDENT>lgcMdlInc = np.load(cfg.strPathMdl + '<STR_LIT>')<EOL><DEDENT>return aryPrfTc, lgcMdlInc<EOL>
Create or load pRF model time courses.

Parameters
----------
dicCnfg : dict
    Dictionary containing config parameters.
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.

Returns
-------
aryPrfTc : np.array
    4D numpy array with pRF time course models, with following dimensions:
    'aryPrfTc[x-position, y-position, SD, volume]'.
lgcMdlInc : np.array, boolean
    Logical to only include models with pRF center on stimulated area.