def simSpc(mat, e0, det, dose, ntraj, simDir):
	"""
    simSpc(mat, e0, det, dose, ntraj, simDir)

    simulate a spectrum from a material and write it out.
	"""
	xrts = []
	trs = mc3.suggestTransitions(mat, e0)
	for tr in trs:
		xrts.append(tr)

	xtraParams={}
	xtraParams.update(mc3.configureXRayAccumulators(xrts,True, True, True))
	xtraParams.update(mc3.configureOutput(simDir))

	spc = mc3.simulate(mat, det, e0, dose, True,
                       nTraj, True, True, xtraParams)
	fmtS = "%s-at-%g-kV"
	sName = fmtS % (mat.getName(), e0)
	spc.rename(sName)
	spc.display()
	fi =  simDir + "/"
	fi += sName
	fi += "-%g-Traj.msa" % (nTraj)
	spc.save(fi)
	return spc
Ejemplo n.º 2
0
def simSpc(mat, e0, det, dose, ntraj, simDir):
    """
    simSpc(mat, e0, det, dose, ntraj, simDir)

    simulate a spectrum from a material and write it out.
	"""
    xrts = []
    trs = mc3.suggestTransitions(mat, e0)
    for tr in trs:
        xrts.append(tr)

    xtraParams = {}
    xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True))
    xtraParams.update(mc3.configureOutput(simDir))

    spc = mc3.simulate(mat, det, e0, dose, True, nTraj, True, True, xtraParams)
    fmtS = "%s-at-%g-kV"
    sName = fmtS % (mat.getName(), e0)
    spc.rename(sName)
    spc.display()
    fi = simDir + "/"
    fi += sName
    fi += "-%g-Traj.msa" % (nTraj)
    spc.save(fi)
    return spc
Ejemplo n.º 3
0
def simBulkStd(mat, det, e0, nTraj, lt=100, pc=1.0, ctd=True):
    """simBulkStd(mat, det, e0, nTraj, lt=100, pc=1.0)

    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.
    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
    ctd - Boolean (True) - is C coated


    Returns
    -------
    sim - DTSA scriptable spectrum 
        The simulated standard spectrum
    
    Example
    -------
    import dtsa2.jmMC3 as jm3
    det = findDetector("Oxford p4 05eV 2K")
    cu = material("Cu", density=8.92)
    a = jm3.simBulkStd(cu, det, 20.0, 100, 100, 1.0)
    a.display()

    """
    dose = pc * lt  # na-sec"
    xrts = []

    trs = mc3.suggestTransitions(mat, e0)
    for tr in trs:
        xrts.append(tr)

    xtraParams = {}
    xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True))

    sim = mc3.simulate(mat,
                       det,
                       e0,
                       dose,
                       withPoisson=True,
                       nTraj=nTraj,
                       sf=True,
                       bf=True,
                       xtraParams=xtraParams)

    sName = "%s-%g-kV" % (mat, e0)
    sim.rename(sName)
    sim.setAsStandard(mat)
    return sim
Ejemplo n.º 4
0
def simBulkStd(mat, det, e0, nTraj, lt=100, pc=1.0, ctd=True):
    """simBulkStd(mat, det, e0, nTraj, lt=100, pc=1.0)

    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.
    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
    ctd - Boolean (True) - is C coated


    Returns
    -------
    sim - DTSA scriptable spectrum 
        The simulated standard spectrum
    
    Example
    -------
    import dtsa2.jmMC3 as jm3
    det = findDetector("Oxford p4 05eV 2K")
    cu = material("Cu", density=8.92)
    a = jm3.simBulkStd(cu, det, 20.0, 100, 100, 1.0)
    a.display()

    """
    dose = pc * lt  # na-sec"
    xrts = []

    trs = mc3.suggestTransitions(mat, e0)
    for tr in trs:
        xrts.append(tr)

    xtraParams={}
    xtraParams.update(mc3.configureXRayAccumulators(xrts,True, True, True))

    sim = mc3.simulate(mat, det, e0, dose, withPoisson=True, nTraj=nTraj,
                       sf=True, bf=True, xtraParams=xtraParams)

    sName = "%s-%g-kV" % (mat, e0)
    sim.rename(sName)
    sim.setAsStandard(mat)
    return sim
Ejemplo n.º 5
0
def simulate_spectrum(mat, e0, det, nTraj, dose, spcDir):
    """
    simulate_spectrum(mat, e0, det, nTraj, dose, spcDir)
    """
    xrts = []
    trs = mc3.suggestTransitions(mat, e0)
    for tr in trs:
        xrts.append(tr)

    xtraParams={}
    xtraParams.update(mc3.configureXRayAccumulators(xrts,True, True, True))
    # xtraParams.update(mc3.configureOutput(simDir))
    spc = mc3.simulate(mat, det, e0, dose, True, nTraj, True, True, xtraParams)
    sName = "%s std-%g-kV" % (mat.getName(), e0)
    spc.rename(sName)
    spc.setAsStandard(mat)
    spc.display()
    # Save the spectra if NTraj > 500
    if nTraj > 500:
        fi =  spcDir + "/"
        fi += sName
        fi += "-%g-Traj.msa" % (nTraj)
        spc.save(fi)
    return (spc)
