Esempio n. 1
0
def get_linewidth(z, linetype):
    _e, _b = '', ''
    if 'K' == linetype[0]:
        _e = xrl.K_SHELL
        if len(linetype[1:]) == 3:
            _b = xrl.__getattribute__('%s_SHELL' % (linetype[1:-1]))
        else:
            _b = xrl.__getattribute__('%s_SHELL' % (linetype[1:]))
    else:
        _e = xrl.__getattribute__('%s_SHELL' % (linetype[:2]))
        if len(linetype[2:]) == 3:
            _b = xrl.__getattribute__('%s_SHELL' % (linetype[2:-1]))
        else:
            _b = xrl.__getattribute__('%s_SHELL' % (linetype[2:]))
    try:
        we = xrl.AtomicLevelWidth(z, _e)
    except:
        we = 0.0
    try:
        wb = xrl.AtomicLevelWidth(z, _b)
    except:
        wb = 0.0
    width = we + wb
    if width > 0.: return width  # keV
    elif width == 0.: return 0.001 / 1e3  # keV
    else: return 0.
Esempio n. 2
0
def get_data():
    sym, z, group, period, _type = ([], [], [], [], [])
    mass, density, absedge, alw, flyield, augyield = ([], [], [], [], [], [])
    for i in range(1, 104):
        s = xraylib.AtomicNumberToSymbol(i)
        sym.append(s)
        z.append(i)
        mass.append(xraylib.AtomicWeight(i))
        density.append(str(xraylib.ElementDensity(i)) + ' g/cm^3')

        absedge.append(str(xraylib.EdgeEnergy(i, 0)) + ' keV')
        alw.append(str(xraylib.AtomicLevelWidth(i, 0)) + ' keV')
        flyield.append(str(xraylib.FluorYield(i, 0)))
        augyield.append(str(xraylib.AugerYield(i, 0)))

        pop_period(i, period)
        pop_group(i, group)
        pop_type(i, _type)

    data = {
        'sym': sym,
        'z': z,
        'mass': mass,
        'group': group,
        'period': period,
        '_type': _type,
        'density': density,
        'flyield': flyield,
        'augyield': augyield,
        'absedge': absedge,
        'alw': alw
    }
    return data
Esempio n. 3
0
 def test_U_N7(self):
     width = xraylib.AtomicLevelWidth(92, xraylib.N7_SHELL)
     self.assertAlmostEqual(width, 0.31E-3)
Esempio n. 4
0
 def test_Fe_K(self):
     width = xraylib.AtomicLevelWidth(26, xraylib.K_SHELL)
     self.assertAlmostEqual(width, 1.19E-3)
Esempio n. 5
0
 def test_invalid_shell(self):
     with self.assertRaises(ValueError):
         width = xraylib.AtomicLevelWidth(26, xraylib.N3_SHELL)
Esempio n. 6
0
 def test_bad_shell(self):
     with self.assertRaises(ValueError):
         width = xraylib.AtomicLevelWidth(26, -5)
Esempio n. 7
0
 def test_bad_Z(self):
     with self.assertRaises(ValueError):
         width = xraylib.AtomicLevelWidth(185, xraylib.K_SHELL)
Esempio n. 8
0
print("Compton profile for Fe at pz = 1.1 : {}".format(
    xraylib.ComptonProfile(26, 1.1)))
print("M5 Compton profile for Fe at pz = 1.1 : {}".format(
    xraylib.ComptonProfile_Partial(26, xraylib.M5_SHELL, 1.1)))
print("M1->M5 Coster-Kronig transition probability for Au : {}".format(
    xraylib.CosKronTransProb(79, xraylib.FM15_TRANS)))
print("L1->L3 Coster-Kronig transition probability for Fe : {}".format(
    xraylib.CosKronTransProb(26, xraylib.FL13_TRANS)))
print("Au Ma1 XRF production cs at 10.0 keV (Kissel): {}".format(
    xraylib.CS_FluorLine_Kissel(79, xraylib.MA1_LINE, 10.0)))
print("Au Mb XRF production cs at 10.0 keV (Kissel): {}".format(
    xraylib.CS_FluorLine_Kissel(79, xraylib.MB_LINE, 10.0)))
print("Au Mg XRF production cs at 10.0 keV (Kissel): {}".format(
    xraylib.CS_FluorLine_Kissel(79, xraylib.MG_LINE, 10.0)))
print("K atomic level width for Fe: {}".format(
    xraylib.AtomicLevelWidth(26, xraylib.K_SHELL)))
