# real refractive index from Kramers Kronig relation

I have a measurement of the complex part of the refractive index $$k$$ (where the refractive index is $$m = n + i\,k$$) measured at a nonlinear grid of wavelengths or frequencies that span several orders of magnitude.

Given $$k$$, $$n$$ should be derived from the Kramers-Kronig relations.

However, using a test data set where $$n$$ is known, I do not recover the correct solution. Any idea what I'm doing wrong (nu = frequency array)?

import scipy.fftpack as ft

plt.loglog(nu, n, label='n')
plt.loglog(nu, k, label='k')
plt.loglog(nu, 1.0 + ft.hilbert(k) / np.pi, label='n from k (orig. grid)')
plt.xlabel('frequency [Hz]')
plt.legend()


• I suspect that the "nonlinear grid of wavelengths [...] that span several orders of magnitude" are not regularly sampled (?). In which case the interval $\omega' - \omega$ in the denominator scales the summing element differently. You might want to check this and this also (for the signs). – A_A Oct 5 '18 at 8:33
• yes, it's not even regularly sampled in log-space unfortunately. I can of course interpolate on a large, linear grid, but that didn't seem to help. – John Smith Oct 5 '18 at 9:23
• What I tried to hint at is that you will probably have to evaluate the integral at each frequency that you have data for. So, the available functions might not help if they do not take the frequency intervals into account too. Interpolating might not be feasible anyway due to the extent of the frequencies used. – A_A Oct 5 '18 at 12:23
• hm, I'm not sure I understand what you are saying. Would you mind elaborating a bit more or drafting an answer, even if it's just pseudo-code or a partial answer? Thanks! – John Smith Oct 5 '18 at 13:16
• Have a quick look at this. To derive $\chi_1$ at some $\omega$ you integrate all the $\chi_2$ that you have obtained at frequencies $\omega'$. But this integral includes a division by $\omega' - \omega$. If you had things sampled evenly that would be "predictable" and easy to work out. Right now, you don't exactly take into account the "distances" between the actual $\omega$s that you have data for. – A_A Oct 5 '18 at 14:34