docs: def air_absorption_coefficient(medium, wavelength):
      """ 
       The function returns linear absorbtion coefficient of selected medium at
       given x-ray wavelength [mm^-1]
  
       Mass attenuation coefficients are taken from NIST "Tables of X-Ray Mass
       Attenuation Coefficients and Mass Energy-Absorption Coefficients from 1
       keV to 20 MeV for Elements Z = 1 to 92 and 48 Additional Substances of Dosimetric Interest
       J. H. Hubbell and S. M. Seltzer
  
      http://www.nist.gov/pml/data/xraycoef/index.cfm
      """
      if medium == 'Helium':
          density = 1.663e-04
          # the table contains photon energy [Mev] and mass attenuation coefficient
          # mu/sigma [cm^2/g]
          mass_attenuation_coefficient = np.array([[1.00000e-03, 6.084e+01],
                                                   [1.50000e-03, 1.676e+01],
                                                   [2.00000e-03, 6.863e+00],
                                                   [3.00000e-03, 2.007e+00],
                                                   [4.00000e-03, 9.329e-01],
                                                   [5.00000e-03, 5.766e-01],
                                                   [6.00000e-03, 4.195e-01],
                                                   [8.00000e-03, 2.933e-01],
                                                   [1.00000e-02, 2.476e-01],
                                                   [1.50000e-02, 2.092e-01],
                                                   [2.00000e-02, 1.960e-01],
                                                   [3.00000e-02, 1.838e-01],
                                                   [4.00000e-02, 1.763e-01],
                                                   [5.00000e-02, 1.703e-01],
                                                   [6.00000e-02, 1.651e-01],
                                                   [8.00000e-02, 1.562e-01],
                                                   [1.00000e-01, 1.486e-01],
                                                   [1.50000e-01, 1.336e-01],
                                                   [2.00000e-01, 1.224e-01],
                                                   [3.00000e-01, 1.064e-01],
                                                   [4.00000e-01, 9.535e-02],
                                                   [5.00000e-01, 8.707e-02],
                                                   [6.00000e-01, 8.054e-02],
                                                   [8.00000e-01, 7.076e-02],
                                                   [1.00000e+00, 6.362e-02],
                                                   [1.25000e+00, 5.688e-02],
                                                   [1.50000e+00, 5.173e-02],
                                                   [2.00000e+00, 4.422e-02],
                                                   [3.00000e+00, 3.503e-02],
                                                   [4.00000e+00, 2.949e-02],
                                                   [5.00000e+00, 2.577e-02],
                                                   [6.00000e+00, 2.307e-02],
                                                   [8.00000e+00, 1.940e-02],
                                                   [1.00000e+01, 1.703e-02],
                                                   [1.50000e+01, 1.363e-02],
                                                   [2.00000e+01, 1.183e-02]])
  
      elif medium == 'Air':
          density = 1.205e-03
          mass_attenuation_coefficient = np.array([[1.00000e-03, 3.606e+03],
                                                   [1.50000e-03, 1.191e+03],
                                                   [2.00000e-03, 5.279e+02],
                                                   [3.00000e-03, 1.625e+02],
                                                   [3.20290e-03, 1.340e+02],
                                                   [3.202900000001e-03, 1.485e+02],
                                                   [4.00000e-03, 7.788e+01],
                                                   [5.00000e-03, 4.027e+01],
                                                   [6.00000e-03, 2.341e+01],
                                                   [8.00000e-03, 9.921e+00],
                                                   [1.00000e-02, 5.120e+00],
                                                   [1.50000e-02, 1.614e+00],
                                                   [2.00000e-02, 7.779e-01],
                                                   [3.00000e-02, 3.538e-01],
                                                   [4.00000e-02, 2.485e-01],
                                                   [5.00000e-02, 2.080e-01],
                                                   [6.00000e-02, 1.875e-01],
                                                   [8.00000e-02, 1.662e-01],
                                                   [1.00000e-01, 1.541e-01],
                                                   [1.50000e-01, 1.356e-01],
                                                   [2.00000e-01, 1.233e-01],
                                                   [3.00000e-01, 1.067e-01],
                                                   [4.00000e-01, 9.549e-02],
                                                   [5.00000e-01, 8.712e-02],
                                                   [6.00000e-01, 8.055e-02],
                                                   [8.00000e-01, 7.074e-02],
                                                   [1.00000e+00, 6.358e-02],
                                                   [1.25000e+00, 5.687e-02],
                                                   [1.50000e+00, 5.175e-02],
                                                   [2.00000e+00, 4.447e-02],
                                                   [3.00000e+00, 3.581e-02],
                                                   [4.00000e+00, 3.079e-02],
                                                   [5.00000e+00, 2.751e-02],
                                                   [6.00000e+00, 2.522e-02],
                                                   [8.00000e+00, 2.225e-02],
                                                   [1.00000e+01, 2.045e-02],
                                                   [1.50000e+01, 1.810e-02],
                                                   [2.00000e+01, 1.705e-02]])
      else:
          raise Exception('Unknown medium ' + medium)
  
      etw = 1.23985e-2  # [Mev*Angstroem]
      photon_energy = etw / wavelength
  
      if photon_energy < min(mass_attenuation_coefficient[:, 0]):
          raise Exception('Wavelength is too large, using nearest value')
  
      if photon_energy > max(mass_attenuation_coefficient[:, 0]):
          raise Exception('Wavelength is too small, using nearest value')
  
      # 0.1 here converts from cm^-1 to mm^-1
      mu = 0.1 * density * np.interp(photon_energy,
                                     mass_attenuation_coefficient[:, 0],
                                     mass_attenuation_coefficient[:, 1])
  
      return mu