Ejemplo n.º 6
0
def uncoatedSimBulkStd(mat,
                       det,
                       e0,
                       nTraj,
                       outPath,
                       dim=5.0e-6,
                       lt=100,
                       pc=1.0,
                       emiSize=512):
    """
	uncoatedSimBulkStd(mat, det, e0, nTraj, outPath,
					   dim=5.0e-6, lt=100, pc=1.0, emiSize=512)

	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.

	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 in um

	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.


	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 = jm3.uncoatedSimBulkStd(cu, det, 15.0, 100, outPath,
							   dim=5.0e-6, lt=100,
							   pc=1.0, emiSize=512)
	a.display()
	"""
    start = time.time()
    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)

    # 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, dim, emiSize))
    xtraParams.update(mc3.configurePhiRhoZ(dim))
    xtraParams.update(mc3.configureTrajectoryImage(dim, emiSize))
    xtraParams.update(mc3.configureVRML(nElectrons=100))
    xtraParams.update(mc3.configureOutput(outPath))
    print("Output sent to %s") % (outPath)
    sim = mc3.simulate(mat, det, e0, lt * pc, True, nTraj, True, True,
                       xtraParams)
    sName = "%s-%g-kV" % (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)
Ejemplo n.º 7
0
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
        "SnO2": 0.0015215,
        "BaO": 0.0012188,
        "Fe2O3": 0.0005078,
        "Sb2O3": 0.0004635,
        "As2O3": 0.0003145,
        "ZrO2": 0.0002938,
        "TiO2": 0.0002540
    },
    density=2.36,
    name="Eagle XG")

layers = [[c, tCNm * 1.0e-9], [eagleXG, 50.0e-6]]

xrts = []

trs = mc3.suggestTransitions(eagleXG, e0)
for tr in trs:
    xrts.append(tr)

trs = mc3.suggestTransitions(c, e0)
for tr in trs:
    xrts.append(tr)

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))
Ejemplo n.º 9
0
# coating  = False

# define materials
crocoite = material("PbCrO4", density=6.0)
crocoite.setName("Crocoite")

si = material("Si", density=2.3290)

k227 = epq.Material(
    epq.Composition([epq.Element.O, epq.Element.Si, epq.Element.Pb],
                    [0.1640, 0.0934, 0.7246]), epq.ToSI.gPerCC(4.0))
k227.setName("k227")

# Start with k227
xrts = []
trs = mc3.suggestTransitions(k227, e0)
for tr in trs:
    xrts.append(tr)

print(trs)

spc_k227 = jm3.simBulkStd(k227, det, e0, nTraj, 100, 1.0, False)
spc_k227.display()
spc_k227.rename("k227-5kV")
spc_k227.setAsStandard(k227)
fi = datDir + "/spc_k227.msa"
print(fi)
if (bSaveSpc):
    spc_k227.save(fi)

# Next Si
Ejemplo n.º 10
0
os.chdir(wd)
pyrDir = wd + "/sim-C-on-Cu-w-Img Results"

det  = findDetector("Oxford p4 05eV 2K")
print(det)


# start clean
DataManager.clearSpectrumList()

# create the materials
c  = epq.Material(epq.Composition([epq.Element.C], [1.0],"C"),  epq.ToSI.gPerCC(2.25))
cu = epq.Material(epq.Composition([epq.Element.Cu],[1.0],"Cu"), epq.ToSI.gPerCC(8.96))

# define the desired transitions
xrts=mc3.suggestTransitions("CCu")

# set up the extra parameters
xtraParams={}
xtraParams.update(mc3.configureXRayAccumulators(xrts, charAccum=charF, charFluorAccum=charF, bremFluorAccum=bremF))
# note that the image size on the specimen is in meters...
xtraParams.update(mc3.configureEmissionImages(xrts, imgSzUm*1.0e-6, imgSize))
xtraParams.update(mc3.configurePhiRhoZ(imgSzUm*1.0e-6))
xtraParams.update(mc3.configureTrajectoryImage(imgSzUm*1.0e-6, imgSize))
xtraParams.update(mc3.configureVRML(nElectrons = vmrlEl))
xtraParams.update(mc3.configureOutput(simDir))

print(xtraParams)

# treat the substrate as 10 um C
sLay = [[c, tNmC/1.0e9], [cu, 10.0/1.0e6]]
Ejemplo n.º 11
0
l_mfs = [0.3872, 0.0794, 0.187, 0.1072, 0.1049, 0.0006, 0.1343]

k309 = jmg.create_material_from_mf(l_comps, l_mfs, 2.6, "K309")

si = material("Si", density=2.32)
caf2 = material("CaF2", density=3.18)
fe = material("Fe", density=7.874)
ti = material("Ti", density=4.506)
zn = material("Zn", density=7.14)
baf2 = material("BaF2", density=4.89)
al2o3 = material("Al2O3", density=3.95)

xrts = []

trs = mc3.suggestTransitions(k309, e0)
for tr in trs:
    xrts.append(tr)

k309_spc = jm3.simBulkStd(k309, det, e0, nTraj, lt, pc, True)
k309_spc.display()

si_spc = jm3.simBulkStd(si, det, e0, nTraj, lt, pc, True)
si_spc.display()

caf2_spc = jm3.simBulkStd(caf2, det, e0, nTraj, lt, pc, True)
caf2_spc.display()

