Add code to calculate stats for attenuation and write to file.