Exemplo n.º 1
0
    def test_pz_50(self):
        profile = xraylib.ComptonProfile(26, 50.0)
        self.assertAlmostEqual(profile, 0.0006843950273082384, delta=1E-8)

        profile = xraylib.ComptonProfile_Partial(26, xraylib.N1_SHELL, 50.0)
        self.assertAlmostEqual(profile, 2.4322755767709126e-07, delta=1E-10)

        profile1 = xraylib.ComptonProfile_Partial(26, xraylib.L2_SHELL, 50.0)
        profile2 = xraylib.ComptonProfile_Partial(26, xraylib.L3_SHELL, 50.0)
        self.assertAlmostEqual(profile1, profile2, delta=1E-10)
        self.assertAlmostEqual(profile1, 2.026953933016568e-06, delta=1E-10)
Exemplo n.º 2
0
    def test_pz_100(self):
        profile = xraylib.ComptonProfile(26, 100.0)
        self.assertAlmostEqual(profile, 1.8E-5, delta=1E-8)

        profile = xraylib.ComptonProfile_Partial(26, xraylib.N1_SHELL, 100.0)
        self.assertAlmostEqual(profile, 5.1E-9, delta=1E-12)

        profile1 = xraylib.ComptonProfile_Partial(26, xraylib.L2_SHELL, 100.0)
        profile2 = xraylib.ComptonProfile_Partial(26, xraylib.L3_SHELL, 100.0)
        self.assertAlmostEqual(profile1, profile2, delta=1E-10)
        self.assertAlmostEqual(profile1, 1.1E-8, delta=1E-10)
Exemplo n.º 3
0
    def test_bad_input(self):
        with self.assertRaises(ValueError):
            xraylib.ComptonProfile(0, 0.0)
        xraylib.ComptonProfile(102, 0.0)
        with self.assertRaises(ValueError):
            xraylib.ComptonProfile(103, 0.0)
        with self.assertRaises(ValueError):
            xraylib.ComptonProfile(26, -1.0)

        with self.assertRaises(ValueError):
            xraylib.ComptonProfile_Partial(0, xraylib.K_SHELL, 0.0)
        xraylib.ComptonProfile_Partial(102, xraylib.K_SHELL, 0.0)
        with self.assertRaises(ValueError):
            xraylib.ComptonProfile_Partial(103, xraylib.K_SHELL, 0.0)
        with self.assertRaises(ValueError):
            xraylib.ComptonProfile_Partial(26, xraylib.K_SHELL, -1.0)
        with self.assertRaises(ValueError):
            xraylib.ComptonProfile_Partial(26, -1, 0.0)
        with self.assertRaises(ValueError):
            xraylib.ComptonProfile_Partial(26, xraylib.N2_SHELL, 0.0)
        with self.assertRaises(TypeError):
            xraylib.ComptonProfile_Partial()
        with self.assertRaises(TypeError):
            xraylib.ComptonProfile_Partial("26", xraylib.N2_SHELL, 0.0)
Exemplo n.º 4
0
        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)))
Exemplo n.º 5
0
	cdtest = xraylib.CompoundParser("Ca(HCO3)2")
	print ("Ca(HCO3)2 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))
		
	cdtest = xraylib.CompoundParser("SiO2")
	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))
Exemplo n.º 6
0
cdtest = xraylib.CompoundParser("Ca(HCO3)2")
print("Ca(HCO3)2 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]))

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")))