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 minEdge(elm):
    """Example:  minEdge("Ag")
   Returns the lowest energy edge which is likely to be visible in an 
   EDS detector for the specified element"""
    elm = dtsa2.element(elm)
    if elm.getAtomicNumber() >= MinMElement:
        res = epq.AtomicShell(elm, epq.AtomicShell.MV)
    elif elm.getAtomicNumber() >= MinLElement:
        res = epq.AtomicShell(elm, epq.AtomicShell.LIII)
    else:
        res = epq.AtomicShell(elm, epq.AtomicShell.K)
    return res
Beispiel #3
0
def WDSCrystal(xrt, n=1, R=RolandCircleRadius):
    """Synatx: WDSCrystal(xrt,n=1,[R=RolandCircleRadius])
    Prints a list of the WDS crystals alternatives along with 
    the associated L-value.  (Note: xrt may be an element or 
    an XRayTransitionSet (see getTransitionSet(...))"""
    xrts = []
    if isinstance(xrt, epq.XRayTransition):
        xrts = xrts + [xrt]
    elif isinstance(xrt, str) or isinstance(xrt, epq.Element):
        elm = dtsa2.element(xrt)
        for tr in [epq.XRayTransition.KA1, epq.XRayTransition.LA1, epq.XRayTransition.MA1]:
            if epq.XRayTransition.exists(elm, tr):
                xrts = xrts + [epq.XRayTransition(elm, tr)]
    elif isinstance(xrt, epq.XRayTransitionSet):
        xrts = xrt.getTransitions()          
    else:
        print "Invalid argument: %s" % xrt
        return
    zippo = True
    for cry, twoD in TwoDSpacing.iteritems():
        for tr in xrts:
            L = WDS_L(cry, tr, n, R)
            if (L > 60) and (L < 260):
                if zippo:
                    print "Crystal\tLine\tL Value"
                    zippo = False
                print "%s\t%s\t%3.6g" % (cry, tr, L)
    if zippo:
        print "None"
def maxEdge(elm, e0, over=1.5):
    """Example:  maxEdge("Ag", 20.0, 1.5)
   Returns the highest energy edge which is excited with the overvoltage
   specified (1.5) for the specified beam energy (20.0)."""
    elm = dtsa2.element(elm)
    e0 = epq.ToSI.keV(e0)
    res = None
    if elm.getAtomicNumber() > MinMElement:
        sh = epq.AtomicShell.MV
        if epq.AtomicShell.getEdgeEnergy(elm, sh) * over <= e0:
            res = epq.AtomicShell(elm, sh)
    if elm.getAtomicNumber() > MinLElement:
        sh = epq.AtomicShell.LIII
        if epq.AtomicShell.getEdgeEnergy(elm, sh) * over <= e0:
            res = epq.AtomicShell(elm, sh)
    sh = epq.AtomicShell.K
    if epq.AtomicShell.getEdgeEnergy(elm, sh) * over <= e0:
        res = epq.AtomicShell(elm, sh)
    return res
Beispiel #5
0
def openRipple(rpl, e0, i0, liveTime, det):
    """openRipple(rpl, e0, i0, liveTime, det)
   Open a ripple file as an ISpectrumData object with setPosition(x,y) to permit navigating /
through the spectra."""
    sp = epq.SpectrumProperties()
    sp.setDetector(det)
    sp.setNumericProperty(epq.SpectrumProperties.BeamEnergy, e0)
    sp.setNumericProperty(epq.SpectrumProperties.FaradayBegin, i0)
    sp.setNumericProperty(epq.SpectrumProperties.LiveTime, liveTime)
    return ept.RippleSpectrum(rpl, sp)
Beispiel #6
0
def maxPixel(rpl):
    """maxPixel(rpl)
   Computes the max pixel spectrum for the specified ripple/raw spectrum object."""
    xs = epq.ExtremumSpectrum()
    for r in xrange(0, rpl.getRows()):
        dt2.StdOut.append(".")
        if dt2.terminated:
            break
        for c in xrange(0, rpl.getColumns()):
            rpl.setPosition(r, c)
            xs.include(rpl)
    return xs
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)
Beispiel #8
0
def suggestTransitionSets(mat, e0=20.0):
   """suggestTransitions(mat, e0=20.0)
   Suggest a list of XRayTransitionSet objects for the specified material."""
   mat = dtsa2.material(mat)
   fams = ("Ka", "Kb", "La", "Lb", "Ma", "Mb")   
   res = []
   for elm in mat.getElementSet():
      for fam in fams:
         xrts = dtsa2.getTransitionSet(elm, fam)
         removeMe = epq.XRayTransitionSet()
         if (xrts.size() > 0):
            for xrt in xrts:
               ee = epq.FromSI.keV(xrt.getEnergy())
               if (ee < 0.2) or (ee > 0.95 * e0):
                  removeMe.add(xrt)
            if removeMe.size() > 0:
               xrts.removeAll(removeMe)
            if xrts.size() > 0:
               res.append(xrts)
   return res