print("Bi L2-M5M5 Auger non-radiative rate: {}".format(
    xraylib.AugerRate(86, xraylib.L2_M5M5_AUGER)))
print("Bi L3 Auger yield: {}".format(xraylib.AugerYield(86, xraylib.L3_SHELL)))
symbol = xraylib.AtomicNumberToSymbol(26)
print("Symbol of element 26 is: {}".format(symbol))
print("Number of element Fe is: {}".format(xraylib.SymbolToAtomicNumber("Fe")))
Z = np.array([26])
symbol = xraylib.AtomicNumberToSymbol(Z[0])
print("Symbol of element 26 is: {}".format(symbol))
print("Pb Malpha XRF production cs at 20.0 keV with cascade effect: {}".format(
    xraylib.CS_FluorLine_Kissel(82, xraylib.MA1_LINE, 20.0)))
print(
    "Pb Malpha XRF production cs at 20.0 keV with radiative cascade effect: {}"
    .format(
        xraylib.CS_FluorLine_Kissel_Radiative_Cascade(82, xraylib.MA1_LINE,
Esempio n. 9
0
	print ("SiO2 contains %g atoms and %i elements"% (cdtest['nAtomsAll'], cdtest['nElements']))
	for i in range(cdtest['nElements']):
        	print ("Element %i: %lf %%" % (cdtest['Elements'][i],cdtest['massFractions'][i]*100.0))
		

	print ("CS2 Refractive Index at 10.0 keV : %g - %g i" % (xraylib.Refractive_Index_Re("CS2",10.0,1.261),xraylib.Refractive_Index_Im("CS2",10.0,1.261)))
	print ("C16H14O3 Refractive Index at 1 keV : %g - %g i" % (xraylib.Refractive_Index_Re("C16H14O3",1.0,1.2),xraylib.Refractive_Index_Im("C16H14O3",1.0,1.2)))
	print ("SiO2 Refractive Index at 5 keV : %g - %g i" % (xraylib.Refractive_Index_Re("SiO2",5.0,2.65),xraylib.Refractive_Index_Im("SiO2",5.0,2.65)))
	print ("Compton profile for Fe at pz = 1.1 : %g" % xraylib.ComptonProfile(26,1.1))
	print ("M5 Compton profile for Fe at pz = 1.1 : %g" % xraylib.ComptonProfile_Partial(26,xraylib.M5_SHELL,1.1))
	print ("M1->M5 Coster-Kronig transition probability for Au : %f" % xraylib.CosKronTransProb(79,xraylib.FM15_TRANS))
	print ("L1->L3 Coster-Kronig transition probability for Fe : %f" % xraylib.CosKronTransProb(26,xraylib.FL13_TRANS))
	print ("Au Ma1 XRF production cs at 10.0 keV (Kissel): %f" % xraylib.CS_FluorLine_Kissel(79,xraylib.MA1_LINE,10.0))
	print ("Au Mb XRF production cs at 10.0 keV (Kissel): %f" % xraylib.CS_FluorLine_Kissel(79,xraylib.MB_LINE,10.0))
	print ("Au Mg XRF production cs at 10.0 keV (Kissel): %f" % xraylib.CS_FluorLine_Kissel(79,xraylib.MG_LINE,10.0))
	print ("K atomic level width for Fe: %g" % xraylib.AtomicLevelWidth(26,xraylib.K_SHELL))
	print ("Bi L2-M5M5 Auger non-radiative rate: %g" % xraylib.AugerRate(86,xraylib.L2_M5M5_AUGER))
	print ("Bi L3 Auger yield: %g" % xraylib.AugerYield(86, xraylib.L3_SHELL))
	symbol = xraylib.AtomicNumberToSymbol(26)
	print ("Symbol of element 26 is: %s" % symbol)
	print ("Number of element Fe is: %i" % xraylib.SymbolToAtomicNumber("Fe"))
	print ("Pb Malpha XRF production cs at 20.0 keV with cascade effect: %g" % xraylib.CS_FluorLine_Kissel(82,xraylib.MA1_LINE,20.0))
	print ("Pb Malpha XRF production cs at 20.0 keV with radiative cascade effect: %g" % xraylib.CS_FluorLine_Kissel_Radiative_Cascade(82,xraylib.MA1_LINE,20.0))
	print ("Pb Malpha XRF production cs at 20.0 keV with non-radiative cascade effect: %g" % xraylib.CS_FluorLine_Kissel_Nonradiative_Cascade(82,xraylib.MA1_LINE,20.0))
	print ("Pb Malpha XRF production cs at 20.0 keV without cascade effect: %g" % xraylib.CS_FluorLine_Kissel_no_Cascade(82,xraylib.MA1_LINE,20.0))
	print ("Al mass energy-absorption cs at 20.0 keV: %f" % xraylib.CS_Energy(13, 20.0))
	print ("Pb mass energy-absorption cs at 40.0 keV: %f" % xraylib.CS_Energy(82, 40.0))
	print ("CdTe mass energy-absorption cs at 40.0 keV: %f" % xraylib.CS_Energy_CP("CdTe", 40.0))


	cryst = xraylib.Crystal_GetCrystal("Si")
Esempio n. 10
0
cdtest = xraylib.CompoundParser("SiO2")
print("SiO2 contains {} atoms, {} elements and has a molar mass of {} g/mol".format(cdtest['nAtomsAll'], cdtest['nElements'], cdtest['molarMass']))
for i in range(cdtest['nElements']):
    print("Element {}: {} % and {} atoms".format(cdtest['Elements'][i], cdtest['massFractions'][i]*100.0, cdtest['nAtoms'][i]))

print("CS2 Refractive Index at 10.0 keV : {} - {} i".format(xraylib.Refractive_Index_Re("CS2",10.0,1.261), xraylib.Refractive_Index_Im("CS2",10.0,1.261)))
print("C16H14O3 Refractive Index at 1 keV : {} - {} i".format(xraylib.Refractive_Index_Re("C16H14O3",1.0,1.2), xraylib.Refractive_Index_Im("C16H14O3",1.0,1.2)))
print("SiO2 Refractive Index at 5 keV : {} - {} i".format(xraylib.Refractive_Index_Re("SiO2",5.0,2.65), xraylib.Refractive_Index_Im("SiO2",5.0,2.65)))
print("Compton profile for Fe at pz = 1.1 : {}".format(xraylib.ComptonProfile(26,1.1)))
print("M5 Compton profile for Fe at pz = 1.1 : {}".format(xraylib.ComptonProfile_Partial(26, xraylib.M5_SHELL,1.1)))
print("M1->M5 Coster-Kronig transition probability for Au : {}".format(xraylib.CosKronTransProb(79, xraylib.FM15_TRANS)))
print("L1->L3 Coster-Kronig transition probability for Fe : {}".format(xraylib.CosKronTransProb(26, xraylib.FL13_TRANS)))
print("Au Ma1 XRF production cs at 10.0 keV (Kissel): {}".format(xraylib.CS_FluorLine_Kissel(79, xraylib.MA1_LINE,10.0)))
print("Au Mb XRF production cs at 10.0 keV (Kissel): {}".format(xraylib.CS_FluorLine_Kissel(79, xraylib.MB_LINE,10.0)))
print("Au Mg XRF production cs at 10.0 keV (Kissel): {}".format(xraylib.CS_FluorLine_Kissel(79, xraylib.MG_LINE,10.0)))
print("K atomic level width for Fe: {}".format(xraylib.AtomicLevelWidth(26, xraylib.K_SHELL)))
print("Bi L2-M5M5 Auger non-radiative rate: {}".format(xraylib.AugerRate(86, xraylib.L2_M5M5_AUGER)))
print("Bi L3 Auger yield: {}".format(xraylib.AugerYield(86, xraylib.L3_SHELL)))

print("Sr anomalous scattering factor Fi at 10.0 keV: {}".format(xraylib.Fi(38, 10.0)))
print("Sr anomalous scattering factor Fii at 10.0 keV: {}".format(xraylib.Fii(38, 10.0)))

symbol = xraylib.AtomicNumberToSymbol(26)
print("Symbol of element 26 is: {}".format(symbol))
print("Number of element Fe is: {}".format(xraylib.SymbolToAtomicNumber("Fe")))
Z = np.array([26])
symbol = xraylib.AtomicNumberToSymbol(Z[0])
print("Symbol of element 26 is: {}".format(symbol))
print("Pb Malpha XRF production cs at 20.0 keV with cascade effect: {}".format(xraylib.CS_FluorLine_Kissel(82, xraylib.MA1_LINE,20.0)))
print("Pb Malpha XRF production cs at 20.0 keV with radiative cascade effect: {}".format(xraylib.CS_FluorLine_Kissel_Radiative_Cascade(82, xraylib.MA1_LINE,20.0)))
print("Pb Malpha XRF production cs at 20.0 keV with non-radiative cascade effect: {}".format(xraylib.CS_FluorLine_Kissel_Nonradiative_Cascade(82, xraylib.MA1_LINE,20.0)))