def simSonoraSpc(tAl2O3, e0, det, wkDst=5, lt=100, pc=1, nTraj=1000, xtraParams={}): """simSonoraSpc(tAl2O3, e0, det, wkDst=5, lt=100, pc=1, nTraj=1000, xtraParams={}) Simulate a spectrum from tAl2O3 nm of Al2O3 on Al recoreed at e0 kV using the DTSA detector det and a wkDst mm working distance for lt sec with a probe current of pc nA. Compute nTraj trajectories.""" tAl = 100 # um al2o3 = dt2.material("Al2O3",density=3.95) al = dt2.material("Al", density=2.70) lAl2O3 = [al2o3, tAl2O3*1.0e-9] lAl = [al, tAl*1.0e-6] lay = [lAl2O3, lAl] sNam = "%g-nm-Al2O3-on-Al-%g-kV" % (tAl2O3, e0) spc = dt2.wrap(mc3.multiFilm(lay, det, e0, True, nTraj, lt*pc, True, True, xtraParams)) props=spc.getProperties() props.setTextProperty(epq.SpectrumProperties.SpectrumDisplayName, sNam) props.setNumericProperty(epq.SpectrumProperties.LiveTime, lt) props.setNumericProperty(epq.SpectrumProperties.FaradayBegin, pc) props.setNumericProperty(epq.SpectrumProperties.BeamEnergy, e0) props.setNumericProperty(epq.SpectrumProperties.WorkingDistance, wkDst) return(spc)
def simNiCuPetSpc(tNi, tCu, e0, det, wkDst=17, lt=100, pc=1, nTraj=1000): """simNiCuPetSpc(tNi, tCu, e0, det, wkDst=17, lt=100, pc=1, nTraj=1000) Simulate a spectrum from tNi nm of Ni on tCu nm of Cu on PET recoreded at e0 kV using the DTSA detector det and a wkDst mm working distance for lt sec with a probe current of pc nA. Compute nTraj trajectories.""" tPET = 76 # um pet = dt2.material("C10H8O4",density=1.37) cu = dt2.material("Cu", density=8.96) ni = dt2.material("Ni", density=8.90) lNi = [ni, tNi*1.0e-9] lCu = [cu, tCu*1.0e-9] lPET = [pet, tPET*1.0e-6] lay = [lNi, lCu, lPET] sNam = "%g-nm-Ni-%g-nm-Cu-on-PET-%g-kV" % (tNi, tCu, e0) spc = dt2.wrap(mc3.multiFilm(lay, det, e0, True, nTraj, lt*pc, True, True)) props=spc.getProperties() props.setTextProperty(epq.SpectrumProperties.SpectrumDisplayName, sNam) props.setNumericProperty(epq.SpectrumProperties.LiveTime, lt) props.setNumericProperty(epq.SpectrumProperties.FaradayBegin, pc) props.setNumericProperty(epq.SpectrumProperties.BeamEnergy, e0) props.setNumericProperty(epq.SpectrumProperties.WorkingDistance, wkDst) return(spc)
def fullSimBulkStd(mat, ctg, ctgThickNm, det, e0, nTraj, outPath, dim=5.0e-6, lt=100, pc=1.0, emiSize=512, ctd=False): """ fullSimBulkStd(mat, ctg, ctgThickNm, det, e0, nTraj, outPath, dim=5.0e-6, lt=100, pc=1.0, emiSize=512, ctd=False) Use mc3 simulation to simulate an uncoated standard specimen Parameters ---------- mat - a dtsa material. Note the material must have an associated density. It should have a useful name. ctg - a dtsa2 material for the coating det - a dtsa detector Here is where we get the detector properties and calibration e0 - float The accelerating voltage in kV nTraj - integer The number of trajectories to run outPath - string The path to the directory for output dim - float (5.0e-6) The size of the emission images lt - integer (100) The live time (sec) pc - float (1.0) The probe current in nA emiSize - int (default 512) The width and depth of the emission images. ctd - Boolean (False) - is C coated Returns ------- sim - DTSA scriptable spectrum The simulated standard spectrum Example ------- import dtsa2 as dtsa2 import dtsa2.jmMC3 as jm3 outPath = "path/to/yours/spc" cu = material("Cu", density=8.92) det = findDetector("Si(Li)") a = fullSimBulkStd(cu, det, 15.0, 100, outPath, dim=5.0e-6, lt=100, pc=1.0, emiSize=512, ctd=False) a.display() """ start = time.time() strCtg = ctg.getName() strMat = mat.getName() dose = pc * lt # na-sec" # specify the transitions to generate xrts = [] trs = mc3.suggestTransitions(mat, e0) for tr in trs: xrts.append(tr) trs = mc3.suggestTransitions(ctg, e0) for tr in trs: xrts.append(tr) # At 20 kV the images are best at 2.0e-6 xtraParams = {} xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True)) # note that the image size on the specimen is in meters... xtraParams.update(mc3.configureEmissionImages(xrts, 2.0e-6, 512)) xtraParams.update(mc3.configurePhiRhoZ(2.0e-6)) xtraParams.update(mc3.configureTrajectoryImage(2.0e-6, 512)) xtraParams.update(mc3.configureVRML(nElectrons=100)) xtraParams.update(mc3.configureOutput(outPath)) print("Output sent to %s") % (outPath) layers = [[ctg, ctgThickNm * 1.0e-9], [mat, 1.0e-3]] sim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams=xtraParams) sName = "%g-nm-%s-on-%s-%g-kV" % (ctgThickNm, strCtg, strMat, e0) sim.rename(sName) sim.setAsStandard(mat) sim.display() end = time.time() delta = end - start msg = "This simulation required %.f sec" % (delta) print(msg) msg = " %.f min" % (delta / 60.0) print(msg) msg = " %.f hr" % (delta / 360.0) print("") return (sim)
xtraParams = {} xtraParams.update(mc3.configurePhiRhoZ(przDepUm * 1.0e-6)) xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True)) # note that the image size on the specimen is in meters... xtraParams.update(mc3.configureEmissionImages(xrts, imgSzUm * 1.0e-6, imgSize)) xtraParams.update(mc3.configureTrajectoryImage(imgSzUm * 1.0e-6, imgSize)) xtraParams.update(mc3.configureVRML(nElectrons=vmrlEl)) xtraParams.update(mc3.configureOutput(simDir)) print(xtraParams) fmtS = "%g-nm-C-on-EagleXG-at-%g-kV" print("Starting simulation") multiLaySim = mc3.multiFilm(layers, det, e0, True, nTraj, dose, True, True, xtraParams) sName = fmtS % (tCNm, e0) multiLaySim.rename(sName) multiLaySim.setAsStandard(eagleXG) multiLaySim.display() fi = spcDir + "/" fi += sName fi += "-%g-Traj.msa" % (nTraj) multiLaySim.save(fi) # clean up cruft shutil.rmtree(rptDir) print "Done!" end = time.time() delta = (end - start) / 60
lPISiuc = [] # an array for Si peak integral uncertainty iCount = 0 for tNmC in lThickC: if tNmC == 0: layers = [[si, 50.0e-6]] else: layers = [[c, tNmC * 1.0e-9], [si, 50.0e-6]] spc = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams={}) if tNmC < 1: sName = "Si-%g-kV" % (e0) spcNa = "Si" else: sName = "%g-nm-C-on-Si-%g-kV" % (tNmC, e0) spcNa = "%g nm C on Si" % (tNmC) spc.rename(spcNa) res = anaCSi(spc, det, digits=2, display=True) cI = res["C"]
# # K496 Sim # layers = [[c, 2.0e-9], [k496, 50.0e-6]] # multiFilm(layers, det, e0=20.0, withPoisson=True, # nTraj=defaultNumTraj, dose=defaultDose, # sf=defaultCharFluor, bf=defaultBremFluor, # xtraParams=defaultXtraParams) k496Sim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams={}) sName = "%g-nm-C-on-K496" % tNmC k496Sim.rename(sName) k496Sim.setAsStandard(k496) k496Sim.display() fi = spcDir + "/" fi += sName fi += "-%g-Traj.msa" % (nTraj) k496Sim.save(fi) # K-497 Sim layers = [[c, 2.0e-9], [k497, 50.0e-6]]
lPISimu = [] # an array for mean Si peak integral lPISiuc = [] # an array for Si peak integral uncertainty iCount = 0 for tNmC in lThickC: if tNmC == 0: layers = [ [si, 50.0e-6] ] else: layers = [ [c, tNmC*1.0e-9], [si, 50.0e-6] ] spc = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams={}) if tNmC < 1: sName = "Si-%g-kV" % (e0) spcNa = "Si" else: sName = "%g-nm-C-on-Si-%g-kV" % (tNmC, e0) spcNa = "%g nm C on Si" % (tNmC) spc.rename(spcNa) res = anaCSi(spc, det, digits=2, display=True) cI = res["C"] siI = res["Si"] lPICmu.append(cI[0]) lPICuc.append(cI[1]) lPISimu.append(siI[0])
epq.Composition([epq.Element.Au, epq.Element.Pd], [0.60, 0.40]), epq.ToSI.gPerCC(0.6 * 19.30 + 0.4 * 11.9)) ta = material("Ta", density=16.4) layers = [[sio2, tNmSiO2 * 1.0e-9], [c, 50.0e-6]] # multiFilm(layers, det, e0=20.0, withPoisson=True, # nTraj=defaultNumTraj, dose=defaultDose, # sf=defaultCharFluor, bf=defaultBremFluor, # xtraParams=defaultXtraParams) basSim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams={}) sName = "%g nm SiO2 on C" % tNmSiO2 basSim.rename(sName) basSim.display() fi = spcDir + "/%g-nm-SiO2-on-Si-%g-kV-%g-Traj.msa" % (tNmSiO2, e0, nTraj) basSim.save(fi) layers = [[aupd, tNmAuPd * 1.0e-9], [sio2, tNmSiO2 * 1.0e-9], [c, 50.0e-6]] aupdCtd = mc3.multiFilm(layers, det,
def simCarbonCoatedStd(mat, det, e0, nTraj, lt=100, pc=1.0, tc=20.0): """simCarbonCoatedStd(mat, det, e0, nTraj, lt=100, pc=1.0, tc=20.0) Use mc3 multilayer simulation to simulate a C-ctd standard specimen Parameters ---------- mat - a dtsa material. Note the material must have an associated density. It should have a useful name. det - a dtsa detector Here is where we get the detector properties and calibration e0 - float The accelerating voltage in kV nTraj - integer The number of trajectories to run lt - integer (100) The live time (sec) pc - float (1.0) The probe current in nA tc - float (20.0) C thickness in nm Returns ------- sim - DTSA scriptable spectrum The simulated standard spectrum Example ------- import dtsa2.jmMC3 as jm3 det = findDetector("Si(Li)") mgo = material("MgO", density=3.58) a = jm3.simCarbonCoatedStd(mgo, det, 20.0, 100, 100, 1.0, 20.0) a.display() """ dose = pc * lt # na-sec" c = dt2.material("C", density=2.1) layers = [[c, tc * 1.0e-9], [mat, 50.0e-6]] xrts = [] trs = mc3.suggestTransitions(c, e0) for tr in trs: xrts.append(tr) trs = mc3.suggestTransitions(mat, e0) for tr in trs: xrts.append(tr) xtraParams = {} xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True)) sim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams=xtraParams) sName = "%g-nm-C-on-%s-%g-kV-%g-Traj" % (tc, mat, e0, nTraj) sim.rename(sName) sim.setAsStandard(mat) return sim
def sim_amc_coated_mat(mat, det, e0, nTraj, lt=100, pc=1.0, tc=20.0): """sim_amc_coated_mat(mat, det, e0, nTraj, lt=100, pc=1.0, tc=20.0) Use mc3 multilayer simulation to simulate an am-C-ctd specimen Parameters ---------- mat - a dtsa material. Note the material must have an associated density. It should have a useful name. det - a dtsa detector Here is where we get the detector properties and calibration e0 - float The accelerating voltage in kV nTraj - integer The number of trajectories to run lt - integer (100) The live time (sec) pc - float (1.0) The probe current in nA tc - float (20.0) C thickness in nm Returns ------- sim - DTSA scriptable spectrum The simulated spectrum Example ------- import dtsa2.jmMC3 as jm3 det = findDetector("Oxford p4 05eV 2K") si = material("Si", density=2.3296) a = jm3.simCarbonCoatedStd(mgo, det, 20.0, 100, 100, 1.0, 20.0) a.display() """ dose = pc * lt # na-sec" amc = material("C", density=1.35) amcThickComment = "amC Thickness = %g nm %g trajectories" % (tc, nTraj) layers = [ [amc, tc*1.0e-9], [mat, 50.0e-6] ] xrts = [] trs = mc3.suggestTransitions(amc, e0) for tr in trs: xrts.append(tr) trs = mc3.suggestTransitions(mat, e0) for tr in trs: xrts.append(tr) xtraParams={} xtraParams.update(mc3.configureXRayAccumulators(xrts,True, True, True)) sim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams=xtraParams) sName = "%g-nm-amC-on-%s-%g-kV" % (tc, mat, e0) sim.rename(sName) sim.getProperties().setTextProperty(epq.SpectrumProperties.SpectrumComment, amcThickComment) return sim
xtraParams = {} xtraParams.update(mc3.configurePhiRhoZ(przDepUm * 1.0e-6, resln)) xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True)) # note that the image size on the specimen is in meters... xtraParams.update(mc3.configureEmissionImages(xrts, imgSzUm * 1.0e-6, imgSize)) xtraParams.update(mc3.configureTrajectoryImage(imgSzUm * 1.0e-6, imgSize)) xtraParams.update(mc3.configureVRML(nElectrons=vmrlEl)) xtraParams.update(mc3.configureOutput(simDir)) print(xtraParams) k411Sim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams=xtraParams) sName = "%g-nm-C-on-K411-%g-kV" % (tNmC, e0) k411Sim.rename(sName) k411Sim.setAsStandard(k411) k411Sim.display() fi = spcDir + "/" + sName + "-%g-Traj.msa" % (nTraj) k411Sim.save(fi) # Now apatite std layers = [[c, tNmC * 1.0e-9], [apatite, 50.0e-6]]
def simCtdOxOnSi(det, e0, nTraj, lt=100, pc=1.0, tox = 10.0, tc=20.0): """ simCtdOxOnSi(det, e0, nTraj, lt=100, pc=1.0, tox = 10.0, tc=20.0) Use mc3 multilayer simulation to simulate a C-ctd silicon specimen with a native oxide layer. det - a dtsa detector Here is where we get the detector properties and calibration e0 - float The accelerating voltage in kV nTraj - integer The number of trajectories to run lt - integer (100) The live time (sec) pc - float (1.0) The probe current in nA tox - float (10.0) The thickness of the native oxide in nm tc - float (20.0) C thickness in nm Returns ------- sim - DTSA scriptable spectrum The simulated spectrum Example ------- import dtsa2.jmMC3 as jm3 det = findDetector("Oxford p4 05eV 2K") a = jm3.simCtdOxOnSi(det, 3.0, 100, 100, 1.0, 10.0, 20.0) a.display() """ c = dt2.material("C", density=2.1) si = dt2.material("Si", density=2.329) sio2 = dt2.material("SiO2", density=2.65) dose = pc * lt # na-sec" layers = [ [ c, tc*1.0e-9], [sio2, tox*1.0e-9], [si, 50.0e-6] ] xrts = [] trs = mc3.suggestTransitions(c, e0) for tr in trs: xrts.append(tr) trs = mc3.suggestTransitions(sio2, e0) for tr in trs: xrts.append(tr) xtraParams={} xtraParams.update(mc3.configureXRayAccumulators(xrts,True, True, True)) sim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams=xtraParams) sName = "%g-nm-C-on-%g-nm-SiO2-on-Si-%g-kV-%g-Traj" % (tc, tox, e0, nTraj) sim.rename(sName) return sim
xrts.append(tr) xtraParams={} xtraParams.update(mc3.configurePhiRhoZ(przDepUm*1.0e-6, resln)) xtraParams.update(mc3.configureXRayAccumulators(xrts,True, True, True)) # note that the image size on the specimen is in meters... xtraParams.update(mc3.configureEmissionImages(xrts, imgSzUm*1.0e-6, imgSize)) xtraParams.update(mc3.configureTrajectoryImage(imgSzUm*1.0e-6, imgSize)) xtraParams.update(mc3.configureVRML(nElectrons = vmrlEl)) xtraParams.update(mc3.configureOutput(simDir)) print(xtraParams) k411Sim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams=xtraParams) sName = "%g-nm-C-on-K411-%g-kV" % (tNmC, e0) k411Sim.rename(sName) k411Sim.setAsStandard(k411) k411Sim.display() fi = spcDir + "/" + sName + "-%g-Traj.msa" % (nTraj) k411Sim.save(fi) # Now apatite std layers = [ [c, tNmC*1.0e-9], [apatite, 50.0e-6] ] xrts = []
def simCoatedSubstrate(mat, ctg, thNm, det, e0, nTraj, lt=100, pc=1.0): """simCoatedSubstrate(mat, ctg, thNm, det, e0, nTraj, lt=100, pc=1.0) Use mc3 multilayer simulation to simulate an coated substrate specimen This ONLY generates a spectrum Parameters ---------- mat - a dtsa material for the substrate. Note the material must have an associated density. It should have a useful name. ctg - a dtsa material for the coating thNm - coating thickness in nm det - a dtsa detector Here is where we get the detector properties and calibration e0 - float The accelerating voltage in kV nTraj - integer The number of trajectories to run lt - integer (100) The live time (sec) pc - float (1.0) The probe current in nA tc - float (20.0) C thickness in nm Returns ------- sim - DTSA scriptable spectrum The simulated spectrum Example ------- import dtsa2 as dtsa2 import dtsa2.jmMC3 as jm3 det = findDetector("Si(Li)") sio2 = material("SiO2", 2.65) si = material("Si", 2.3296) a = jm3.simCoatedSubstrate(si, sio2, 10.0, det, e0, nTraj, 100, 1.0) a.display() """ dose = pc * lt # na-sec" layers = [[ctg, thNm * 1.0e-9], [mat, 50.0e-6]] xrts = [] trs = mc3.suggestTransitions(ctg, e0) for tr in trs: xrts.append(tr) trs = mc3.suggestTransitions(mat, e0) for tr in trs: xrts.append(tr) xtraParams = {} xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True)) sim = mc3.multiFilm(layers, det, e0, True, nTraj, dose, True, True, xtraParams) sName = "%g-nm-%s-on-%s-%g-kV" % (thNm, ctg, mat, e0) sim.rename(sName) return sim
xtraP = {} xtraP = {"Characteristic Accumulator":True, "Char Fluor Accumulator":True, "Brem Fluor Accumulator":True} # outpathoutPath = "/Users/jrminter/Documents/git/dtsa2Scripts/ben-buse/out/" xtraP.update(mc3.configureOutput(outPath)) xtraP.update(mc3.configurePhiRhoZ(1.5*range)) xtraP.update(mc3.configureEmissionImages(trs, 1.5*range, size = 512)) xtraP.update(mc3.configureTrajectoryImage(1.5*range, size = 512)) resF = {} for fil in film: extension = str(film[fil][0]) extension = extension.replace("[","") extension = extension.replace("]","") extension = extension.replace(",","") # pathloc = 'O:\Documents\PFE_Data\Users\Charles_Younes\\041115_CarbonInSteel\\dtsa2repeat7_' + extension # Change to output folder xtraP.update(mc3.configureOutput(outPath)) print xtraP resF[fil] = mc3.multiFilm(film[fil], det,e0=e0, nTraj=nE, dose=500.0, sf=True, bf=True,xtraParams=xtraP) # run simulations tmp = str(resF[fil]) tmpx = extension + tmp resF[fil].rename(tmpx) resF[fil].save("%s/%s.msa" % ( outPath, resF[fil] )) # change outPath above to output folder ( location, name) it adds extension resF[fil].display() """
def simCtdOxOnSi(det, e0, nTraj, lt=100, pc=1.0, tox=10.0, tc=20.0): """ simCtdOxOnSi(det, e0, nTraj, lt=100, pc=1.0, tox = 10.0, tc=20.0) Use mc3 multilayer simulation to simulate a C-ctd silicon specimen with a native oxide layer. det - a dtsa detector Here is where we get the detector properties and calibration e0 - float The accelerating voltage in kV nTraj - integer The number of trajectories to run lt - integer (100) The live time (sec) pc - float (1.0) The probe current in nA tox - float (10.0) The thickness of the native oxide in nm tc - float (20.0) C thickness in nm Returns ------- sim - DTSA scriptable spectrum The simulated spectrum Example ------- import dtsa2.jmMC3 as jm3 det = findDetector("Si(Li)") a = jm3.simCtdOxOnSi(det, 3.0, 100, 100, 1.0, 10.0, 20.0) a.display() """ c = dt2.material("C", density=2.1) si = dt2.material("Si", density=2.329) sio2 = dt2.material("SiO2", density=2.65) dose = pc * lt # na-sec" layers = [[c, tc * 1.0e-9], [sio2, tox * 1.0e-9], [si, 50.0e-6]] xrts = [] trs = mc3.suggestTransitions(c, e0) for tr in trs: xrts.append(tr) trs = mc3.suggestTransitions(sio2, e0) for tr in trs: xrts.append(tr) xtraParams = {} xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True)) sim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams=xtraParams) sName = "%g-nm-C-on-%g-nm-SiO2-on-Si-%g-kV-%g-Traj" % (tc, tox, e0, nTraj) sim.rename(sName) return sim
lKAuL = [] # lKAuM=[] # lists of Cu K-ratios # lKCuL=[] lKCuK = [] for i in range(nSteps): tNmAu = tNmStep * float(i + 1) print(tNmAu) lNm.append(tNmAu) sLay = [[au, tNmAu / 1.0e9], [cu, 100.0]] sSpc = mc3.multiFilm(sLay, det, e0=e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=charF, bf=bremF, xtraParams={}) sp = sSpc.getProperties() sp.setTextProperty(epq.SpectrumProperties.SpectrumDisplayName, "%g-nm-Au-on-Cu" % tNmAu) sp.setNumericProperty(epq.SpectrumProperties.LiveTime, lt) sp.setNumericProperty(epq.SpectrumProperties.FaradayBegin, dose) sp.setNumericProperty(epq.SpectrumProperties.FaradayEnd, dose) display(sSpc) a = jmg.compKRs(sSpc, stds, trs, det, e0) print(a[0]) print(a[1]) lKAuL.append(a[0])
def sim_amc_coated_mat(mat, det, e0, nTraj, lt=100, pc=1.0, tc=20.0): """sim_amc_coated_mat(mat, det, e0, nTraj, lt=100, pc=1.0, tc=20.0) Use mc3 multilayer simulation to simulate an am-C-ctd specimen Parameters ---------- mat - a dtsa material. Note the material must have an associated density. It should have a useful name. det - a dtsa detector Here is where we get the detector properties and calibration e0 - float The accelerating voltage in kV nTraj - integer The number of trajectories to run lt - integer (100) The live time (sec) pc - float (1.0) The probe current in nA tc - float (20.0) C thickness in nm Returns ------- sim - DTSA scriptable spectrum The simulated spectrum Example ------- import dtsa2.jmMC3 as jm3 det = findDetector("Oxford p4 05eV 2K") si = material("Si", density=2.3296) a = jm3.simCarbonCoatedStd(mgo, det, 5.0, 100, 100, 1.0, 20.0) a.display() """ dose = pc * lt # na-sec" amc = material("C", density=1.35) amcThickComment = "amC Thickness = %g nm %g trajectories" % (tc, nTraj) layers = [[amc, tc * 1.0e-9], [mat, 50.0e-6]] xrts = [] trs = mc3.suggestTransitions(amc, e0) for tr in trs: xrts.append(tr) trs = mc3.suggestTransitions(mat, e0) for tr in trs: xrts.append(tr) xtraParams = {} xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True)) sim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams=xtraParams) sName = "%g-nm-amC-on-%s-%g-kV" % (tc, mat, e0) sim.rename(sName) sim.getProperties().setTextProperty(epq.SpectrumProperties.SpectrumComment, amcThickComment) return sim
xtraParams.update(mc3.configurePhiRhoZ(przDepUm*1.0e-6)) xtraParams.update(mc3.configureXRayAccumulators(xrts,True, True, True)) # note that the image size on the specimen is in meters... xtraParams.update(mc3.configureEmissionImages(xrts, imgSzUm*1.0e-6, imgSize)) xtraParams.update(mc3.configureTrajectoryImage(imgSzUm*1.0e-6, imgSize)) xtraParams.update(mc3.configureVRML(nElectrons = vmrlEl)) xtraParams.update(mc3.configureOutput(spcDir)) print(xtraParams) layers = [ [raft, tNmRAFT*1.0e-9], # top layer of RAFT [zno, tNmZnO*1.0e-9], # ZnO layer [raft, tNmRAFT*1.0e-9], # bottom layer of RAFT [si, 50.0e-6] # 50 micron (inf. thick Si substrate) ] spc = mc3.multiFilm(layers, det, e0, True, nTraj, dose, True, True, xtraParams) strName = "%g-nm-RAFT-encapsulated-%g-nm-ZnO-on-Si-%g-kV" spcName = strName % (tNmRAFT, tNmZnO, e0) spc.rename(spcName) spc.display() # only save spectrum with > 500 traj if nTraj > 500: fi = spcDir + "/" fi += spcName fi += "-%g-Traj.msa" % (nTraj) spc.save(fi)
sp.setNumericProperty(epq.SpectrumProperties.FaradayEnd, dose) sp.setNumericProperty(epq.SpectrumProperties.BeamEnergy, e0) sp.setCompositionProperty(epq.SpectrumProperties.StandardComposition, epq.Composition(epq.Element.Cu)) # display(cuSpc) cuStd = {"El":element("Cu"), "Spc":cuSpc} stds = [cStd, cuStd] lNm=[] lKCK=[] lKCuL=[] for i in range(500): tNmC = float(i+1) lNm.append(tNmC) sLay = [[c, tNmC/1.0e9], [cu, 100.0]] sSpc = mc3.multiFilm(sLay, det, e0=e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=charF, bf=bremF, xtraParams={}) sp=sSpc.getProperties() sp.setTextProperty(epq.SpectrumProperties.SpectrumDisplayName,"%g-nm-C-on-Cu"% tNmC) sp.setNumericProperty(epq.SpectrumProperties.LiveTime, lt) sp.setNumericProperty(epq.SpectrumProperties.FaradayBegin, dose) sp.setNumericProperty(epq.SpectrumProperties.FaradayEnd, dose) # display(sSpc) a = jmg.compKRs(sSpc, stds, trs, det, e0) lKCK.append(a[0]) lKCuL.append(a[1]) print (i+1) # prepare the output file csvPath = csvDir + "/sim-C-on-Cu-%gkV.csv" % e0 f=open(csvPath, 'w') strLine = 'tNm, kCKa, kCuLa\n'
[0.60,0.40]), epq.ToSI.gPerCC(0.6*19.30+0.4*11.9)) ta = material("Ta", density=16.4) layers = [ [sio2, tNmSiO2*1.0e-9], [c, 50.0e-6] ] # multiFilm(layers, det, e0=20.0, withPoisson=True, # nTraj=defaultNumTraj, dose=defaultDose, # sf=defaultCharFluor, bf=defaultBremFluor, # xtraParams=defaultXtraParams) basSim = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams={}) sName = "%g nm SiO2 on C" % tNmSiO2 basSim.rename(sName) basSim.display() fi = spcDir + "/%g-nm-SiO2-on-Si-%g-kV-%g-Traj.msa" % (tNmSiO2, e0, nTraj) basSim.save(fi) layers = [ [aupd, tNmAuPd*1.0e-9], [sio2, tNmSiO2*1.0e-9], [c, 50.0e-6] ] aupdCtd = mc3.multiFilm(layers, det, e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=True, bf=True, xtraParams={})