def defineMat(elms, qty, name, density=None):
    # Note: epq.Composition is designed to work with **mass fractions**
    # Note: epq.Composition(Element[] elms, double[] massFracs)
    c = epq.Composition(map(element, elms), qty, name)
    if density:
        c = epq.Material(c, epq.ToSI.gPerCC(density))
    return (c)
def create_material_from_mf(l_comp, l_mf, density, name):
    """
    create_material_from_mf(l_comp, l_mf, density, name)

    Create a material from lists of compositions and mass fractions
    and the density and a name.

    Input
    -----
    l_comp  A list of compositions.

    l_mf    A list of mass fractions.

    density A number. The density in g/cm3

    name    A string. The name for the material. Use letters and numbers
            without spaces or + or -. Simple mnemonics are better.

    Return
    ------
    A material

    Example
    -------
    # Note: composition came from J. Donovan:  Std 160 NBS K-412 mineral glass
    l_comps = [epq.Element.O,  epq.Element.Si, epq.Element.Mg, epq.Element.Ca,
               epq.Element.Fe, epq.Element.Al, epq.Element.Mn, epq.Element.Na]
    l_mfs   = [0.43597 ,0.21199 ,0.11657 ,0.10899,
               0.07742, 0.04906, 0.00077, 0.00043]
    mat = create_material_from_mf(l_comps, l_mfs, 2.66, "K412")
    print(mat)
    print(mat.toHTMLTable())
    """
    comp = epq.Composition(l_comp, l_mf)
    mat = epq.Material(comp, epq.ToSI.gPerCC(density))
    mat.setName(name)
    return(mat)
Пример #3
0
nTraj = 10000  # trajectories
lt = 60  # sec
pc = 0.25  # nA
tNmTa = 2
tNmC = 10
tNmAuPd = 10
tNmSiO2 = 100

dose = pc * lt  # na-sec"

DataManager.clearSpectrumList()

sio2 = material("SiO2", density=2.65)
c = material("C", density=2.1)
aupd = epq.Material(
    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,
Пример #4
0
   defaultXtraParams = {}
if 'defaultBremFluor' not in globals():
   defaultBremFluor = False
if 'defaultCharFluor' not in globals():
   defaultCharFluor = False
if 'defaultNumTraj' not in globals():
   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))
Пример #5
0
nTraj = 250  # num Traj to run per pt 10000 for a long run
charF = True  # include characteristic fluorescence
bremF = True  # include continuum fluorescence
pc = 2.5  # nA
lt = 100.0  # sec
e0 = 7.0  # keV
imgSize = 512  # pixel size for images
imgSzUm = 5.0  # image size in microns
vmrlEl = 40  # number of el for VMRL
dose = pc * lt  # nA sec

gitDir = os.environ['GIT_HOME']
relPrj = "/dtsa2Scripts/"
simDir = gitDir + relPrj + "/"
jmg.ensureDir(simDir)

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

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

# start clean
DataManager.clearSpectrumList()

al2o3 = epq.Material(
    epq.Composition([epq.Element.Al, epq.Element.O], [0.5293, 0.4707]),
    epq.ToSI.gPerCC(3.95))
al = epq.Material(epq.Composition([epq.Element.Al], [1.0], "Al"),
                  epq.ToSI.gPerCC(2.7))
Пример #6
0
jmg.ensureDir(datDir)
jmg.ensureDir(csvDir)
jmg.ensureDir(simDir)
jmg.ensureDir(msaDir)

wd = gitDir + relPrj
os.chdir(wd)
pyrDir = wd + "/simCoatedOverBlock Results"

det = findDetector("Oxford p4 05eV 2K")
# det  = findDetector("Si(Li)") # test with default
print(det)

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 (most intense for each line...)
#                     Ka1                  Ka1                   Ka1                      La1
xrts = [
Пример #7
0
                     sf=charF,
                     bf=bremF,
                     xtraParams={})
sp = siSpc.getProperties()
sp.setTextProperty(epq.SpectrumProperties.SpectrumDisplayName, "Si-std")
sp.setNumericProperty(epq.SpectrumProperties.LiveTime, lt)
sp.setNumericProperty(epq.SpectrumProperties.FaradayBegin, dose)
sp.setNumericProperty(epq.SpectrumProperties.FaradayEnd, dose)
sp.setNumericProperty(epq.SpectrumProperties.BeamEnergy, e0)
sp.setCompositionProperty(epq.SpectrumProperties.StandardComposition,
                          epq.Composition(epq.Element.Si))
display(siSpc)
siStd = {"El": element("Si"), "Spc": siSpc}

sic = epq.Material(
    epq.Composition([epq.Element.Si, epq.Element.C], [0.70045, 0.29955]),
    epq.ToSI.gPerCC(3.21))
sic.setName("SiC")

