specimage.py 1.37 KB
#!/usr/bin/python3
import subprocess

command = "bimsim"

#images
intImage = "out_i.bmp"
absImage = "out_a"
#detector specs
dsize = 208
dsample = 6.5
res = int(dsize / dsample)
sampling = 4
#incident field
#nu = 800
source = "central.bmp"
order = 100
#sphere
x = 0
y = 0
z = 0
a = 5
#spectral samples
nuStart = 800
nuStop = 4000
nuStep = 10
iters = int((nuStop - nuStart) / nuStep)


#set the position of the image plane
command += " -u " + str(-dsize/2)
command += " -v " + str(-dsize/2)
command += " -w " + str(a)
command += " -U " + str(dsize/2)
command += " -V " + str(dsize/2)
command += " -W " + str(a)
command += " --plane-norm-x " + str(0)
command += " --plane-norm-y " + str(0)
command += " --plane-norm-z " + str(1)
command += " -R " + str(res)
command += " --supersample " + str(sampling)
command += " -X " + source
command += " --field-order " + str(order)
command += " -I " + intImage
command += " -A " + absImage
command += " --append"
command += " -x " + str(x)
command += " -y " + str(y)
command += " -z " + str(z)
command += " -r " + str(a)

for inu in range(0, iters):
    print("Iteration # " + str(inu + 1) + "/" + str(iters))
    nu = nuStart + inu * nuStep
    lam = 10000.0/nu
    
    runcommand = command + " -l " + str(lam)
    print(runcommand)
    subprocess.call(runcommand, shell=True)

#print("Hello world!")