fe_spc = jm3.simBulkStd(fe, det, e0, nTraj, lt, pc, True)
fe_spc.display()
Ejemplo n.º 12
0
   # tmp = u"MC simulation of a [%0.2f,%0.2f,%0.2f] micron block of %s%s coated with %0.2f microns of %s at %0.1f keV%s%s" % (width * 1.0e6, width * 1.0e6, height * 1.0e6, mat, (" on %s" % substrate if substrate else ""), coating, e0, (" + CSF" if sf else ""), (" + BSF" if bf else ""))
   params = {"Substrate": substrate, "Width" : width, "Height" : height, "Material" : mat, "Coating" : coating, "Thickness" : thickness}
   return mc3.base(det, e0, withPoisson, nTraj, dose, sf, bf, tmp, buildBlock, params, xtraParams)


pet   = epq.Material(epq.Composition([epq.Element.C,epq.Element.H,epq.Element.O],[0.62502,0.04196,0.069042]),epq.ToSI.gPerCC(1.37))
pet.setName("PET")
al2o3 = epq.Material(epq.Composition([epq.Element.Al,epq.Element.O],[0.5293,0.4707]),epq.ToSI.gPerCC(3.95))
al2o3.setName("Al2O3")
ag = epq.Material(epq.Composition([epq.Element.Ag],[1.0],"Ag"), epq.ToSI.gPerCC(11.9))
ag.setName("Ag")

# start clean
DataManager.clearSpectrumList()
# define the desired transitions
xrts=mc3.suggestTransitions("COAlAg")
# print(xrts)
# set up the extra parameters
xtraParams={}
xtraParams.update(mc3.configureXRayAccumulators(xrts, charAccum=charF, charFluorAccum=charF, bremFluorAccum=bremF))
# note that the image size on the specimen is in meters...
xtraParams.update(mc3.configureEmissionImages(xrts, imgSzUm*1.0e-6, imgSize))
xtraParams.update(mc3.configurePhiRhoZ(imgSzUm*1.0e-6))
xtraParams.update(mc3.configureTrajectoryImage(imgSzUm*1.0e-6, imgSize))
xtraParams.update(mc3.configureVRML(nElectrons = vmrlEl))
xtraParams.update(mc3.configureOutput(simDir))

print(xtraParams)

spc = coatedOverBlock(ag, tBlk*1.0e-6, wBlk*1.0e-6, al2o3, tFlm*1.0e-6, pet, det, e0=e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=charF, bf=bremF, xtraParams=xtraParams)
display(spc)
Ejemplo n.º 13
0
relPrj = "/dtsa2Scripts/"
simDir = gitDir + relPrj + "/mc3AnodizedAl/"
jmg.ensureDir(simDir)

imgSize =    512         # pixel size for images
imgSzUm =      5.0     # image size in microns
vmrlEl  =    100         # number of el for VMRL

wd = simDir
os.chdir(wd)
pyrDir = wd + "/sim-multifilm-on-sub Results"

det    = findDetector("Oxford p4 05eV 2K")
print(det)

xrts=mc3.suggestTransitions("AlO")
print(xrts)
for tr in xrts:
    print(tr.getSiegbahnName())
for tr in xrts:
    print(tr.getIUPACName())
# set up the extra parameters
xtraParams={}
xtraParams.update(mc3.configureXRayAccumulators(xrts, charAccum=True, charFluorAccum=True, bremFluorAccum=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.configurePhiRhoZ(imgSzUm*1.0e-6))
xtraParams.update(mc3.configureTrajectoryImage(imgSzUm*1.0e-6, imgSize))
xtraParams.update(mc3.configureVRML(nElectrons = vmrlEl))
xtraParams.update(mc3.configureOutput(simDir))
Ejemplo n.º 14
0
pyrDir = wd + "/sim-C-on-Cu-w-Img Results"

det = findDetector("Oxford p4 05eV 2K")
print(det)

# start clean
DataManager.clearSpectrumList()

# create the materials
c = epq.Material(epq.Composition([epq.Element.C], [1.0], "C"),
                 epq.ToSI.gPerCC(2.25))
cu = epq.Material(epq.Composition([epq.Element.Cu], [1.0], "Cu"),
                  epq.ToSI.gPerCC(8.96))

# define the desired transitions
xrts = mc3.suggestTransitions("CCu")

# set up the extra parameters
xtraParams = {}
xtraParams.update(
    mc3.configureXRayAccumulators(xrts,
                                  charAccum=charF,
                                  charFluorAccum=charF,
                                  bremFluorAccum=bremF))
# note that the image size on the specimen is in meters...
xtraParams.update(mc3.configureEmissionImages(xrts, imgSzUm * 1.0e-6, imgSize))
xtraParams.update(mc3.configurePhiRhoZ(imgSzUm * 1.0e-6))
xtraParams.update(mc3.configureTrajectoryImage(imgSzUm * 1.0e-6, imgSize))
xtraParams.update(mc3.configureVRML(nElectrons=vmrlEl))
xtraParams.update(mc3.configureOutput(simDir))
Ejemplo n.º 15
0
dose = pc * lt  # na-sec"

# should not need to change below here

homDir = os.environ['HOME']
homDir = homDir.replace('\\', '/')
wrkDir = homDir + "/Documents/git/dtsa2Scripts/utility"
outDir = homDir + "/Documents/git/dtsa2Scripts/html"
rptDir = wrkDir + '/testMC3AdmiraltyBrass Results/'
simDir = homDir + "/Documents/git/dtsa2Scripts/sim-Admiralty-Brass"
dt2c.ensureDir(simDir)

DataManager.clearSpectrumList()

xrts = []
trs = mc3.suggestTransitions(mix, e0)
for tr in trs:
    xrts.append(tr)

# print(xrts)

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)
Ejemplo n.º 16
0
caf2 = material("CaF2", density= 3.18)