sicSpc = mc3.simulate(sic, det, e0, dose, True, nTraj, True, True, {})
sp = sicSpc.getProperties()
sp.setTextProperty(epq.SpectrumProperties.SpectrumDisplayName, "SiC-std")
sp.setNumericProperty(epq.SpectrumProperties.LiveTime, lt)
sp.setNumericProperty(epq.SpectrumProperties.FaradayBegin, dose)
sp.setNumericProperty(epq.SpectrumProperties.FaradayEnd, dose)
sp.setNumericProperty(epq.SpectrumProperties.BeamEnergy, e0)
sp.setCompositionProperty(epq.SpectrumProperties.StandardComposition, sic)
display(sicSpc)
# sicStd  = {"El":e,  "Spc":siSpc}
"""
Пример #8
0
import gov.nist.microanalysis.EPQLibrary as epq

# Density from Probe Software, compo from NIST spectrum
k412 = epq.Material(epq.Composition([epq.Element.O,
                                     epq.Element.Mg,
                                     epq.Element.Al,
                                     epq.Element.Si,
                                     epq.Element.Ca,                                    
                                     epq.Element.Fe],
                                    [ 0.4276,
                                      0.1166,
                                      0.0491,
                                      0.2120,
                                      0.1090,
                                      0.0774]
                                      ),
                                    epq.ToSI.gPerCC(2.600))
k412.setName("K412")

Пример #9
0
XRAY:      ka      ka      ka      ka      ka      ka      ka 
ELWT:   36.020   2.230  11.550  18.400   1.510  10.510  19.790
KFAC:    .1934   .0132   .0797   .1364   .0145   .0915   .1743
ZCOR:   1.8621  1.6868  1.4499  1.3489  1.0384  1.1485  1.1353
AT% :   56.147   2.288  10.676  16.339    .940   4.771   8.838

"""


garnet = epq.Material(epq.Composition([epq.Element.O,
                                    epq.Element.Mg,
                                    epq.Element.Al,
                                    epq.Element.Si,
                                    epq.Element.Ca,
                                    epq.Element.Mn,
                                    epq.Element.Fe],
                                    [ 0.3602,
                                      0.0223,
                                      0.1155,
                                      0.1840,
                                      0.0151,
                                      0.1051,
                                      0.1979]), epq.ToSI.gPerCC(3.56))
garnet.setName("garnet")

trs = majorTransitions(garnet, e0, trs=(epq.XRayTransition.KA1, epq.XRayTransition.KB1, epq.XRayTransition.LA1, epq.XRayTransition.MA1), thresh=1.0)


garnetSpc = mc3.simulate(garnet, det, e0=e0, dose=dose, withPoisson=True, nTraj=nTraj, sf=charF, bf=bremF, xtraParams={})
sp=garnetSpc.getProperties()
sp.setTextProperty(epq.SpectrumProperties.SpectrumDisplayName,"garent-std")
sp.setNumericProperty(epq.SpectrumProperties.LiveTime, lt)
Пример #10
0
lt = 100  # sec
pc = 1.0  # nA
tNmC = 20  # nm C
przDepUm = 2.0  # depth for phi-rho-z images in microns
imgSzUm = 2.0  # size for emission images in microns
imgSize = 512  # pixel size for images
vmrlEl = 40  # number of el for VMRL
resln = 1.0  # factor for phirhoz resln

dose = pc * lt  # na-sec"

DataManager.clearSpectrumList()

apatite = epq.Material(
    epq.Composition([
        epq.Element.O, epq.Element.Ca, epq.Element.P, epq.Element.F,
        epq.Element.Sr
    ], [0.39368, 0.38936, 0.17863, 0.03700, 0.00133]), epq.ToSI.gPerCC(3.15))
apatite.setName("apatite")

k411 = epq.Material(
    epq.Composition([
        epq.Element.O, epq.Element.Si, epq.Element.Fe, epq.Element.Ca,
        epq.Element.Mg
    ], [0.435581, 0.25382, 0.11209, 0.11057, 0.08847]), epq.ToSI.gPerCC(2.6))
k411.setName("K411")

mgo = material("MgO", density=3.58)
c = material("C", density=2.1)
si = material("Si", density=2.329)
fe = material("Fe", density=7.86)
Пример #11
0
pyrDir = datDir + "/makeFastTestCube Results"

e0 = 20.0
pc = 1.0
lt = 30.0
det = findDetector("Oxford p4 05eV 2K")
cw = det.getChannelWidth()
dp = det.getProperties()
resn = dp.getNumericProperty(epq.SpectrumProperties.Resolution)

rplFil = datDir + "/CuAl.rpl"
rawFil = datDir + "/CuAl.raw"

DataManager.clearSpectrumList()
# make the materials
cu = epq.Material(epq.Composition([epq.Element.Cu], [1.0]),
                  epq.ToSI.gPerCC(8.096))
cuSpc = simulate(cu, det, keV=e0, dose=lt * pc, withPoisson=True)
cuSpc.rename("ana sim Cu")
al = epq.Material(epq.Composition([epq.Element.Al], [1.0]),
                  epq.ToSI.gPerCC(2.70))
alSpc = simulate(al, det, keV=e0, dose=lt * pc, withPoisson=True)
alSpc.rename("ana sim Al")

# display(cuSpc)
# display(alSpc)

res = et.RippleFile(64, 64, 2048, et.RippleFile.UNSIGNED, 4,
                    et.RippleFile.BIG_ENDIAN, rplFil, rawFil)
