import matplotlib.pyplot as plt
from specreduce.calibration_data import load_MAST_calspec, load_onedstds

s1 = load_MAST_calspec("ltt9491_002.fits")
s2 = load_onedstds("snfactory", "LTT9491.dat")
s3 = load_onedstds("eso", "ctiostan/ltt9491.dat")

fig, ax = plt.subplots()
ax.step(s1.spectral_axis, s1.flux, label="MAST", where="mid")
ax.step(s2.spectral_axis, s2.flux, label="SNFactory", where="mid")
ax.step(s3.spectral_axis, s3.flux, label="ESO", where="mid")
ax.set_yscale('log')
ax.set_xlabel(f"Wavelength ({s1.spectral_axis.unit})")
ax.set_ylabel(f"Flux ({s1.flux.unit})")
ax.set_title("LTT 9491")
ax.legend()
fig.show()