Atmospheric models

The DRIFT-PHOENIX model spectra are added to the database. The grid is then interpolated and a spectrum for a given set of parameter values and spectral resolution is computed. The spectrum is then plotted together with several filter profiles.

[1]:
import species
from IPython.display import Image
[2]:
species.SpeciesInit('./')
Initiating species v0.1.0... [DONE]
Creating species_config.ini... [DONE]
Creating species_database.hdf5... [DONE]
Creating data folder... [DONE]
[2]:
<species.core.setup.SpeciesInit at 0x1242a8240>
[3]:
database = species.Database()
[4]:
database.add_model(model='drift-phoenix',
                   wavel_range=(0.5, 10.),
                   teff_range=None,
                   spec_res=None)
Downloading DRIFT-PHOENIX model spectra (151 MB)... [DONE]
Unpacking DRIFT-PHOENIX model spectra... [DONE]
Adding DRIFT-PHOENIX model spectra... [DONE]
[5]:
read_model = species.ReadModel(model='drift-phoenix',
                               wavel_range=(1., 5.))
[6]:
model_param = {'teff':1510., 'logg':4.1, 'feh':0.1}
[7]:
modelbox = read_model.get_model(model_param=model_param,
                                spec_res=200.)
[8]:
filters = ['MKO/NSFCam.J', 'MKO/NSFCam.H', 'MKO/NSFCam.K', 'MKO/NSFCam.Lp', 'MKO/NSFCam.Mp']
[9]:
species.plot_spectrum(boxes=[modelbox, ],
                      filters=filters,
                      offset=(-0.08, -0.06),
                      xlim=(1., 5.),
                      ylim=(0., 1.1e5),
                      legend='upper right',
                      output='model_spectrum.png')
Adding filter: MKO/NSFCam.J... [DONE]
Adding filter: MKO/NSFCam.H... [DONE]
Adding filter: MKO/NSFCam.K... [DONE]
Adding filter: MKO/NSFCam.Lp... [DONE]
Adding filter: MKO/NSFCam.Mp... [DONE]
Plotting spectrum: model_spectrum.png... [DONE]
[10]:
Image('model_spectrum.png')
[10]:
../_images/tutorials_atmospheric_models_11_0.png

It is also possible to extract a spectrum without interpolating at one of the grid points. Let’s first check what parameter values are available for the DRIFT-PHOENIX models.

[11]:
read_model.get_points()
[11]:
{'teff': array([1000., 1100., 1200., 1300., 1400., 1500., 1600., 1700., 1800.,
        1900., 2000., 2100., 2200., 2300., 2400., 2500., 2600., 2700.,
        2800., 2900., 3000.], dtype=float32),
 'logg': array([3. , 3.5, 4. , 4.5, 5. , 5.5], dtype=float32),
 'feh': array([-0.6, -0.3, -0. ,  0.3], dtype=float32)}

The get_data function is used for extracting an spectrum from the discrete parameter grid.

[12]:
model_param = {'teff':1500., 'logg':4., 'feh':0., 'radius':1., 'distance':10.}
[13]:
modelbox = read_model.get_data(model_param=model_param)
[14]:
species.plot_spectrum(boxes=[modelbox, ],
                      filters=filters,
                      offset=(-0.08, -0.06),
                      xlim=(1., 5.),
                      ylim=(0., 5.5e-15),
                      legend='upper right',
                      output='model_spectrum.png')
Plotting spectrum: model_spectrum.png... [DONE]
[15]:
Image('model_spectrum.png')
[15]:
../_images/tutorials_atmospheric_models_18_0.png