merged mag_spectrum_fitting.py and mag_spectrum_plot_excess.py