Guide to use Spectrum
object¶
import numpy as np
import matplotlib.pyplot as plt
import sed_analysis_tools as st
Creating a Spectrum¶
spec = st.Spectrum(x=np.linspace(3.3,4.3,50), # wavelengths in log(Angstrom)
y=np.random.normal(10,2,50), # flux in log(erg/s/Angstrom)
frac_err=abs(np.random.normal(0,1,50)), # Fractional errors
seed=1)
Plotting the Spectrum¶
spec.plot()
fig, ax = plt.subplots(figsize=(4,3))
spec.plot_physical(ax=ax, c='r', ls=':')
Adding/subtracting/dividing spectra¶
Flux is added/subtracted/divided returning new Spectrum object
spec1 = st.Spectrum(x=np.linspace(3.3,4.3,50), # wavelengths in log(Angstrom)
y=np.random.normal(10,0.01,50), # flux in log(erg/s/Angstrom)
frac_err=abs(np.random.normal(0,0.1,50)), # Fractional errors
seed=1)
spec2 = st.Spectrum(x=np.linspace(3.3,4.3,50), # wavelengths in log(Angstrom)
y=np.random.normal(9,0.01,50), # flux in log(erg/s/Angstrom)
frac_err=abs(np.random.normal(0,0.1,50)), # Fractional errors
seed=2)
spec3 = spec1+spec2
spec4 = spec1-spec2
spec5 = spec1/spec2