rvs_read_grid¶
The rvs_read_grid command creates an SQLite database catalog of stellar template spectra, which is the first step in the rvspecfit template preparation pipeline.
Purpose¶
This command scans a directory of FITS files containing stellar template spectra (typically PHOENIX models) and creates a database that catalogs all the templates with their atmospheric parameters (Teff, log g, [Fe/H], [α/Fe], etc.). The database is used by subsequent commands in the pipeline.
Basic Usage¶
rvs_read_grid --prefix /path/to/templates/ --templdb files.db
Command Line Options¶
Required Options¶
--prefix PATHThe location of the input template grid directory. This should contain the FITS files with stellar template spectra.
--templdb FILENAMEThe filename where the SQLite database describing the template library will be stored. Default:
files.db
Header Keyword Mapping Options¶
--keyword_teff KEYWORDThe FITS header keyword for effective temperature. Default:
PHXTEFF--keyword_logg KEYWORDThe FITS header keyword for surface gravity (log g). Default:
PHXLOGG--keyword_metallicity KEYWORDThe FITS header keyword for metallicity [Fe/H]. Default:
PHXM_H--keyword_alpha KEYWORDThe FITS header keyword for alpha enhancement [α/Fe]. Default:
PHXALPHA
Parameter Naming Options¶
--name_metallicity NAMEThe internal name for the metallicity parameter. Default:
feh--name_alpha NAMEThe internal name for the alpha enhancement parameter. Default:
alpha
File Selection Options¶
--glob_mask PATTERNThe glob pattern to find the spectral FITS files. Default:
*/*fits
Additional Parameters¶
--extra_params PARAM_LISTExtra template parameters to store in the database. Format: comma-separated list of
internal_name:FITS_keywordpairs.Example:
--extra_params vmic:VMIC,vsini:VSINIwould store microturbulence and rotational velocity if those keywords exist in the FITS headers.
Examples¶
Basic Usage with PHOENIX Templates¶
rvs_read_grid --prefix /data/PHOENIX-ACES-AGSS-COND-2011/ \
--templdb phoenix_templates.db
Custom Header Keywords¶
For templates with non-standard FITS keywords:
rvs_read_grid --prefix /data/custom_templates/ \
--templdb custom.db \
--keyword_teff TEMP \
--keyword_logg GRAVITY \
--keyword_metallicity MH \
--keyword_alpha ALPHA_FE
Including Extra Parameters¶
To store additional parameters like microturbulence velocity:
rvs_read_grid --prefix /data/PHOENIX-ACES-AGSS-COND-2011/ \
--templdb phoenix_with_vmic.db \
--extra_params vmic:VMIC
Different File Organization¶
For templates organized differently:
rvs_read_grid --prefix /data/templates/ \
--templdb templates.db \
--glob_mask "*.fits"
Output¶
The command creates an SQLite database with two main tables:
files table: Contains one row per template spectrum with: -
filename: Path to the FITS file (relative to prefix) -teff: Effective temperature -logg: Surface gravity -feh(or custom name): Metallicity -alpha(or custom name): Alpha enhancement - Additional parameters if specified -id: Unique integer identifier -bad: Boolean flag for problematic spectragrid_parameters table: Metadata about the grid structure
Notes¶
The command will overwrite existing database files without warning
All FITS files must contain the specified header keywords, or the command will fail
The database stores relative paths, so the
--prefixmust be used consistently in subsequent commandsTemplates are assigned sequential integer IDs starting from 0
Error Handling¶
Common errors and solutions:
- “No FITS templates found”
Check that the
--prefixpath is correct and contains FITS files matching the--glob_maskpattern.- “Keyword for [parameter] [keyword] not found”
The specified FITS header keyword doesn’t exist in one or more template files. Check the FITS headers or adjust the keyword parameters.
See Also¶
rvs_make_interpol - Next step: create interpolated spectra
rvs_make_nd - Create n-dimensional interpolation
rvs_make_ccf - Create cross-correlation functions