def anaMcNiCuKa(spc, det, stdBase, maxCh=1200): props=spc.getProperties() e0 = props.getNumericProperty(epq.SpectrumProperties.BeamEnergy) lt = props.getNumericProperty(epq.SpectrumProperties.LiveTime) pc = props.getNumericProperty(epq.SpectrumProperties.FaradayBegin) wkDst = props.getNumericProperty(epq.SpectrumProperties.WorkingDistance) spc = jmg.cropSpec(spc, end=maxCh) unSpc = jmg.updateCommonSpecProps(spc, det, liveTime=lt, probeCur=pc, e0=e0, wrkDist=wkDst) dt2.display(unSpc) # define the transitions I want to measure tsNiKa = epq.XRayTransitionSet(epq.Element.Ni, epq.XRayTransitionSet.K_FAMILY) tsCuKa = epq.XRayTransitionSet(epq.Element.Cu, epq.XRayTransitionSet.K_FAMILY) trs = [tsNiKa, tsCuKa] relStd = "/%gkV/" % (e0) stdDir = stdBase + relStd niFile = stdDir + "Ni-sim.msa" cuFile = stdDir + "Cu-sim.msa" spc = dt2.wrap(ept.SpectrumFile.open(niFile)[0]) props=spc.getProperties() e0 = props.getNumericProperty(epq.SpectrumProperties.BeamEnergy) lt = props.getNumericProperty(epq.SpectrumProperties.LiveTime) pc = props.getNumericProperty(epq.SpectrumProperties.FaradayBegin) wkDst = props.getNumericWithDefault(epq.SpectrumProperties.WorkingDistance, wkDst) spc = jmg.cropSpec(spc, end=maxCh) niSpc = jmg.updateCommonSpecProps(spc, det, liveTime=lt, probeCur=pc, e0=e0, wrkDist=wkDst) dt2.display(niSpc) spc = dt2.wrap(ept.SpectrumFile.open(cuFile)[0]) props=spc.getProperties() e0 = props.getNumericProperty(epq.SpectrumProperties.BeamEnergy) lt = props.getNumericProperty(epq.SpectrumProperties.LiveTime) pc = props.getNumericProperty(epq.SpectrumProperties.FaradayBegin) wkDst = props.getNumericWithDefault(epq.SpectrumProperties.WorkingDistance, wkDst) spc = jmg.cropSpec(spc, end=maxCh) cuSpc = jmg.updateCommonSpecProps(spc, det, liveTime=lt, probeCur=pc, e0=e0, wrkDist=wkDst) dt2.display(cuSpc) niStd = {"El":dt2.element("Ni"), "Spc":niSpc} cuStd = {"El":dt2.element("Cu"), "Spc":cuSpc} stds = [niStd, cuStd] theKR = jmg.compKRs(unSpc, stds, trs, det, e0) krNiCalc = theKR[0] krCuCalc = theKR[1] return [krNiCalc, krCuCalc]
msaDir = git + "/OSImageAnalysis/dtsa2/msa/" sDet = "FEI FIB620 EDAX-RTEM" det = findDetector(sDet) pc = 1.0 wrkDist = 17.2 # mm vkV = [15] end = 2048 for e0 in vkV: cuFil = spcDir + "Cu-%g-1.spc" % e0 raw = readSpectrum(cuFil, i=0, det=det) lt = raw.liveTime() print("raw channel count:") print(raw.getChannelCount()) cuStdSpc = jmg.cropSpec(raw, start=0, end=end) props = cuStdSpc.getProperties() props.setDetector(det) props.setTextProperty(epq.SpectrumProperties.SpecimenName, "Cu Grid") props.setNumericProperty(epq.SpectrumProperties.BeamEnergy, e0) props.setNumericProperty(epq.SpectrumProperties.WorkingDistance, wrkDist) cuStdSpc.setLiveTime(lt) cuStdSpc.setProbeCurrent(pc) cuStdSpc.setAsStandard(epq.Composition(epq.Element.Cu)) cuStdSpc.rename("CuStd") display(cuStdSpc) # set up the standard print("cuStdSpc channel count:") print(cuStdSpc.getChannelCount()) display(cuStdSpc) cuStdFil = msaDir + "Cu-%g-Std.msa" % e0
import dtsa2.jmGen as jmg spc = wrap(s1) cr = jmg.cropSpec(spc, end=512) import dtsa2.jmGen as jmg jmg.clearAllSpectra() det = findDetector("FEI FIB620 EDAX-RTEM") liveTim = 100 # sec probeCur = 1 # nA wrkDist = 17 # mm e0 = 15 # kV maxCh = 1200 # define the transitions I want to measure trs = [epq.XRayTransitionSet(epq.Element.Ni, epq.XRayTransitionSet.K_FAMILY), epq.XRayTransitionSet(epq.Element.Cu, epq.XRayTransitionSet.K_FAMILY)] cuFil = "C:/data/eds/CuNiSpc/dtsa-sim/corBulk/15kV/CuSim.msa" niFil = "C:/data/eds/CuNiSpc/dtsa-sim/corBulk/15kV/Ni-Sim.msa" unFil = "C:/data/eds/CuNiSpc/dtsa-sim/StrataGemNiCu/103-nm-Ni-on-198-nm-Cu-15-kV.msa" spc = wrap(ept.SpectrumFile.open(niFil)[0]) spc = jmg.cropSpec(spc, end=maxCh) niSpc = jmg.updateCommonSpecProps(spc, det, liveTime=liveTim, probeCur=probeCur, e0=e0, wrkDist=wrkDist)