specimage.py
1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/python3
import subprocess, sys
nuStart = 800
nuStop = 4000
nuStep = 10
if len(sys.argv) > 1:
nuStart = sys.argv[1]
if len(sys.argv) > 2:
nuStop = sys.argv[2]
if len(sys.argv) > 3:
nuStep = sys.argv[3]
command = "bimsim"
#images
intImage = "out_i.bmp"
absImage = "out_a"
#detector specs
dsize = 208
dsample = 1
res = int(dsize / dsample)
sampling = 1
padding = 1
#incident field
source = ""
order = 100
mc = 400
#sphere
x = 0
y = 0
z = 0
a = 5
n = 1.4
k = 0.0
#spectral samples
iters = int((nuStop - nuStart) / nuStep) + 1
#optics
NAin = 0.2
NAout = 0.5
#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)
if source != "":
command += " -X " + source
command += " --field-order " + str(order)
command += " -d " + str(padding)
command += " -s " + str(mc)
command += " -I " + intImage
command += " -A " + absImage
command += " --append"
#sphere
command += " -x " + str(x)
command += " -y " + str(y)
command += " -z " + str(z)
command += " -r " + str(a)
command += " -n " + str(n)
command += " -k " + str(k)
#set the optics
command += " -c " + str(NAin)
command += " -C " + str(NAout)
command += " -o " + str(NAin)
command += " -O " + str(NAout)
for inu in range(0, iters):
print("Iteration # " + str(inu + 1) + "/" + str(iters))
nu = nuStart + inu * nuStep
runcommand = command + " --nu " + str(nu)
print(runcommand)
subprocess.call(runcommand, shell=True)
#print("Hello world!")