def save_tc_to_nii(strCsvCnfg, lgcTest=False, lstRat=None, lgcMdlRsp=False,<EOL>strPathHrf=None, lgcSaveRam=False):
<EOL>dicCnfg = load_config(strCsvCnfg, lgcTest=lgcTest)<EOL>cfg = cls_set_config(dicCnfg)<EOL>if strPathHrf is not None:<EOL><INDENT>cfg.strPathOut = cfg.strPathOut + '<STR_LIT>'<EOL><DEDENT>if lstRat is not None:<EOL><INDENT>cfg.strPathOut = cfg.strPathOut + '<STR_LIT>'<EOL>cfg.strPathMdl = cfg.strPathMdl + '<STR_LIT>'<EOL>lstRat.insert(<NUM_LIT:0>, <NUM_LIT:1.0>)<EOL><DEDENT>lstWnrPrm = [cfg.strPathOut + '<STR_LIT>',<EOL>cfg.strPathOut + '<STR_LIT>',<EOL>cfg.strPathOut + '<STR_LIT>']<EOL>errorMsg = '<STR_LIT>'<EOL>assert os.path.isfile(lstWnrPrm[<NUM_LIT:0>]), errorMsg<EOL>assert os.path.isfile(lstWnrPrm[<NUM_LIT:1>]), errorMsg<EOL>assert os.path.isfile(lstWnrPrm[<NUM_LIT:2>]), errorMsg<EOL>aryIntGssPrm = load_res_prm(lstWnrPrm,<EOL>lstFlsMsk=[cfg.strPathNiiMask])[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>lstPathBeta = [cfg.strPathOut + '<STR_LIT>']<EOL>aryBetas = load_res_prm(lstPathBeta, lstFlsMsk=[cfg.strPathNiiMask])[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>assert os.path.isfile(lstPathBeta[<NUM_LIT:0>]), errorMsg<EOL>if lstRat is not None:<EOL><INDENT>lstPathRatio = [cfg.strPathOut + '<STR_LIT>']<EOL>aryRatio = load_res_prm(lstPathRatio,<EOL>lstFlsMsk=[cfg.strPathNiiMask])[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>assert os.path.isfile(lstPathRatio[<NUM_LIT:0>]), errorMsg<EOL><DEDENT>aryLgcMsk, aryLgcVar, hdrMsk, aryAff, aryFunc, tplNiiShp = prep_func(<EOL>cfg.strPathNiiMask, cfg.lstPathNiiFunc, varAvgThr=-<NUM_LIT:100>)<EOL>aryIntGssPrm = aryIntGssPrm[aryLgcVar, :]<EOL>aryBetas = aryBetas[aryLgcVar, :]<EOL>if lstRat is not None:<EOL><INDENT>aryRatio = aryRatio[aryLgcVar, :]<EOL><DEDENT>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>lgcMdlInc = np.load(cfg.strPathMdl + '<STR_LIT>')<EOL>aryMdlParams = aryMdlParams[lgcMdlInc, :]<EOL>aryPrfTc = np.load(cfg.strPathMdl + '<STR_LIT>')<EOL>aryPrfTc = prep_models(aryPrfTc, varSdSmthTmp=cfg.varSdSmthTmp)<EOL>if lgcMdlRsp:<EOL><INDENT>aryMdlRsp = np.load(cfg.strPathMdl + '<STR_LIT>')<EOL><DEDENT>aryFitTc = np.zeros((aryFunc.shape), dtype=np.float32)<EOL>if lgcMdlRsp:<EOL><INDENT>if lstRat is not None:<EOL><INDENT>aryFitMdlRsp = np.zeros((aryIntGssPrm.shape[<NUM_LIT:0>], aryMdlRsp.shape[<NUM_LIT:1>],<EOL>aryMdlRsp.shape[<NUM_LIT:3>]),<EOL>dtype=np.float32)<EOL><DEDENT>else:<EOL><INDENT>aryFitMdlRsp = np.zeros((aryIntGssPrm.shape[<NUM_LIT:0>],<EOL>aryMdlRsp.shape[<NUM_LIT:1>]), dtype=np.float32)<EOL><DEDENT><DEDENT>vecVxlTst = np.zeros(aryIntGssPrm.shape[<NUM_LIT:0>])<EOL>aryUnqRows, aryUnqInd = fnd_unq_rws(aryIntGssPrm, return_index=False,<EOL>return_inverse=True)<EOL>print('<STR_LIT>')<EOL>for indRow, vecPrm in enumerate(aryUnqRows):<EOL><INDENT>lgcVxl = [aryUnqInd == indRow][<NUM_LIT:0>]<EOL>if np.all(np.invert(lgcVxl)):<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>vecVxlTst[lgcVxl] += <NUM_LIT:1><EOL>lgcMdl = np.where(np.isclose(aryMdlParams, vecPrm,<EOL>atol=<NUM_LIT>).all(axis=<NUM_LIT:1>))[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>if lgcMdl is None:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>aryMdlTc = aryPrfTc[lgcMdl, ...]<EOL>aryWeights = aryBetas[lgcVxl, :]<EOL>if lstRat is not None:<EOL><INDENT>aryVxlRatio = aryRatio[lgcVxl, :]<EOL>indRat = [ind for ind, rat1 in enumerate(lstRat) for rat2 in<EOL>aryVxlRatio[:, <NUM_LIT:0>] if np.isclose(rat1, rat2)]<EOL>indVxl = range(len(indRat))<EOL><DEDENT>if lstRat is not None:<EOL><INDENT>aryFitTcTmp = np.tensordot(aryWeights, aryMdlTc, axes=([<NUM_LIT:1>], [<NUM_LIT:0>]))<EOL>aryFitTc[lgcVxl, :] = aryFitTcTmp[indVxl, indRat, :]<EOL><DEDENT>else:<EOL><INDENT>aryFitTc[lgcVxl, :] = np.dot(aryWeights, aryMdlTc)<EOL><DEDENT>if lgcMdlRsp:<EOL><INDENT>if lstRat is not None:<EOL><INDENT>aryFitMdlRsp[lgcVxl, :] = aryMdlRsp[lgcMdl, :, indRat, :]<EOL><DEDENT>else:<EOL><INDENT>aryFitMdlRsp[lgcVxl, :] = aryMdlRsp[lgcMdl, :]<EOL><DEDENT><DEDENT><DEDENT>errMsg = '<STR_LIT>'<EOL>assert len(vecVxlTst) == np.sum(vecVxlTst), errMsg<EOL>lstNiiNames = ['<STR_LIT>']<EOL>lstNiiNames = [cfg.strPathOut + strNii + '<STR_LIT>' for strNii in<EOL>lstNiiNames]<EOL>print('<STR_LIT>')<EOL>export_nii(aryFunc, lstNiiNames, aryLgcMsk, aryLgcVar, tplNiiShp,<EOL>aryAff, hdrMsk, outFormat='<STR_LIT>')<EOL>print('<STR_LIT>')<EOL>if lgcSaveRam:<EOL><INDENT>strPthRamOut = cfg.strPathOut + '<STR_LIT>' + '<STR_LIT>'<EOL>imgNii = nb.Nifti1Image(np.expand_dims(np.expand_dims(aryFunc, axis=<NUM_LIT:1>),<EOL>axis=<NUM_LIT:1>),<EOL>affine=np.eye(<NUM_LIT:4>))<EOL>nb.save(imgNii, strPthRamOut)<EOL><DEDENT>lstNiiNames = ['<STR_LIT>']<EOL>lstNiiNames = [cfg.strPathOut + strNii + '<STR_LIT>' for strNii in<EOL>lstNiiNames]<EOL>print('<STR_LIT>')<EOL>export_nii(aryFitTc, lstNiiNames, aryLgcMsk, aryLgcVar, tplNiiShp,<EOL>aryAff, hdrMsk, outFormat='<STR_LIT>')<EOL>print('<STR_LIT>')<EOL>if lgcMdlRsp:<EOL><INDENT>strNpyName = cfg.strPathOut + '<STR_LIT>' + '<STR_LIT>'<EOL>print('<STR_LIT>')<EOL>np.save(strNpyName, aryFitMdlRsp)<EOL>print('<STR_LIT>')<EOL>strNpyMskName = cfg.strPathOut + '<STR_LIT>' + '<STR_LIT>'<EOL>aryLgcMsk[aryLgcMsk] = aryLgcVar<EOL>print('<STR_LIT>')<EOL>np.save(strNpyMskName, aryLgcMsk)<EOL>print('<STR_LIT>')<EOL><DEDENT>if lgcSaveRam:<EOL><INDENT>strPthRamOut = cfg.strPathOut + '<STR_LIT>' + '<STR_LIT>'<EOL>imgNii = nb.Nifti1Image(np.expand_dims(np.expand_dims(aryFitTc,<EOL>axis=<NUM_LIT:1>),<EOL>axis=<NUM_LIT:1>),<EOL>affine=np.eye(<NUM_LIT:4>))<EOL>nb.save(imgNii, strPthRamOut)<EOL><DEDENT>
Save empirical and fitted time courses to nii file format.

Parameters
----------
strCsvCnfg : str
    Absolute file path of config file used for pRF fitting.
lgcTest : boolean
    Whether this is a test (pytest). If yes, absolute path of pyprf libary
    will be prepended to config file paths.
lstRat : None or list
    Ratio of size of center to size of suppressive surround.
lgcMdlRsp : boolean
    Should the aperture responses for the winner model also be saved?
strPathHrf : str or None:
    Path to npy file with custom hrf parameters. If None, defaults
    parameters were used.
lgcSaveRam : boolean
    Whether to also save a nii file that uses little RAM.

Notes
-----
This function does not return any arguments but, instead, saves nii files
to disk.