for x in range(-32, 32, 1):
    print "Working on row %d" % (x)
    for y in range(-32, 32, 1):
Пример #12
0
relPrj  = "/dtsa2Scripts/utility"
prjDir  = gitDir + relPrj
rptDir  = prjDir + '/testAlgorithms Results/'


e0 = 15 # kV

# Define the material k412
# Density from Probe Software, compo from NIST spectrum
k412 = epq.Material(epq.Composition([epq.Element.O,
                                     epq.Element.Mg,
                                     epq.Element.Al,
                                     epq.Element.Ca,
                                     epq.Element.Si,
                                     epq.Element.Fe],
                                    [ 0.427580,
                                      0.116567,
                                      0.049062,
                                      0.211982,
                                      0.108990,
                                      0.077420]
                                      ),
                                    epq.ToSI.gPerCC(2.600))
k412.setName("K412")

au = epq.Material(epq.Composition([epq.Element.Au], [1.0]), epq.ToSI.gPerCC(19.30))
au.setName("Au")

def ComputeElectronRange(mat, e0):
    """ComputeElectronRange(mat, e0)
    Compute the electron range for a material using two
    algorithms.
Пример #13
0
simDir = gitDir + relPrj + "/"
ensureDir(simDir)
ensureDir(datDir)

wd = gitDir + relPrj + "/py"
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))
Пример #14
0
def defineMat(elms, qty, name, density=None):
    c = epq.Composition(map(element, elms), qty, name)
    if density:
        c = epq.Material(c, epq.ToSI.gPerCC(density))
    return (c)
Пример #15
0
eagleXG = epq.Material(epq.Composition([epq.Element.O,
                                        epq.Element.Si,
                                        epq.Element.Al,
                                        epq.Element.Ca,
                                        epq.Element.B,
                                        epq.Element.Mg,
                                        epq.Element.Sr,
                                        epq.Element.Sn,
                                        epq.Element.Ba,
                                        epq.Element.As,
                                        epq.Element.Sb,
                                        epq.Element.Fe,
                                        epq.Element.Zr,
                                        epq.Element.Ti],
                                        [0.518777,
                                         0.301391,
                                         0.090081,
                                         0.038763,
                                         0.032655,
                                         0.007728,
                                         0.006965,
                                         0.001198,
                                         0.001092,
                                         0.000238,
                                         0.000387,
                                         0.000355,
                                         0.000218,
                                         0.000152]),
                      epq.ToSI.gPerCC(2.38))
eagleXG.setName("EagleXG")
Пример #16
0
pc       =   1.5 # nA
lt       = 100.  # sec
dose     = lt*pc # nA*sec
imgSize =  512   # pixel size for images
imgSzUm  = 0.25
charF    = True  # include characteristic fluorescence
bremF    = True  # include continuum fluorescence 
poisN    = True  # include Poisson noise
vmrlEl   =  100  # number of el for VMRL

sc = 1.0e-06 # um to meters
umLine = nmLinWid * 1.0e-03

linMat = "Pd"
blkMat = "Cu"
lin = epq.Material(epq.Composition([epq.Element.Pd],[1.0],"Pd"), epq.ToSI.gPerCC(12.023))
blk = epq.Material(epq.Composition([epq.Element.Cu],[1.0],"Cu"), epq.ToSI.gPerCC(8.96))


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

homDir = os.environ['HOME']
relPrj = "/work/proj/QM15-04-07A-Ciminelli"
simDir = homDir + relPrj + "/dat/simDir"
csvDir = homDir + relPrj + "/dat/csv"
jmg.ensureDir(simDir)
jmg.ensureDir(csvDir)
# wd = homDir + relPrj + "/py/dtsa"
wd = homDir + relPrj + "/py/dtsa"
os.chdir(wd)
Пример #17
0
# strName = "AF1600"
# strCmpd = "C395O130F660"
#
# PTFE
# elements = [epq.Element.C, epq.Element.F]
# strName = "PTFE"
# strCmpd = "C2F4"

# elements = [epq.Element.Cu, epq.Element.O]
# strName = "Cu(OH)2"
# strCmpd = "Cu(OH)2"

# massFra = jmg.getMassFractions(strCmpd, elements, 5)

kapton = epq.Material(
    epq.Composition(
        [epq.Element.C, epq.Element.O, epq.Element.N, epq.Element.H],
        [0.69113, 0.20924, 0.07327, 0.02636]), epq.ToSI.gPerCC(1.420))
kapton.setName("Kapton")

# from Wikepedia from Corning and Schott
pyrex = epq.Material(
    epq.Composition([
        epq.Element.B, epq.Element.O, epq.Element.Na, epq.Element.Mg,
        epq.Element.Al, epq.Element.Si, epq.Element.Cl, epq.Element.Ca,
        epq.Element.Fe
    ], [
        0.03920, 0.53850, 0.03120, 0.00030, 0.01170, 0.37720, 0.00100, 0.00070,
        0.00030
    ]), epq.ToSI.gPerCC(2.30))

pyrex.setName("Pyrex")