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)

sim = mc3.simulate(mix, det, e0, dose, True,
                   nTraj, True, True, xtraParams)
fmtS = "Admiralty-Brass-at-%g-kV"
sName = fmtS % (e0)
sim.rename(sName)
sim.display()
fi =  simDir + "/"
fi += sName
fi += "-%g-Traj.msa" % (nTraj)
예제 #2
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)
예제 #3
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 = {}
예제 #4
0
al2o3.setName("Al2O3")
c = epq.Material(epq.Composition([epq.Element.C], [1.0]),
                 epq.ToSI.gPerCC(2.62))
c.setName("C")

xrts = [transition("Al K-L3"), transition("O K-L3"), transition("C K-L3")]

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, imgSizePx))
xtraParams.update(mc3.configurePhiRhoZ(imgSzUm * 1.0e-6))
xtraParams.update(mc3.configureTrajectoryImage(imgSzUm * 1.0e-6, imgSizePx))
xtraParams.update(mc3.configureVRML(nElectrons=vmrlEl))
xtraParams.update(mc3.configureOutput(simDir))

spc = mc3.sphere(al2o3,
                 radUm * 1.0e-6,
                 det,
                 e0,
                 withPoisson=True,
                 nTraj=nTraj,
                 dose=pc * lt,
                 sf=True,
                 bf=True,
                 substrate=c,
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))

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)
예제 #6
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)
예제 #7
0
print(trs)


# create samples consisting of silver film on steel (316H) substrate
film = {}
film[1] = [ag , 0.000000020],[s316H, 0.000010]		# 0.000005000 = 5 um 0.000010 = 10um	Configuring multi-layers composition and thickness
film[2] = [ag , 0.000000015],[s316H, 0.000010]		# 0.000000050 = 0.05 um
film[3] = [ag , 0.000000010],[s316H, 0.000010]

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
예제 #8
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)
예제 #9
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))
예제 #10
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))