tschoonj / xraylib

A library for X-ray matter interaction cross sections for X-ray fluorescence applications
https://github.com/tschoonj/xraylib/wiki
Other
120 stars 54 forks source link

The calculated refraction index is much different with XOP software. #174

Closed gbzan closed 3 years ago

gbzan commented 3 years ago

The refraction index of C, Si, Ca with Xraylib are much different with XOP software (https://www.esrf.fr/Instrumentation/software/data-analysis/xop2.4). The calculation energy ranges from 10keV to 100keV. The fuctions I used in the python code are xraylib.Refractive_Index_Re and xraylib.Refractive_Index_Im. The results come from Xraylab 4.0: image The results come from XOP 2.3: image So I am confused which one is right. Do you have any tests about the refraction index to make sure they are right? I'm looking forward to hearing from you. Thanks.

tschoonj commented 3 years ago

@srio what do you think is happening here? I guess we are using rather different values for the attenuation coefficients?

srio commented 3 years ago

Yes. It is due to attenuation. The differences should appear in beta and it is due to the absorption cross section.

In XOP we were using absorption due to only photoelectric effect.

In xraylib we discussed this issue many years ago and concluded that it is more accurate to include the total cross section, thus including inelastic and also Rayleigh cross sections.

In OASYS/XOPPY we are also using the same philosophy than in xraylib, so the results in OASYS/f1f2 are different than in XOP/xf1f2. I would suggest to use better OASYS instead XOP. Almost all functionality is there. XOP is not longer maintained.

Depending on the type of calculation you do the xraylib absorption may be overestimated: it consider "absorbed" (in fact: attenuated or removed from the beam) all photons that interact. If your interest is to calculate the power load this is "too much" as there are many photons that may scape and do not contribute to the absorbed energy.

I hope this clarifies the situation.

tschoonj commented 3 years ago

Thanks @srio for the clarification! I honestly completely forgot that we ever discussed this!

gbzan commented 3 years ago

@srio Thanks a lot for the clarification! It is useful to help me understand the difference between them. And also thanks @tschoonj to help me get the right answer.