def wavelength_to_energy(wavelength):
    """
    Convert wavelength in angstroms to energy in keV.
    """
    if wavelength == 0.0:
        return 0.0
    return 12398.419300923944 / (wavelength * 1000.0)