# start with the 'unknown'

layers = [ [c, tNmC*1.0e-9],
           [k411, 50.0e-6]
         ]

# multiFilm(layers, det, e0=20.0, withPoisson=True,
#           nTraj=defaultNumTraj, dose=defaultDose,
#           sf=defaultCharFluor, bf=defaultBremFluor,
#            xtraParams=defaultXtraParams)

xrts = []

trs = mc3.suggestTransitions(c, e0)
for tr in trs:
    xrts.append(tr)

trs = mc3.suggestTransitions(k411, e0)
for tr in trs:
    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))
Ejemplo n.º 17
0
pet = epq.Material(
    epq.Composition([epq.Element.C, epq.Element.H, epq.Element.O],
                    [0.62502, 0.04196, 0.069042]), epq.ToSI.gPerCC(1.37))
pet.setName("PET")
al2o3 = epq.Material(
    epq.Composition([epq.Element.Al, epq.Element.O], [0.5293, 0.4707]),
    epq.ToSI.gPerCC(3.95))
al2o3.setName("Al2O3")
ag = epq.Material(epq.Composition([epq.Element.Ag], [1.0], "Ag"),
                  epq.ToSI.gPerCC(11.9))
ag.setName("Ag")

# start clean
DataManager.clearSpectrumList()
# define the desired transitions
xrts = mc3.suggestTransitions("COAlAg")
# print(xrts)
# set up the extra parameters
xtraParams = {}
xtraParams.update(
    mc3.configureXRayAccumulators(xrts,
                                  charAccum=charF,
                                  charFluorAccum=charF,
                                  bremFluorAccum=bremF))