Beispiel #9
0
def rippleToMaps(rpl, vecSet, step=1):
    """RippleToMaps(rpl, vecSet, step=1)
    Applies a vector set to a RPL/RAW file pair producing a dictionary of MapImage objects /
indexed by RegionOfInterest objects."""
    width = rpl.getColumns()
    height = rpl.getRows()
    vecs = vecSet.getVectors()
    planes = epq.MapImage(width, height, len(vecs), str(vecSet))
    rpl.setSpan(step, step)
    for r in xrange(0, height, step):
        if dt2.isTerminated():
            break
        for c in xrange(0, width, step):
            if dt2.isTerminated():
                break
            rpl.setPosition(r, c)
            krs = vecSet.getKRatios(rpl)
            kra = []
            for vec in vecs:
                kra.append(krs.getKRatio(vec.getROI()))
            planes.inc(c, r, kra)
    return planes
Beispiel #10
0
def createGas(comp, pascal):
    """createGas(comp, pascal)
    Create a gas from a composition at the specified pressure in Pascal at 300 K.
    Ex: createGas("H2O", 0.1)"""
    return epq.Gas(dtsa2.material(comp), pascal, 300.0)
Beispiel #11
0
lT = []  # will have t=0...
lPICmu = []  # an array for mean C peak integral
lPICuc = []  # an array for C peak integral uncertainty
lPISimu = []  # an array for mean Cu peak integral
lPISiuc = []  # an array for Cu peak integral uncertainty

# empty xtra-param
xp = {}

# empty x-ray transition set
xrts = []
# set a counter
iCount = 0

# get and add the C-K family
cTS = epq.XRayTransitionSet(epq.Element.C, epq.XRayTransitionSet.K_FAMILY)
cTrs = cTS.getTransitions()
for tr in cTrs:
    xrts.append(tr)

# get and add the Cu-L family
siTS = epq.XRayTransitionSet(epq.Element.Si, epq.XRayTransitionSet.K_FAMILY)
siTrs = siTS.getTransitions()
for tr in siTrs:
    xrts.append(tr)

xp.update(
    mc3.configureXRayAccumulators(xrts,
                                  charAccum=True,
                                  charFluorAccum=True,
                                  bremFluorAccum=True))
Beispiel #12
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,
   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))
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")
Beispiel #15
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)
Beispiel #16
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
Beispiel #17
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)
Beispiel #18
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):
Beispiel #19
0
    sim.getProperties().setTextProperty(epq.SpectrumProperties.SpectrumComment,
                                        amcThickComment)
    return sim


start = time.time()

DataManager.clearSpectrumList()

c = material("C", density=2.266)
fe = material("Fe", density=7.86)
fe3c = material("Fe3C", density=4.93)

# only get FeL at 7 kV
trs = [
    epq.XRayTransitionSet(epq.Element.C, epq.XRayTransitionSet.K_FAMILY),
    epq.XRayTransitionSet(epq.Element.Fe, epq.XRayTransitionSet.L_FAMILY)
]

# First simulate the standards
# Start with C
startCycle = time.time()
c_std_spc = jm3.simBulkStd(c, det, e0, nTraj, lt=lt, pc=pc)
display(c_std_spc)
sName = "%s-std-%g-kV-%g-traj" % ("C", e0, nTraj)
fi = basePath + "/"
fi += sName
fi += ".msa"
if bSaveSpc == True:
    c_std_spc.save(fi)
endCycle = time.time()
Beispiel #20
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 = [
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))
Beispiel #22
0
charF = True  # include characteristic fluorescence
bremF = True  # include continuum fluorescence cd ..
pc = 2.5  # nA
lt = 100.0  # sec
e0 = 3.0  # keV

dose = pc * lt  # nA sec
# start clean
DataManager.clearSpectrumList()

# create the materials
si = material("Si", density=2.32)
sic = material("SiC", density=3.21)

