Commit 967e46a18b00f1a55612ff58d35af88300a6e5de

Authored by dmayerich
1 parent e70a251f

added spectral script

@@ -114,6 +114,8 @@ void fileoutStruct::saveDetector(microscopeStruct* scope) @@ -114,6 +114,8 @@ void fileoutStruct::saveDetector(microscopeStruct* scope)
114 114
115 if(is_binary(intFile)) 115 if(is_binary(intFile))
116 I.toEnvi(intFile, scope->nf.lambda, append); 116 I.toEnvi(intFile, scope->nf.lambda, append);
  117 + else
  118 + I.toImage(intFile);
117 } 119 }
118 //absorbance 120 //absorbance
119 if(absFile != "") 121 if(absFile != "")
@@ -295,9 +295,12 @@ void microscopeStruct::LoadExtendedSource(std::string filename) @@ -295,9 +295,12 @@ void microscopeStruct::LoadExtendedSource(std::string filename)
295 //get the amplitude of the focal point 295 //get the amplitude of the focal point
296 QRgb rgb = sourceImage.pixel(x, y); 296 QRgb rgb = sourceImage.pixel(x, y);
297 //float A = qGray(rgb); 297 //float A = qGray(rgb);
298 - p.A = (ptype) qGray(rgb) / 255; 298 + if(qGray(rgb) != 0)
  299 + {
  300 + p.A = (ptype) qGray(rgb) / 255;
299 301
300 - //insert the point source into the list  
301 - focalPoints.push_back(p); 302 + //insert the point source into the list
  303 + focalPoints.push_back(p);
  304 + }
302 } 305 }
303 } 306 }
@@ -151,6 +151,7 @@ __global__ void gpuScalarUf(bsComplex* Uf, bsVector k, ptype kmag, bsPoint f, pt @@ -151,6 +151,7 @@ __global__ void gpuScalarUf(bsComplex* Uf, bsVector k, ptype kmag, bsPoint f, pt
151 } 151 }
152 152
153 sumUf += il * jl * Pl * (Palpha[1] - Palpha[2] - Pbeta[1] + Pbeta[2]); 153 sumUf += il * jl * Pl * (Palpha[1] - Palpha[2] - Pbeta[1] + Pbeta[2]);
  154 + //sumUf += il * Pl * (Palpha[1] - Palpha[2] - Pbeta[1] + Pbeta[2]);
154 155
155 il *= im; 156 il *= im;
156 } 157 }
@@ -298,6 +298,8 @@ static void OutputOptions() @@ -298,6 +298,8 @@ static void OutputOptions()
298 { 298 {
299 cout<<SCOPE->nf.toStr(); 299 cout<<SCOPE->nf.toStr();
300 300
  301 + cout<<"# of source points: "<<SCOPE->focalPoints.size()<<endl;
  302 +
301 } 303 }
302 304
303 static void SetOptions(po::options_description &desc) 305 static void SetOptions(po::options_description &desc)
specimage.py 0 → 100755
  1 +#!/usr/bin/python3
  2 +import subprocess
  3 +
  4 +command = "bimsim"
  5 +
  6 +#images
  7 +intImage = "out_i.bmp"
  8 +absImage = "out_a"
  9 +#detector specs
  10 +dsize = 208
  11 +dsample = 6.5
  12 +res = int(dsize / dsample)
  13 +sampling = 4
  14 +#incident field
  15 +#nu = 800
  16 +source = "central.bmp"
  17 +order = 100
  18 +#sphere
  19 +x = 0
  20 +y = 0
  21 +z = 0
  22 +a = 5
  23 +#spectral samples
  24 +nuStart = 800
  25 +nuStop = 4000
  26 +nuStep = 10
  27 +iters = int((nuStop - nuStart) / nuStep)
  28 +
  29 +
  30 +#set the position of the image plane
  31 +command += " -u " + str(-dsize/2)
  32 +command += " -v " + str(-dsize/2)
  33 +command += " -w " + str(a)
  34 +command += " -U " + str(dsize/2)
  35 +command += " -V " + str(dsize/2)
  36 +command += " -W " + str(a)
  37 +command += " --plane-norm-x " + str(0)
  38 +command += " --plane-norm-y " + str(0)
  39 +command += " --plane-norm-z " + str(1)
  40 +command += " -R " + str(res)
  41 +command += " --supersample " + str(sampling)
  42 +command += " -X " + source
  43 +command += " --field-order " + str(order)
  44 +command += " -I " + intImage
  45 +command += " -A " + absImage
  46 +command += " --append"
  47 +command += " -x " + str(x)
  48 +command += " -y " + str(y)
  49 +command += " -z " + str(z)
  50 +command += " -r " + str(a)
  51 +
  52 +for inu in range(0, iters):
  53 + print("Iteration # " + str(inu + 1) + "/" + str(iters))
  54 + nu = nuStart + inu * nuStep
  55 + lam = 10000.0/nu
  56 +
  57 + runcommand = command + " -l " + str(lam)
  58 + print(runcommand)
  59 + subprocess.call(runcommand, shell=True)
  60 +
  61 +#print("Hello world!")
0 \ No newline at end of file 62 \ No newline at end of file