# note that the image size on the specimen is in meters...
xtraParams.update(mc3.configureEmissionImages(xrts, imgSzUm * 1.0e-6, imgSize))
xtraParams.update(mc3.configurePhiRhoZ(imgSzUm * 1.0e-6))
xtraParams.update(mc3.configureTrajectoryImage(imgSzUm * 1.0e-6, imgSize))
xtraParams.update(mc3.configureVRML(nElectrons=vmrlEl))
xtraParams.update(mc3.configureOutput(simDir))
Ejemplo n.º 18
0
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.mcSimulate3 as mc3
    det = findDetector("Oxford p4 05eV 4K")
    cu = material("Cu", density=8.92)

    outPath = "C:/Users/johnr/Documents/git/dtsa2Scripts/ben-buse/out"

    a = fullSimBulkStd(cu, det, 15.0, 100, outPath,
                       dim=5.0e-6, lt=100,
                       pc=1.0, emiSize=512, ctd=False)
    a.display()

    """
    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" % (tNmC, strCtg, strMat)
    sim.rename(sName)
    sim.setAsStandard(mat)
    sim.display()
    return(sim)
Ejemplo n.º 19
0
}, 1.16, 'Epon828')

det = findDetector("Probe")

# use a limited set for emission images
xrtsEI = [
    transition("C K-L3"),
    transition("Fe K-L3"),
    transition("Fe L3-M5"),
    transition("Ni K-L3"),
    transition("Ni L3-M5")
]

xrts = []

trs = mc3.suggestTransitions(nbsNiFe, e0)
for tr in trs:
    xrts.append(tr)

trs = mc3.suggestTransitions(Epon828, e0)
for tr in trs:
    xrts.append(tr)

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(xrtsEI, imgSzUm * 1.0e-6, imgSize))
xtraParams.update(mc3.configureTrajectoryImage(imgSzUm * 1.0e-6, imgSize))
xtraParams.update(mc3.configureVRML(nElectrons=vmrlEl))
Ejemplo n.º 20
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
                  "As2O3" : 0.0003145,
                  "ZrO2"  : 0.0002938,
                  "TiO2"  : 0.0002540
                 },
                 density=2.36,
                 name="Eagle XG")



layers = [ [c,   tCNm*1.0e-9],
           [eagleXG, 50.0e-6]
         ]

xrts = []

trs = mc3.suggestTransitions(eagleXG, e0)
for tr in trs:
    xrts.append(tr)

trs = mc3.suggestTransitions(c, e0)
for tr in trs:
    xrts.append(tr)



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))
Ejemplo n.º 22
0
    sim.rename(sName)
    sim.setAsStandard(mat)
    return sim

start = time.time()

DataManager.clearSpectrumList()

# define materials
b  = material("B", density = 2.37)
bn = material("BN", density = 2.1)
aln = material("AlN", density = 3.26)

xrts = []

trs = mc3.suggestTransitions(b, e0)
for tr in trs:
  xrts.append(tr)
trs = mc3.suggestTransitions(aln, e0)
for tr in trs:
  xrts.append(tr)

spc_b = simBulkStd(b, det, e0, nTraj, 100, 1.0, False)
spc_b.display()
spc_b.rename("B-5kV")
spc_b.setAsStandard(b)
fi = datDir + "/spc_b.msa"
print(fi)
if(bSaveSpc):
  spc_b.save(fi)
Ejemplo n.º 23
0
                    "C"  : 0.7440,
                    "O"  : 0.1855,
                    "Cl" : 0.0030},
                     1.16,
                    'Epon828')

det = findDetector("Probe")

# use a limited set for emission images
xrtsEI = [transition("C K-L3"),
          transition("Fe K-L3"), transition("Fe L3-M5"),
          transition("Ni K-L3"), transition("Ni L3-M5")]

xrts = []

trs = mc3.suggestTransitions(nbsNiFe, e0)
for tr in trs:
    xrts.append(tr)

trs = mc3.suggestTransitions(Epon828, e0)
for tr in trs:
    xrts.append(tr)

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(xrtsEI, 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))
Ejemplo n.º 24
0
   defaultNumTraj = 1000
if 'defaultDose' not in globals():
   defaultDose = 120.0


# start clean
DataManager.clearSpectrumList()


pet = epq.Material(epq.Composition([epq.Element.C,epq.Element.H,epq.Element.O],[0.62502,0.04196,0.069042]),epq.ToSI.gPerCC(1.37))
cu = epq.Material(epq.Composition([epq.Element.Cu],[1.0],"Cu"), epq.ToSI.gPerCC(8.96))
pd = epq.Material(epq.Composition([epq.Element.Pd],[1.0],"Pd"), epq.ToSI.gPerCC(11.9))
ag = epq.Material(epq.Composition([epq.Element.Ag],[1.0],"Ag"), epq.ToSI.gPerCC(10.5))

# define the desired transitions
xrts=mc3.suggestTransitions("COCuPdAg")
# print(xrts)
# set up the extra parameters
xtraParams={}
xtraParams.update(mc3.configureXRayAccumulators(xrts, charAccum=charF, charFluorAccum=charF, bremFluorAccum=bremF))
# note that the image size on the specimen is in meters...
xtraParams.update(mc3.configureEmissionImages(xrts, imgSzUm*1.0e-6, imgSize))
xtraParams.update(mc3.configurePhiRhoZ(imgSzUm*1.0e-6))
xtraParams.update(mc3.configureTrajectoryImage(imgSzUm*1.0e-6, imgSize))
xtraParams.update(mc3.configureVRML(nElectrons = vmrlEl))
xtraParams.update(mc3.configureOutput(simDir))

print(xtraParams)

spc = jm3.triLayerLineOnSubstrate(pd, cu, ag, pet, tNmPd*1.0e-9, tNmCu*1.0e-9, tNmAg*1.0e-9, wUm*1.0e-06, lUm*1.0e-06, det, title, e0=e0, withPoisson=True, nTraj=nTraj, dose=dose, sf=charF, bf=bremF, xtraParams=xtraParams)
display(spc)
Ejemplo n.º 25
0
srm1155 = jmg.create_material_from_mf(l_comps, l_mfs, 7.97, "SRM1155")

c = material("C", density=2.267)
mn = material("Mn", density=7.43)
p = material("P", density=1.88)
s = material("S", density=2.0)
si = material("Si", density=2.32)
cu = material("Cu", density=8.96)
mo = material("Mo", density=10.2)
co = material("Co", density=8.86)
pb = material("Pb", density=11.34)
fe = material("Fe", density=7.874)

xrts = []

trs = mc3.suggestTransitions(srm1155, e0)
for tr in trs:
    xrts.append(tr)

srm1155_spc = jm3.simBulkStd(srm1155, det, e0, nTraj, lt, pc, True)
srm1155_spc.setAsStandard(srm1155)
srm1155_spc.display()
srm1155_spc.save(srm1555_path)
"""

si_spc = jm3.simBulkStd(si, det, e0, nTraj, lt, pc, True)
si_spc.display()

caf2_spc = jm3.simBulkStd(caf2, det, e0, nTraj, lt, pc, True)
caf2_spc.display()
Ejemplo n.º 26
0
datDir = gitHomeDir + relPrj
print(gitHomeDir)
print(datDir)

start = time.time()

DataManager.clearSpectrumList()

# define materials
b = material("B", density=2.37)
bn = material("BN", density=2.1)
aln = material("AlN", density=3.26)

xrts = []

trs = mc3.suggestTransitions(bn, e0)
for tr in trs:
    xrts.append(tr)

# def simulateBulkStandard(mat, name, det, e0, lt, pc, withPoisson=True, nTraj=100, sf=True, bf=True, xtraParams={}):

spc_b = jm3.simBulkStd(b, det, e0, nTraj, 100, 1.0, False)
spc_b.display()
spc_b.rename("B-5kV")
spc_b.setAsStandard(b)
fi = datDir + "/spc_b.msa"
print(fi)
if (bSaveSpc):
    spc_b.save(fi)

