), "AZO5", 5.61) zno = defineMat(( "O", "Zn", ), ( 0.1965, 0.8035, ), "ZnO", 5.61) """ coatedSubstrate(coating, thickness, substrate, det, e0=20.0, withPoisson=True, nTraj=defaultNumTraj, dose=defaultDose, sf=defaultCharFluor, bf=defaultBremFluor, xtraParams=defaultXtraParams) """ spc_al = mc3.coatedSubstrate(ctg, c_thick, al, det, e0, True, n_traj, dose, True, True, {}) sName = "%g nm C on Al at %g kV" % (1000 * c_thick, e0) spc_al.rename(sName) spc_al.display() fi = wrkDir + "/" fi += sName fi += "-%g-Traj.msa" % (n_traj) spc_al.save(fi) spc_azo2 = mc3.coatedSubstrate(ctg, c_thick, azo2, det, e0, True, n_traj, dose, True, True, {}) sName = "%g nm C on AZO2 at %g kV" % (1000 * c_thick, e0) spc_azo2.rename(sName) spc_azo2.display() fi = wrkDir + "/" fi += sName
caf2 = material("CaF2", 3.18) fe = material("Fe", 7.874) si = material("Si", 2.329) mgo = material("MgO", 3.58) """ coatedSubstrate(coating, thickness, substrate, det, e0=20.0, withPoisson=True, nTraj=defaultNumTraj, dose=defaultDose, sf=defaultCharFluor, bf=defaultBremFluor, xtraParams=defaultXtraParams) """ spc_k411 = mc3.coatedSubstrate(ctg, c_thick, k411, det, e0, True, n_traj, dose, True, True, {}) sName = "%g nm C on K411 at %g kV" % (1000 * c_thick, e0) spc_k411.rename(sName) spc_k411.display() fi = wrkDir + "/" fi += sName fi += "-%g-Traj.msa" % (n_traj) spc_k411.save(fi) spc_k412 = mc3.coatedSubstrate(ctg, c_thick, k412, det, e0, True, n_traj, dose, True, True, {}) sName = "%g nm C on K412 at %g kV" % (1000 * c_thick, e0) spc_k412.rename(sName) spc_k412.display() fi = wrkDir + "/" fi += sName
homDir = homDir.replace('\\','/') wrkDir = homDir + "/Documents/git/dtsa2Scripts/sim-nist-k961/" e0 = 20.0 c_thick = 0.020 # 20 nm n_traj = 10000 dose = 120.0 det = findDetector("Oxford p4 05eV 4K") ctg = material("C", 1.8) k961 = defineMat(( "O", "Na", "Mg", "Al", "Si", "P", "K" , "Ca", "Ti", "Mn", "Fe" ), (0.470, 0.030, 0.030, 0.058, 0.299, 0.002, 0.025, 0.036, 0.012, 0.003, 0.035 ), "K-961", 3.0) # compute spectrum spc_k961 = mc3.coatedSubstrate(ctg, c_thick, k961, det, e0, True, n_traj, dose, True, True, {}) spc_k961.rename("K-961") spc_k961.setAsStandard(k961) spc_k961.display() sName = "20-nm-C-on-K961-glass-at-%g-kV" % (e0) spc_k961.rename(sName) spc_k961.display() end = time.time() delta = (end-start)/60 msg = "This script required %.3f min" % delta print msg if(delta > 60): delta = delta/60
homDir = os.environ['HOME'] homDir = homDir.replace('\\','/') wrkDir = homDir + "/Documents/git/dtsa2Scripts/utility" outDir = homDir + "/Documents/git/dtsa2Scripts/utility/output/" rptDir = wrkDir + '/test-mc3-simulate-coated-substrate Results/' e0 = 20.0 det = findDetector("Probe") mat = material("Fe2O3",5.0) ctg = material("C", 1.8) DataManager.clearSpectrumList() spc = mc3.coatedSubstrate(ctg, 0.020, mat, det, 20.0, True, 1000, 120.0, True, True, {}) sName = "20 nm C on Fe2O3 at 20kV" spc.rename(sName) spc.display() shutil.rmtree(rptDir) print "Done!" end = time.time() delta = (end-start)/60 msg = "This script required %.3f min" % delta print msg if(delta > 60): delta = delta/60 msg = "...or %.3f hr" % delta
xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True)) stds = { element("O"): spc_zno_std, element("Zn"): spc_zno_std, element("Si"): spc_si_std } print( "Specimen Name \t\t Oxygen Ka1 K-Ratio \t Zinc La1 K-Ratio \t Si Ka K-Ratio " ) #5 nm ZnO on Si at 4 kV 0.073166 ± 0.000133 0.075862 ± 0.000106 0.877289 ± 0.000202 for thNm in lThNm: thUm = thNm / 1000. spc = mc3.coatedSubstrate(zno, thUm, si, det, e0, True, nTraj, dose, True, True, xtraParams) sName = "%g nm ZnO on Si at %g kV" % (thNm, e0) spc.rename(sName) spc.display() fi = resDir + "/" fi += sName fi += "-%g-Traj.msa" % (nTraj) spc.save(fi) ff = epq.FilterFit(det, epq.ToSI.keV(e0)) ff.addReference(element("O"), spc_zno_std) ff.addReference(element("Zn"), spc_zno_std) ff.addReference(element("Si"), spc_si_std) kr = ff.getKRatios(spc) kO = kr.getKRatioU( epq.XRayTransition(epq.Element.O, epq.XRayTransition.KA1))
lab6 = defineMat(( "La", "B", ), ( 0.68168, 0.31832, ), "LaB6", 4.72) lapo4 = defineMat(("La", "P", "O"), ( 0.59393, 0.13243, 0.27364, ), "LaPO4", 4.93) # compute spectrum spc_lab6 = mc3.coatedSubstrate(ctg, c_thick, lab6, det, e0, True, n_traj, dose, True, True, {}) spc_lab6.rename("LaB6") # spc_lab6.setAsStandard(lab6) spc_lab6.display() sName = "20-nm-C-on-LaB6-%g-kV" % (e0) spc_lab6.rename(sName) spc_lab6.display() end = time.time() delta = (end - start) / 60 msg = "This script required %.3f min" % delta print msg if (delta > 60): delta = delta / 60 msg = "...or %.3f hr" % delta
ELEM: O MgO Al2O3 SiO2 CaO FeO XRAY: ka ka ka ka ka ka OXWT: .000 .191 .096 .460 .149 .103 ELWT: .432 .115 .051 .215 .107 .080 KFAC: .0017 .0008 .0003 .0016 .0010 .0007 ZCOR: 2.5028 1.4996 1.4628 1.3079 1.0816 1.1834 AT% : 59.477 10.446 4.166 16.879 5.873 3.161 24 O: 24.000 4.215 1.681 6.811 2.370 1.276 """ # simulate K412-NR spc_k412nr = mc3.coatedSubstrate(ctg, c_thick, k412nr, det, e0, True, n_traj, dose, True, True, {}) sName = "%g nm C on K412-NR at %g kV" % (1000 * c_thick, e0) spc_k412nr.rename(sName) spc_k412nr.display() fi = wrkDir + "/" fi += sName fi += "-%g-Traj.msa" % (n_traj) spc_k412nr.setAsStandard(k412nr) spc_k412nr.save(fi) # simulate K412-JF spc_k412jf = mc3.coatedSubstrate(ctg, c_thick, k412jf, det, e0, True, n_traj, dose, True, True, {}) sName = "%g nm C on K412-JF at %g kV" % (1000 * c_thick, e0) spc_k412jf.rename(sName) spc_k412jf.setAsStandard(k412jf)
ni2p = material("Ni2P", 7.39) fe = material("Fe", 7.874) s310 = defineMat(("P", "S", "Cr", "Mn", "Fe", "Ni", ), (0.0004,0.0003,0.2500,0.0200,0.5069,0.2050), "S310", 7.89) srm1155 = defineMat(("C" , "Co", "Cr", "Cu", "Mn" , "Mo", "Ni", "S", "V",), (0.0445, 0.1052, 18.37, 0.1734, 1.619, 2.386, 12.35, 0.0175, 0.0508), "SRM-1155", 7.89) # Fe spc_fe = mc3.coatedSubstrate(ctg, c_thick, fe, det, e0, True, n_traj, dose, True, True, {}) sName = "%g nm C on Fe at %g kV" % (1000*c_thick, e0) spc_fe.rename(sName) spc_fe.display() fi = wrkDir + "/" fi += sName fi += "-%g-Traj.msa" % (n_traj) spc_fe.setAsStandard(fe) spc_fe.save(fi) # S310 spc_s310 = mc3.coatedSubstrate(ctg, c_thick, s310, det, e0, True, n_traj, dose, True, True, {}) sName = "%g nm C on S310 at %g kV" % (1000*c_thick, e0) spc_s310.rename(sName) spc_s310.setAsStandard(s310)
trs = mc3.suggestTransitions(si, e0) for tr in trs: xrts.append(tr) xtraParams={} xtraParams.update(mc3.configureXRayAccumulators(xrts,True, True, True)) stds = { element("O"): spc_zno_std, element("Zn"): spc_zno_std, element("Si"): spc_si_std } print("Specimen Name \t\t Oxygen Ka1 K-Ratio \t Zinc La1 K-Ratio \t Si Ka K-Ratio ") #5 nm ZnO on Si at 4 kV 0.073166 ± 0.000133 0.075862 ± 0.000106 0.877289 ± 0.000202 for thNm in lThNm: thUm = thNm/1000. spc = mc3.coatedSubstrate(zno, thUm, si, det, e0, True, nTraj, dose, True, True, xtraParams) sName = "%g nm ZnO on Si at %g kV" % (thNm, e0) spc.rename(sName) spc.display() fi = resDir + "/" fi += sName fi += "-%g-Traj.msa" % (nTraj) spc.save(fi) ff=epq.FilterFit(det,epq.ToSI.keV(e0)) ff.addReference(element("O"), spc_zno_std) ff.addReference(element("Zn"), spc_zno_std) ff.addReference(element("Si"), spc_si_std) kr = ff.getKRatios(spc) kO = kr.getKRatioU(epq.XRayTransition(epq.Element.O, epq.XRayTransition.KA1))
for dir in dirs: dir = dir.replace('\\', '/') print(dir) shutil.rmtree(dir) iCount += 1 lThickC = range( tNmStepC, tNmMaxC+tNmStepC, tNmStepC) for tNmC in lThickC: ts = time.time() spc = mc3.coatedSubstrate(c, tNmC*1.0e-3, si, det, e0, True, nTraj, dose, True, True, xp) spc = epq.SpectrumUtils.addNoiseToSpectrum(spc, 1.0) spc = wrap(spc) sName = "%g-nm-C-on-Si-%g-kV-%d-traj" % (tNmC, e0, nTraj) spc.rename(sName) res = anaConSi(spc, det, digits=2, display=False) cI = res["C"] siI = res["Si"] lT.append(tNmC) lPICmu.append(cI[0]) lPICuc.append(cI[1]) lPISimu.append(siI[0]) lPISiuc.append(siI[1]) iCount += 1 te = time.time() d = (te-ts) / 60.0
homDir = homDir.replace('\\', '/') wrkDir = homDir + "/Documents/git/dtsa2Scripts/sim-nist-k1526/" e0 = 20.0 c_thick = 0.020 # 20 nm n_traj = 10000 dose = 120.0 det = findDetector("Oxford p4 05eV 4K") ctg = material("C", 1.8) k1526 = defineMat( ("Li", "F", "Na", "Al", "P", "Br", "O"), (0.03908, 0.20274, 0.05475, 0.06135, 0.211245, 0.06441, 0.237405), "K-15275", 3.30) # compute spectrum spc_k1526 = mc3.coatedSubstrate(ctg, c_thick, k1526, det, e0, True, n_traj, dose, True, True, {}) spc_k1526.rename("K-1526") spc_k1526.setAsStandard(k1526) spc_k1526.display() sName = "20-nm-C-on-K1526-glass-at-%g-kV" % (e0) spc_k1526.rename(sName) spc_k1526.display() end = time.time() delta = (end - start) / 60 msg = "This script required %.3f min" % delta print msg if (delta > 60): delta = delta / 60
ctg = material("C", 1.8) mno2 = material("MnO2", 5.03) mn = material("Mn", 7.42) sio2 = material("SiO2", 2.65) """ coatedSubstrate(coating, thickness, substrate, det, e0=20.0, withPoisson=True, nTraj=defaultNumTraj, dose=defaultDose, sf=defaultCharFluor, bf=defaultBremFluor, xtraParams=defaultXtraParams) """ spc_mno2 = mc3.coatedSubstrate(ctg, c_thick, mno2, det, e0, True, n_traj, dose, True, True, {}) sName = "%g-nm-C-on-MnO2-at-%g-kV" % (1000 * c_thick, e0) spc_mno2.rename(sName) spc_mno2.display() fi = wrkDir + "/" fi += sName fi += "-%g-Traj.msa" % (n_traj) spc_mno2.setAsStandard(mno2) print(fi) spc_mno2.save(fi) spc_sio2 = mc3.coatedSubstrate(ctg, c_thick, sio2, det, e0, True, n_traj, dose, True, True, {}) sName = "%g-nm-C-on-SiO2-at-%g-kV" % (1000 * c_thick, e0) spc_sio2.rename(sName) spc_sio2.display()
e0 = 20.0 c_thick = 0.020 # 20 nm n_traj = 10000 dose = 120.0 det = findDetector("Oxford p4 05eV 4K") ctg = material("C", 1.8) pyrex = defineMat(( "B", "O", "Na", "Mg", "Al", "Si", "Cl", "Ca", "Fe" ), (0.0392, 0.5384, 0.0312, 0.0003, 0.0117, 0.3772, 0.0010, 0.0007, 0.0003), "pyrex", 2.5) # compute spectrum spc_pyrex = mc3.coatedSubstrate(ctg, c_thick, pyrex, det, e0, True, n_traj, dose, True, True, {}) spc_pyrex.rename("pyrex") spc_pyrex.setAsStandard(pyrex) spc_pyrex.display() sName = "20-nm-C-on-Pyrex-at-%g-kV" % (e0) spc_pyrex.rename(sName) spc_pyrex.display() end = time.time() delta = (end-start)/60 msg = "This script required %.3f min" % delta print msg if(delta > 60): delta = delta/60
path = outDir + "/*/" # clean up any un-needed MC* output directories dirs = glob.glob(path) for dir in dirs: dir = dir.replace('\\', '/') print(dir) shutil.rmtree(dir) iCount += 1 lThickC = range(tNmStepC, tNmMaxC + tNmStepC, tNmStepC) for tNmC in lThickC: ts = time.time() spc = mc3.coatedSubstrate(c, tNmC * 1.0e-3, si, det, e0, True, nTraj, dose, True, True, xp) spc = epq.SpectrumUtils.addNoiseToSpectrum(spc, 1.0) spc = wrap(spc) sName = "%g-nm-C-on-Si-%g-kV-%d-traj" % (tNmC, e0, nTraj) spc.rename(sName) res = anaConSi(spc, det, digits=2, display=False) cI = res["C"] siI = res["Si"] lT.append(tNmC) lPICmu.append(cI[0]) lPICuc.append(cI[1]) lPISimu.append(siI[0]) lPISiuc.append(siI[1]) iCount += 1 te = time.time() d = (te - ts) / 60.0
homDir = homDir.replace('\\', '/') wrkDir = homDir + "/Documents/git/dtsa2Scripts/simulateCorning1737Glass/" ctg = material("C", 1.8) c1737 = defineMat(("Ba", "Sr", "As", "Ca", "Si", "Al", "Mg", "O", "B"), (0.0863, 0.1502, 0.0428, 0.02862, 0.27676, 0.08863, 0.00486, 0.47299, 0.02254), "Corning 1737 Glass", 2.540) """ coatedSubstrate(coating, thickness, substrate, det, e0=20.0, withPoisson=True, nTraj=defaultNumTraj, dose=defaultDose, sf=defaultCharFluor, bf=defaultBremFluor, xtraParams=defaultXtraParams) """ spc_c1737 = mc3.coatedSubstrate(ctg, c_thick, c1737, det, e0, True, n_traj, dose, True, True, {}) sName = "%g nm C on Corning 1737 Glass at %g kV" % (1000 * c_thick, e0) spc_c1737.rename(sName) spc_c1737.display() spc_c1737.setAsStandard(c1737) fi = wrkDir + "/" fi += sName fi += "-%g-Traj.msa" % (n_traj) spc_c1737.save(fi) end = time.time() delta = (end - start) / 60 msg = "This script required %.3f min" % delta print msg if (delta > 60): delta = delta / 60
b = material("B", density=2.37) bn = material("BN", density=2.1) aln = material("AlN", density=3.26) """ Simulate a spectrum of a coating on a substrate. Monte Carlo simulate a spectrum from a 'substrate' material coated with 'coating' of the specified thickness (in microns). coatedSubstrate(coating, thickness, substrate, det, e0=20.0, withPoisson=True, nTraj=defaultNumTraj, dose=defaultDose, sf=defaultCharFluor, bf=defaultBremFluor, xtraParams=defaultXtraParams) """ spc_bn = mc.coatedSubstrate(c, 20.0e-03, bn, det, 5.0, True, nTraj, dose, True, True, {}) spc_bn.rename("10-nm-C-on-BN-5-kV") spc_bn.setAsStandard(bn) spc_bn.display() spc_b = mc.coatedSubstrate(c, 20.0e-03, b, det, 5.0, True, nTraj, dose, True, True, {}) spc_b.rename("10-nm-C-on-B-5-kV") spc_b.setAsStandard(b) spc_b.display() spc_aln = mc.coatedSubstrate(c, 20.0e-03, aln, det, 5.0, True, nTraj, dose, True, True, {}) spc_aln.rename("10-nm-C-on-AlN-5-kV") spc_aln.setAsStandard(aln) spc_aln.display()