Database#
speXtra
come with a in-built database of spectral libraries, astronomical filters and extinction curves. The database is constinously growing and we are happy to include additional data that can be useful for your research
The database organized through yaml
files which describe the contents of the different data files.
The inner workings of the database are transparent to the user and generally the user does not
need to deal with the database when working with speXtra
.
There are however few things that might be useful to the user, specially when working in interactive mode (e.g. Jupyter Notebooks)
The database is organized within a directory tree. Depending on what you are requesting, a spectra template, a extinction curve or a filter, it will look for it at that particular place. The syntax is standard:
"library_name/template_name"
for a spectral template"extinction_curve_family/extinction_curve_name"
for extinction curves"filter_system/filter_name"
for astronomical filters
Below you can find the contents of the database
Browsing the Database#
from spextra import spextra_database as db
print(db)
Spextra Database:
Remote URL: https://scopesim.univie.ac.at/spextra/database/
Local path: /home/docs/.spextra_cache
Database contents:
├─libraries:
│ ├─ref: A library of reference stars
│ ├─kc96: Kinney-Calzetti Atlas
│ ├─pickles: Pickles Stellar Library
│ ├─dobos: SDSS galaxy composite spectra
│ ├─irtf: IRTF spectral library
│ ├─agn: AGN templates
│ ├─nebulae: Emission line nebulae
│ ├─brown: Galaxy SEDs from the UV to the Mid-IR
│ ├─kurucz: Subset of Kurucz 1993 Models
│ ├─sne: Supernova Legacy Survey
│ ├─moehler: flux/telluric standards with X-Shooter
│ ├─madden: High-Resolution Spectra of Habitable Zone Planets
│ ├─bosz/hr: BOSZ stellar atmosphere Grid - High Resolution
│ ├─bosz/mr: BOSZ stellar atmosphere Grid - Medium Resolution
│ ├─bosz/lr: BOSZ stellar atmosphere Grid - Low Resolution
│ ├─assef: Low-resolution spectral templates for AGN and galaxies
│ ├─sky: Paranal sky background spectra
│ ├─shapley: Rest-Frame Ultraviolet Spectra of z ∼ 3 Lyman Break Galaxies
│ ├─etc/kinney: ESO ETC version of the Kinney-Calzetti Atlas
│ ├─etc/kurucz: ESO ETC subset of the Kurucz 1993 models
│ ├─etc/marcs/p: ESO ETC subset of the MARCS Stellar Models with Plane Parallel Geometry
│ ├─etc/marcs/s: ESO ETC subset of the MARCS Stellar Models with Spherical Geometry
│ ├─etc/misc: Other templates, nubulae and qso
│ └─etc/pickles: ESO ETC subset of the Pickles stellar library
├─extinction_curves:
│ ├─gordon: LMC and SMC extinction laws
│ ├─cardelli: MW extinction laws
│ └─calzetti: extragalactic attenuation curves
└─filter_systems:
├─elt/micado: MICADO filters
├─elt/metis: METIS filters
└─etc: ESO ETC standard filters
The last will print basic information regarding local and distant storage.
To list all available libraries we can also use:
db["libraries"]
{'ref': 'A library of reference stars',
'kc96': 'Kinney-Calzetti Atlas',
'pickles': 'Pickles Stellar Library',
'dobos': 'SDSS galaxy composite spectra',
'irtf': 'IRTF spectral library',
'agn': 'AGN templates',
'nebulae': 'Emission line nebulae',
'brown': 'Galaxy SEDs from the UV to the Mid-IR',
'kurucz': 'Subset of Kurucz 1993 Models',
'sne': 'Supernova Legacy Survey',
'moehler': 'flux/telluric standards with X-Shooter',
'madden': 'High-Resolution Spectra of Habitable Zone Planets',
'bosz/hr': 'BOSZ stellar atmosphere Grid - High Resolution',
'bosz/mr': 'BOSZ stellar atmosphere Grid - Medium Resolution',
'bosz/lr': 'BOSZ stellar atmosphere Grid - Low Resolution',
'assef': 'Low-resolution spectral templates for AGN and galaxies',
'sky': 'Paranal sky background spectra',
'shapley': 'Rest-Frame Ultraviolet Spectra of z ∼ 3 Lyman Break Galaxies',
'etc/kinney': 'ESO ETC version of the Kinney-Calzetti Atlas',
'etc/kurucz': 'ESO ETC subset of the Kurucz 1993 models',
'etc/marcs/p': 'ESO ETC subset of the MARCS Stellar Models with Plane Parallel Geometry',
'etc/marcs/s': 'ESO ETC subset of the MARCS Stellar Models with Spherical Geometry',
'etc/misc': 'Other templates, nubulae and qso',
'etc/pickles': 'ESO ETC subset of the Pickles stellar library'}
which also works for db["filter_systems"]
and db["extinction_curves"]
which will print the extinction curves and filter systems available
The class SpecLibrary
and its equivalents FilterSystem
and ExtinctionCurve
hold the information regarding a particular library
from spextra import SpecLibrary, FilterSystem, ExtCurvesLibrary
lib = SpecLibrary("ref")
print(lib)
Downloading file 'libraries/ref/index.yml' from 'https://scopesim.univie.ac.at/spextra/database/libraries/ref/index.yml' to '/home/docs/.spextra_cache'.
0%| | 0.00/808 [00:00<?, ?B/s]
0%| | 0.00/808 [00:00<?, ?B/s]
100%|██████████████████████████████████████████| 808/808 [00:00<00:00, 562kB/s]
Spectral Library 'ref': Reference library for objects
spectral coverage: uv, vis, nir, mir
wave_unit: Angstrom
flux_unit: FLAM
Templates: vega, vegaLR, sirius, sun, sunHR
and basic information about the library will be printed
If you are only interested in the template names, just use
list(lib)
['vega', 'vegaLR', 'sirius', 'sun', 'sunHR']
Finally to obtain one of these templates just call Spextrum
from spextra import Spextrum
sp = Spextrum("ref/sun")
Downloading file 'libraries/ref/sun.fits' from 'https://scopesim.univie.ac.at/spextra/database/libraries/ref/sun.fits' to '/home/docs/.spextra_cache'.
0%| | 0.00/37.4k [00:00<?, ?B/s]
19%|███████ | 7.17k/37.4k [00:00<00:00, 66.5kB/s]
38%|██████████████▏ | 14.3k/37.4k [00:00<00:00, 65.8kB/s]
0%| | 0.00/37.4k [00:00<?, ?B/s]
100%|█████████████████████████████████████| 37.4k/37.4k [00:00<00:00, 31.5MB/s]
sp.plot()