trs = [
    epq.XRayTransitionSet(epq.Element.C, epq.XRayTransitionSet.K_ALPHA),
    epq.XRayTransitionSet(epq.Element.O, epq.XRayTransitionSet.K_ALPHA),
    epq.XRayTransitionSet(epq.Element.Si, epq.XRayTransitionSet.K_ALPHA)
]

# start with bulk standards
#
# C

siSpc = mc3.simulate(si,
                     det,
                     e0=e0,
                     dose=dose,
                     withPoisson=True,
                     nTraj=nTraj,
                     sf=charF,
for name in glob.glob(spcDir + '/*.msa'):
    name = name.replace('\\', '/')
    bn = os.path.basename(name)
    x = bn.split('-')
    sDate = "%s-%s-%s" % (x[0], x[1], x[2])
    lDate.append(sDate)
    spc = wrap(readSpectrum(name))
    sp = spc.getProperties()
    pc = sp.getNumericProperty(epq.SpectrumProperties.FaradayBegin)
    lt = sp.getNumericProperty(epq.SpectrumProperties.LiveTime)
    sp.setDetector(det)
    spc.rename(sDate)
    if bDisplayAll:
        display(spc)
    comp = epq.Composition(epq.Element.Cu)
    sf = epq.SpectrumFitter8(det, comp, spc)
    rois = sf.getROIS()
    props = sp.getDetector().getCalibration().getProperties()
    offset = props.getNumericWithDefault(epq.SpectrumProperties.EnergyOffset,
                                         0.0)
    gain = props.getNumericWithDefault(epq.SpectrumProperties.EnergyScale,
                                       10.0)
    coeffs = [offset, gain]
    sf.setEnergyScale(epq.SpectrumFitter8.EnergyScaleFunction(coeffs, 2))
    sf.setResolution(epq.SpectrumFitter8.FanoNoiseWidth(6.0))
    sf.setMultiLineset(sf.buildWeighted(rois))
    results = sf.compute()
    # sf.setEnergyScale(epq.SpectrumFitter8.AltEnergyScaleFunction(coeffs))
    # print(dir(results))
    # ['FWHMatMnKa', '__class__', '__copy__', '__deepcopy__', '__delattr__',
Beispiel #24
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)
Beispiel #25
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))
Beispiel #26
0
def createMonatomicGas(elm, pascal):
    """createMonatomicGas(elm, pascal)
    Create a gas of single atoms of the specified element at the specified pressure in Pascal and 300 K"""
    return epq.Gas((elm,), (1,), pascal, 300.0, elm.toString() + " gas at %f Pa" % pascal)
Beispiel #27
0
nTraj = 100  # 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 = 15.0  # keV

dose = pc * lt  # nA sec
# start clean
DataManager.clearSpectrumList()

# create the materials
ag = material("Ag", density=10.5)

trs = [
    epq.XRayTransitionSet(epq.Element.Au, epq.XRayTransitionSet.L_ALPHA),
    epq.XRayTransitionSet(epq.Element.Cu, epq.XRayTransitionSet.K_ALPHA)
]

# start with bulk standards
#
# Au

auSpc = mc3.simulate(au,
                     det,
                     e0=e0,
                     dose=dose,
                     withPoisson=True,
                     nTraj=nTraj,
                     sf=charF,
                     bf=bremF,
Beispiel #28
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.
Beispiel #29
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)
Beispiel #30
0
    nm3.EmissionImageBase.useHeatMapPalette()

def configureVoxelated(dim=20, size=2.e-6, generated=True):
    return { 'Voxelated' : dim, 'GeneratedV' : generated, 'SizeV' : size }

def configureVRML(nElectrons=40):
    return { 'VRML' :  nElectrons }

def toPascal(torr):
    return torr * 133.32237

def toTorr(pascal):
    return pascal / 133.32237

if 'defaultGas' not in globals():
    defaultGas = epq.Gas((epq.Element.H, epq.Element.O,), (2, 1,), toPascal(0.1), 300.0, "Water vapor")

def createMonatomicGas(elm, pascal):
    """createMonatomicGas(elm, pascal)
    Create a gas of single atoms of the specified element at the specified pressure in Pascal and 300 K"""
    return epq.Gas((elm,), (1,), pascal, 300.0, elm.toString() + " gas at %f Pa" % pascal)

def createGas(comp, pascal):
    """createGas(comp, pascal)
    Create a gas from a composition at the specified pressure in Pascal at 300 K.
    Ex: createGas("H2O", 0.1)"""
    return epq.Gas(dtsa2.material(comp), pascal, 300.0)

def configureVariablePressure(pathLength, gas=defaultGas):
    return { 'VP' : (pathLength, gas) }