spc_bn = jm3.simBulkStd(bn, det, e0, nTraj, 100, 1.0, False)
Ejemplo n.º 27
0
def fullSimBulkStd(mat, det, e0, nTraj, outPath, dim=5.0e-6, lt=100, pc=1.0, emiSize=512, ctd=False):
    """
    fullSimBulkStd(mat, 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.
    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.mcSimulate3 as mc3
    det = findDetector("Oxford p4 05eV 2K")
    cu = material("Cu", density=8.92)
    a = fullSimBulkStd(cu, det, 20.0, 100, 100, 1.0)
    a.display()

    """
    dose = pc * lt  # na-sec"
    xrts = []

    trs = mc3.suggestTransitions(mat, e0)
    for tr in trs:
        xrts.append(tr)
    mc3.configureEmissionImages(xrts, dim, emiSize)

    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, 5.0e-6, 512))
    xtraParams.update(mc3.configurePhiRhoZ(5.0e-6))
    xtraParams.update(mc3.configureTrajectoryImage(5.0e-6, 512))
    xtraParams.update(mc3.configureVRML(nElectrons=100))
    xtraParams.update(mc3.configureOutput(outPath))
    mc3.configureOutput(outPath)
    print("Output sent to %s") % (outPath)

    dose = lt*pc

    sim = mc3.simulate(mat, det, e0, dose, withPoisson=True, nTraj=nTraj,
                       sf=True, bf=True, xtraParams=xtraParams)

    sName = "%s-%g-kV" % (mat, e0)
    sim.rename(sName)
    sim.setAsStandard(mat)
    sim.display()
    fi =  outPath + "/"
    fi += sName
    fi += "-%g-Traj.msa" % (nTraj)
    print(fi)
    sim.save(fi)
    return(sim)
