A user reported that the reflectivity for an Au coated mirror at 100 eV is too high in ShadowOui. It should be around 70%.
The problem comes from the particular use of the optical constants. At low energies, the error in the scattering factors and refraction index may be high and the selection of the crucial values is essential.
In ShadowOui we use xraylib https://github.com/tschoonj/xraylib/wiki. Many users of low photon energies rely on the Henke tabulation at XCRO: https://henke.lbl.gov/optical_constants/
Indeed, the differences for reflectivity are very large at 100 eV:

We cannot change the database in ShadowOui. Therefore, in some particular cases like this the user must pay attention to the reflectivity values given by the different tabulations. And find a solution if needed. This script helps to convet a file with the refraction index from CXrO to the Shadow preprocessor format.
import numpy
def prerefl_cxro(input_file="https://henke.lbl.gov/tmp/xray8378.dat", output_file="prerefl.dat",
E_MIN=None, E_MAX=None, NPOINTS=1000):
"""
Preprocessor for mirrors - data from file downloaded from https://henke.lbl.gov/ (refractio)
-"""
# retrieve physical constants needed
import scipy
import scipy.constants as codata
tocm = codata.h * codata.c / codata.e * 1e2
a = numpy.loadtxt(input_file, skiprows=2)
energy0 = a[:,0]
delta0 = a[:,1]
beta0 = a[:,2]
if E_MIN is None:
E_MIN = energy0.min()
if E_MAX is None:
E_MAX = energy0.max()
if energy0[0] > E_MIN:
raise Exception("File min(energy) = %g greater than limit %g, cannot interpolate" % (energy0[0], E_MIN))
if energy0[-1] < E_MAX:
raise Exception("File max(energy) = %g smaller than limit %g, cannot interpolate" % (energy0[-1], E_MAX))
# read density from header
if "http" in input_file:
import urllib.request as urllib
fp = urllib.urlopen(input_file)
lines = fp.readlines()
mylist = lines[0].decode('utf-8').split("=")
density = float(mylist[1])
else:
fp = open(input_file) # Open file on read mode
lines = fp.read().split("\n") # Create a list containing all lines
fp.close() # Close file
mylist = lines[0].split("=")
density = float(mylist[1])
energy = numpy.linspace(E_MIN, E_MAX, int(NPOINTS))
delta = numpy.interp(energy, energy0, delta0)
beta = numpy.interp(energy, energy0, beta0)
twopi = numpy.pi * 2
npoint = energy.size
depth0 = density / 2.0
qmin = energy[0] / tocm * twopi
qmax = energy[-1] / tocm * twopi
qstep = (energy[1] - energy[0]) / tocm * twopi
f = open(output_file, 'wt')
f.write(("%20.11e " * 4 + "\n") % tuple([qmin, qmax, qstep, depth0]))
f.write("%i \n" % int(npoint))
for i in range(npoint):
tmp = 2e0 * delta[i]
f.write("%e \n" % tmp)
for i in range(npoint):
tmp2 = 2e0 * beta[i]
f.write("%e \n" % tmp2)
print("File written to disk: %s" % output_file)
f.close()
prerefl_cxro(input_file="https://henke.lbl.gov/tmp/xray8378.dat",
output_file="prerefl_cxro.dat",
E_MIN=50, E_MAX=501, NPOINTS=500)
Note: just to mention that the reflectivity calculations with xoppy/f1f2 give still different results. xoppy/f1f2 uses xraylib.Fii() and the ShadowOui preprocessors xraylib.Refractive_Index_Im()
A user reported that the reflectivity for an Au coated mirror at 100 eV is too high in ShadowOui. It should be around 70%.
The problem comes from the particular use of the optical constants. At low energies, the error in the scattering factors and refraction index may be high and the selection of the crucial values is essential.
In ShadowOui we use xraylib https://github.com/tschoonj/xraylib/wiki. Many users of low photon energies rely on the Henke tabulation at XCRO: https://henke.lbl.gov/optical_constants/
Indeed, the differences for reflectivity are very large at 100 eV:
We cannot change the database in ShadowOui. Therefore, in some particular cases like this the user must pay attention to the reflectivity values given by the different tabulations. And find a solution if needed. This script helps to convet a file with the refraction index from CXrO to the Shadow preprocessor format.
Note: just to mention that the reflectivity calculations with xoppy/f1f2 give still different results. xoppy/f1f2 uses xraylib.Fii() and the ShadowOui preprocessors xraylib.Refractive_Index_Im()