Stellar Spectra¶
You can make a light source object that uses a stellar spectrum, based on the theoretical models of Husser et al. (2013).
from rainbowconnection import *
The first time you try to make a stellar spectrum, it should try to automatically download the library files you need for it; you'll need to be connected to the internet for this step. If you try to generate a very high resolution stellar spectrum, it may take a long time for those files to download!
s = Star(teff=3700 * u.K, radius=0.75 * u.Rsun, mass=0.5 * u.Msun, R=10000)
Let's plot it, both as a 1D spectrum and as it might appear through a visual spectroscope.
s.plot();
s.plot_as_slit_rainbow();
If you want access to the arrays of flux and wavelengths, you can pull them out via the .wavelength()
and .spectrum()
methods.
w = s.wavelength
f = s.spectrum()
plt.plot(w, f);
You might want to know an estimate of the spectrum of the star for a wavelength that's not exactly in the original wavelength grid. You can do so by feeding those wavelengths into the star's .spectrum()
method.
w_other = np.linspace(700, 720, 200) * u.nm
f_other = s.spectrum(w_other)
plt.plot(w, f)
plt.plot(w_other, f_other)
plt.xlim(695, 725);