Synchrotron-based x-ray absorption spectroscopy for energy materials