Ejemplo n.º 28
0
Monte Carlo simulate a spectrum from a block shaped particle of the specified material (mat) and height (z in m) and width (x and y in m). \
The block and subtrate is coated in a material 'coating' of the specified thickness which fully encapsulates the particle and covers the substrate too."""
   def buildBlock(monte, origin, buildParams):
      height = buildParams["Height"]
      width  = buildParams["Width"]
      subMat = buildParams["Substrate"]
      mat = buildParams["Material"]
      coating = buildParams["Coating"]
      thickness = buildParams["Thickness"]
      coatedCube = nm.MultiPlaneShape.createBlock([width+2.0*thickness, width+2.0*thickness, height+thickness], epu.Math2.plus(origin, [0.0, 0.0, 0.5 * (height+thickness)]), 0.0, 0.0, 0.0)
      sr1=monte.addSubRegion(monte.getChamber(), coating, coatedCube)
      cube = nm.MultiPlaneShape.createBlock([width, width, height], epu.Math2.plus(origin, [0.0, 0.0, thickness + 0.5 * height]), 0.0, 0.0, 0.0)
      monte.addSubRegion(sr1, mat, cube)
      monte.addSubRegion(monte.getChamber(), coating, nm.MultiPlaneShape.createFilm([0.0, 0.0, -1.0], epu.Math2.plus(origin, [0.0, 0.0, height+thickness]), thickness))
      monte.addSubRegion(monte.getChamber(), subMat, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], epu.Math2.plus(origin, [0.0, 0.0, height+2.0*thickness])))
   tmp = u"MC simulation of a [%0.2f,%0.2f,%0.2f] micron block of %s%s coated with %s at %0.1f keV%s%s" % (width * 1.0e6, width * 1.0e6, height * 1.0e6, mat, (" on %s" % substrate if substrate else ""), coating, e0, (" + CSF" if sf else ""), (" + BSF" if bf else ""))
   params = {"Substrate": substrate, "Width" : width, "Height" : height, "Material" : mat, "Coating" : coating, "Thickness" : thickness}
   return mc3.base(det, e0, withPoisson, nTraj, dose, sf, bf, tmp, buildBlock, params, xtraParams)

# Stuff you change....   
substrate = material("Fe",8.0)
coating = material("Cu",7.0)
block = material("Al",3.0)   
elements = "FeCuAl"  # List the elements in the substrate, coating and block...

xrts=mc3.suggestTransitions(elements)
xp = mc3.configureEmissionImages(xrts,2.0e-6,512)
# xp.update(mc3.configureXRayAccumulators(xrts,charAccum=True,charFluorAccum=True,bremFluorAccum=False))
xp.update(mc3.configureTrajectoryImage(2.0e-6,512))

display(coatedBlock(block,0.1e-6,0.2e-6,coating,0.05e-6,substrate,d1,e0=20.0, nTraj=1000, xtraParams=xp))
Ejemplo n.º 29
0
spcDir = gitDir + '/dtsa2Scripts/spc/sim-raft-on-zno-on-si'
jmg.ensureDir(spcDir)


DataManager.clearSpectrumList()
start = time.time()

# define materials
zno  = material("ZnO", density=5.61)
si   = material("Si", density=2.33)
raft = material("C17H35O5S2P1", density=2.0)
raft.setName("RAFT polymer")

# specify the x-ray transitions
xrts = []
trs = mc3.suggestTransitions(zno, e0)
for tr in trs:
    xrts.append(tr)
trs = mc3.suggestTransitions(si, e0)
for tr in trs:
    xrts.append(tr)
trs = mc3.suggestTransitions(raft, e0)
for tr in trs:
    xrts.append(tr)

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))
Ejemplo n.º 30
0
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
Ejemplo n.º 31
0
                        sf=True,
                        bf=True,
                        xtraParams={})
sName = "%g-nm-C-on-K497" % tNmC
k497Sim.rename(sName)
k497Sim.setAsStandard(k497)
k497Sim.display()
fi = spcDir + "/"
fi += sName
fi += "-%g-Traj.msa" % (nTraj)
k497Sim.save(fi)

# Al2O3 Sim
al2o3 = material("Al2O3", 3.95)
layers = [[c, 2.0e-9], [al2o3, 50.0e-6]]
xrts = mc3.suggestTransitions(al2o3)
al2o3Sim = mc3.multiFilm(layers,
                         det,
                         e0,
                         withPoisson=True,
                         nTraj=nTraj,
                         dose=dose,
                         sf=True,
                         bf=True,
                         xtraParams={})
sName = "%g-nm-C-on-Al2O3" % tNmC
al2o3Sim.rename(sName)
al2o3Sim.setAsStandard(al2o3)
al2o3Sim.display()
fi = spcDir + "/"
fi += sName
Ejemplo n.º 32
0
si = material("Si", density=2.329)
fe = material("Fe", density=7.86)
caf2 = material("CaF2", density=3.18)

# start with the 'unknown'

layers = [[c, tNmC * 1.0e-9], [k411, 50.0e-6]]

# multiFilm(layers, det, e0=20.0, withPoisson=True,
#           nTraj=defaultNumTraj, dose=defaultDose,
#           sf=defaultCharFluor, bf=defaultBremFluor,
#            xtraParams=defaultXtraParams)

xrts = []

trs = mc3.suggestTransitions(c, e0)
for tr in trs:
    xrts.append(tr)

trs = mc3.suggestTransitions(k411, e0)
for tr in trs:
    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))
Ejemplo n.º 33
0
# directories
gitDir = os.environ['GIT_HOME']
relPrj = "/dtsa2Scripts/utility"
prjDir = gitDir + relPrj
resDir = prjDir + '/sim-zno-on-si-4kV'
jmg.ensureDir(resDir)
rptDir = prjDir + '/sim-zno-on-si-4kV Results/'

DataManager.clearSpectrumList()
start = time.time()

zno = material("ZnO", density=5.61)
si = material("Si", density=2.33)

xrts = []
trs = mc3.suggestTransitions(zno, e0)
for tr in trs:
    xrts.append(tr)

xtraParams = {}
xtraParams.update(mc3.configureXRayAccumulators(xrts, True, True, True))
# xtraParams.update(mc3.configureOutput(simDir))
spc_zno_std = mc3.simulate(zno, det, e0, dose, True, nTraj, True, True,
                           xtraParams)
sName = "ZnO std-%g-kV" % (e0)
spc_zno_std.rename(sName)
spc_zno_std.setAsStandard(zno)
spc_zno_std.display()
fi = resDir + "/"
fi += sName
fi += "-%g-Traj.msa" % (nTraj)
Ejemplo n.º 34
0
os.chdir(wrkDir)
przDir = wrkDir + '/prz/'
# Save spectra in sim directory
jmg.ensureDir(przDir)
# jmg.ensureDir(rptDir)


det     = findDetector("Oxford p4 05eV 4K")
e0      = 7      # kV
nSteps  = e0*100 # steps
rho     = 2.6      # sec

l_comps = [epq.Element.Al,  epq.Element.Mg, epq.Element.P, epq.Element.O]
l_mfs   = [ 0.06470,        0.06650,        0.32900,       0.5390]
k496    = jmg.create_material_from_mf(l_comps, l_mfs,  2.6, "K-496")
xrts    = mc3.suggestTransitions(k496)
a       = jmg.compPhiRhoZ(k496, det, e0, nSteps, xrts,    alg=epq.PAP1991(), base="pap-prz", outdir=przDir)


# clean up cruft
# 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
    print msg
Ejemplo n.º 35
0
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
Ejemplo n.º 36
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, 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
Ejemplo n.º 37
0
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
Ejemplo n.º 38
0
DataManager.clearSpectrumList()

start = time.time()

sio2 = material("SiO2", density=2.196)
# sio  = material("SiO", density=2.13)

# Read standard
fi = spcDir + "/SiO2 std.msa"
spc_sio2_std = readSpectrum(fi)
spc_sio2_std.display()

lDoseUnk = [50, 100, 200, 500, 1000, 2500, 5000]
xrts = []

trs = mc3.suggestTransitions(sio2, e0)
for tr in trs:
    xrts.append(tr)

stds =  { element("O"): spc_sio2_std, element("Si"): spc_sio2_std }

qus = multiQuant(det, e0, stds, {})

for doseUnk in lDoseUnk:
    sName = "SiO Unk %g nA-sec.msa" % (doseUnk)
    fi = spcDir + "/" + sName
    spc_sio_unk = readSpectrum(fi)
    spc_sio_unk.display()
    res = qus.compute(spc_sio_unk)
    print(sName)
    print("Weight Fraction")
Ejemplo n.º 39
0
SRM482A = material("Au",rhoAu)
SRM482B = epq.Material(epq.Composition(map(element,["Au","Cu"],),[0.801,0.198],"Au80Cu20"),epq.ToSI.gPerCC(0.8*rhoAu+0.2*rhoCu))
SRM482C = epq.Material(epq.Composition(map(element,["Au","Cu"],),[0.603,0.396],"Au60Cu40"),epq.ToSI.gPerCC(0.6*rhoAu+0.4*rhoCu))
SRM482D = epq.Material(epq.Composition(map(element,["Au","Cu"],),[0.401,0.599],"Au40Cu60"),epq.ToSI.gPerCC(0.4*rhoAu+0.6*rhoCu))
SRM482E = epq.Material(epq.Composition(map(element,["Au","Cu"],),[0.201,0.798],"Au20Cu80"),epq.ToSI.gPerCC(0.2*rhoAu+0.8*rhoCu))
SRM482F = material("Cu",rhoCu)

SRM482 = ( SRM482A, SRM482B, SRM482C, SRM482D, SRM482E, SRM482F, )

range = electronRange(SRM482A,e0,density=None)

xtraP = {}
xtraP.update(mc3.configureOutput(DefaultOutput))
xtraP.update(mc3.configurePhiRhoZ(1.5*range))
xtraP.update(mc3.configureEmissionImages(mc3.suggestTransitions(SRM482C,e0), 1.5*range, size = 512))
xtraP.update(mc3.configureTrajectoryImage(1.5*range, size = 512))

specs = {}
for mat in SRM482:
   if terminated:
      break
   specs[mat] = mc3.simulate(mat, det,e0=e0, nTraj=nE, dose=500.0, sf=True, bf=True,xtraParams=xtraP)
   specs[mat].save("%s/%s.msa" % ( DefaultOutput, specs[mat] ))
   specs[mat].display()
   

unks = ( specs[SRM482B], specs[SRM482C], specs[SRM482D], specs[SRM482E] )
stds = { "Au" : specs[SRM482A], "Cu" : specs[SRM482F] }

res = {}
Ejemplo n.º 40
0
pyrDir = wd + "/sim-vert-layers Results"

det  = findDetector("Oxford p4 05eV 2K")
print(det)


# start clean
DataManager.clearSpectrumList()

pet = epq.Material(epq.Composition([epq.Element.C,epq.Element.H,epq.Element.O],[0.62502,0.04196,0.069042]),epq.ToSI.gPerCC(1.37))
cu = epq.Material(epq.Composition([epq.Element.Cu],[1.0],"Cu"), epq.ToSI.gPerCC(8.96))
pd = epq.Material(epq.Composition([epq.Element.Pd],[1.0],"Pd"), epq.ToSI.gPerCC(11.9))

# define the desired transitions
# xrts = [epq.XRayTransitionSet(epq.Element.Pd, epq.XRayTransitionSet.L_FAMILY), epq.XRayTransitionSet(epq.Element.Cu, epq.XRayTransitionSet.L_FAMILY)]
xrts=mc3.suggestTransitions("CuPd")
print(xrts)
for tr in xrts:
  print(tr.getSiegbahnName())
for tr in xrts:
  print(tr.getIUPACName())
# set up the extra parameters
xtraParams={}
xtraParams.update(mc3.configureXRayAccumulators(xrts, charAccum=charF, charFluorAccum=charF, bremFluorAccum=bremF))
# note that the image size on the specimen is in meters...
xtraParams.update(mc3.configureEmissionImages(xrts, imgSzUm*1.0e-6, imgSize))
xtraParams.update(mc3.configurePhiRhoZ(imgSzUm*1.0e-6))
xtraParams.update(mc3.configureTrajectoryImage(imgSzUm*1.0e-6, imgSize))
xtraParams.update(mc3.configureVRML(nElectrons = vmrlEl))
xtraParams.update(mc3.configureOutput(simDir))
Ejemplo n.º 41
0
dose = pc * lt  # na-sec"

# should not need to change below here

homDir = os.environ['HOME']
homDir = homDir.replace('\\','/')
wrkDir = homDir + "/Documents/git/dtsa2Scripts/utility"
outDir = homDir + "/Documents/git/dtsa2Scripts/html"
rptDir = wrkDir + '/testMC3AdmiraltyBrass Results/'
simDir = homDir + "/Documents/git/dtsa2Scripts/sim-Admiralty-Brass"
dt2c.ensureDir(simDir)

DataManager.clearSpectrumList()

xrts = []
trs = mc3.suggestTransitions(mix, e0)
for tr in trs:
	xrts.append(tr)

# print(xrts)

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))
Ejemplo n.º 42
0
        "Height": height,
        "Material": mat,
        "Coating": coating,
        "Thickness": thickness
    }
    return mc3.base(det, e0, withPoisson, nTraj, dose, sf, bf, tmp, buildBlock,
                    params, xtraParams)


# Stuff you change....
substrate = material("Fe", 8.0)
coating = material("Cu", 7.0)
block = material("Al", 3.0)
elements = "FeCuAl"  # List the elements in the substrate, coating and block...

xrts = mc3.suggestTransitions(elements)
xp = mc3.configureEmissionImages(xrts, 2.0e-6, 512)
# xp.update(mc3.configureXRayAccumulators(xrts,charAccum=True,charFluorAccum=True,bremFluorAccum=False))
xp.update(mc3.configureTrajectoryImage(2.0e-6, 512))

display(
    coatedBlock(block,
                0.1e-6,
                0.2e-6,
                coating,
                0.05e-6,
                substrate,
                d1,
                e0=20.0,
                nTraj=1000,
                xtraParams=xp))