In [3]:
templateFilename = "template-translation-fl-3sph.mci"
templateScript = "cudamcfl-array.sh"
mciFolder = "/home/nicolas/Documentos/Investigación/Sources/CUDA/CUDAMCFL/MCIs/"
mciPrefix = "s-cecar-wfr-trans-3sph-fl-2"
resultsFolder = ""
scriptFilename = "/home/nicolas/Documentos/Investigación/Sources/CUDA/CUDAMCFL/simualtionTrans3sph.sh"
bulkFilenameRoot = "/home/ncarbone/CUDAMCFL/BulkDesc/"
bulkFilename = "/home/ncarbone/CUDAMCFL/BulkDesc/3Dbulk-trans-3sph"
exeFilename = "/home/ncarbone/CUDAMCFL/cuda_fl"
outputLineNumber = 6
detCentLineNumber = 13
sourceLineNumber = 14
bulkLineNumber = 23
with open(mciFolder+templateFilename, 'r') as file:
    template = file.readlines()
with open(templateScript, 'r') as fileS:
    templateS = fileS.readlines()

In [1]:
with open(scriptFilename, 'w') as shfile:
    i=0
    for xsource in range(-5, 5, 1):
        for ysource in range(-5, 5, 1):
            i=i+1
            print("{:.2f}".format(xsource), "{:.2f}".format(ysource), i)
            outputFileName = resultsFolder+mciPrefix+ "_" + "{:.2f}".format(xsource) + "_" + "{:.2f}".format(ysource) + "_i"+str(i)+".dat"
            mciFileName = mciFolder+mciPrefix + "_i"+str(i)+".mci"
            template[outputLineNumber] =  outputFileName+"\t"+"A"+"\t\n"
            template[sourceLineNumber] = "{:.2f}".format(xsource) + "\t" + "{:.2f}".format(ysource) + "\t" + str(0)+"\n"
            #template[detCentLineNumber] = str(xsource) + "\t" + str(ysource) + "\t\n"
            template[bulkLineNumber] = bulkFilename
            with open(mciFileName, 'w') as mcifile:
                mcifile.writelines( template )


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-1991c3ea1689> in <module>()
----> 1 with open(scriptFilename, 'w') as shfile:
      2     i=0
      3     for xsource in range(-5, 5, 1):
      4         for ysource in range(-5, 5, 1):
      5             i=i+1

NameError: name 'scriptFilename' is not defined

In [ ]: