Reference Stars

The ReferenceSpectra class represents the spectra of the star being observed. Here is an overview of the class, as well as some of its important attributes and methods:

Overview

class chemicalc.reference_spectra.ReferenceSpectra(reference: str, init_res: float = 300000, scale_by_iron: bool = False, alpha_included: bool = True, **kwargs)

Object for spectra of a specific reference star

Parameters
  • reference (str) – Name of reference star to load (e.g., ‘RGB_m1.5’)

  • init_res (str) – Initial resolution of high-res reference spectra. Only 300000 is presently included for default spectra. Can be approximate if using custom reference spectra.

  • scale_by_iron (bool) – If true, scales all elemental abundances by [Fe/H]

  • alpha_included (bool) – If true, will include an alpha label after the atmospheric parameters and before the other elements (i.e., between v_micro and Li)

  • **kwargs – see below

Keyword Arguments
  • ref_spec_file (str) – Full path to file of reference spectra

  • ref_label_file (str) – Full path to file of reference spectra labels

Variables
  • resolution (Dict[Union[str,float],int]) – Dictionary of resolving powers for each instrument

  • ref_spec_file – Full path to file of reference spectra

  • ref_label_file – Full path to file of reference spectra labels

  • wavelength (Dict[Union[str,float],np.ndarray]) – Dictionary of wavelength arrays for each instrument

  • spectra (Dict[Union[str,float],np.ndarray]) – Dictionary of spectral grids for each instrument

  • labels (pd.DataFrame) – Labels corresponding to each spectrum in the grid

  • gradients (Dict[Union[str,float],pd.DataFrame]) – Dictionary of partial derivatives for each instrument

  • nspectra (int) – Number of spectra included in the grid

  • nlabels (int) – Number of labels included

Attributes

Spectra

ReferenceSpectra.spectra is a Python dictionary, each entry of which consists of a grid of spectra generated around the stellar labels of the reference star Each spectral grid is a \(n_{\text{spectra}} \times n_{\text{pixel}}\) numpy.ndarray. The order of spectra in the pre-computed spectral grids is described below.

Upon initialization, the dictionary consists of only one entry with the key “init” that corresponds to the initial grid of high-resolution (\(R \sim 300000\)) normalized spectra. It is read in from reference_spectra_300000.h5 by default or from ref_spec_file if provided.

With each call to ReferenceSpectra.convolve(), the dictionary is populated with a new grid of spectra that have been convolved and subsampled to match the resolution and wavelength array of the passed InstConfig object. The key for the new spectral grid is the name of the instrument configuration, InstConfig.name.

Wavelength

ReferenceSpectra.wavelength is a Python dictionary containing the wavelength array (as a size times n_{text{pixel}} numpy.ndarray) corresponding to spectral grids.

Upon initialization, the dictionary consists of only one entry with the key “init” that corresponds to the wavelength array for the initial high-resolution spectral grid. It is read in from reference_spectra_300000.h5 by default or from ref_spec_file if provided.

With each call to ReferenceSpectra.convolve(), the dictionary is populated with a new entry corresponding to the wavelength array of the passed InstConfig object. The key for the new wavelength array is the name of the instrument configuration, InstConfig.name.

Labels

ReferenceSpectra.labels is a pandas.DataFrame of shape \(n_{\text{labels}} \times n_{\text{spectra}}\), containing the stellar labels 1 corresponding to each spectrum in the grid. The DataFrame’s row names (indices) consist of the stellar labels included. The DataFrame’s column names consist of (arbitrary) ID’s for the individual spectra in the grid. It is read in from reference_labels.h5 by default or from ref_label_file if provided.

Gradients

ReferenceSpectra.gradients is initially an empty Python dictionary.

With each call to ReferenceSpectra.calc_gradient(), partial derivatives of the spectrum with respect to each stellar label is calculated for one of the sets of spectral grids. They are added as a new entry in the form of an \(n_{\text{label}} \times n_{\text{pixel}}\) pandas.DataFrame. The key for the new spectral gradient DataFrame is the name of the instrument configuration, InstConfig.name. The DataFrame’s row names (indices) consist of the stellar labels included. The DataFrame’s column names consist of the wavelength of each pixel.

Methods

Convolve Spectral Grids

ReferenceSpectra.convolve(instrument, name: Optional[str] = None) → None

Convolves spectra to instrument resolution and samples onto instrument’s wavelength grid

Parameters
  • instrument (InstConfig) – Instrument object to convolve and sample spectra onto

  • name (str) – Name to give spectra. If None, defaults to name of instrument

Returns

Calculate Spectral Gradients

ReferenceSpectra.calc_gradient(name: Union[str, chemicalc.instruments.InstConfig], symmetric: bool = True, ref_included: bool = True) → None

Calculates gradients of the reference spectra with respect to each label.

Parameters
  • name (Union[str,InstConfig]) – Name of convolved spectra to calculate gradient for. Will also accept an InstConfig object and use InstConfig.name.

  • symmetric (bool) – If True, calculates symmetric gradient around reference labels

  • ref_included (bool) – If True, expects first spectra to be reference spectra w/ no offsets to any labels. Required for symmetric=False.

Returns

Zero Out Gradients

ReferenceSpectra.zero_gradients(name: Union[str, chemicalc.instruments.InstConfig], labels: Union[str, List[str]])

Sets gradients of a spectrum to zero for the specified labels. This is equivalent to setting a delta-function prior on those labels (i.e., holding them fixed).

Parameters
  • name (Union[str,InstConfig]) – Name of spectra to apply gradient zeroing to. Will also accept an InstConfig object and use InstConfig.name.

  • labels (Union[str,List[str]]) – List of labels for which to zero gradients

Returns

Mask Out Gradients

ReferenceSpectra.mask_wavelength(name: Union[str, chemicalc.instruments.InstConfig], regions: List[Tuple[float, float]]) → None

Masks the information content of a spectrum by setting the gradient to zero within the bounds of the mask. Can be used to mimic the masking of skylines, non-LTE lines, or detector gaps.

Parameters
  • name (Union[str,InstConfig]) – Name of the spectra to apply mask to

  • regions (List[Tuple[float,float]]) – List of wavelength bounds on the regions to mask.

Returns

Get Names of Spectral Grids

ReferenceSpectra.get_names() → List[str]

Get names of all spectra contained in this object

Return List[str]

List of spectra names that this object contains.

Duplicate Spectral Grid

ReferenceSpectra.duplicate(name: str, new_name: str) → None

Duplicates set of spectra/gradients

Parameters
  • name (str) – Name of spectra to duplicate

  • new_name (str) – Name given to new spectra

Returns

Reset ReferenceSpectra Object

ReferenceSpectra.reset() → None

Resets object to only the initial high-res spectra

Returns


Pre-Computed Reference Stars

The spectral grids for the following Reference Stars have been pre-computed using atlas12 1D-LTE model atmospheres and the synthe radiative transfer code.

Note

See Section 3.2 of Sandford et al. (In Press) for a detailed description of the spectral generation

Name

\(M_{V}\) (Vega)

\(T_{eff}\)

\(\\log(g)\)

\(v_{turb}\) (km/s)

\(\log(Z)\)

[X/H]

\(\alpha\) included?

RGB_m0.5

-0.5

4200

1.5

2.0

-0.5

Solar

No

RGB_m1.0

-0.5

4530

1.7

1.9

-1.0

Solar

Yes

RGB_m1.5

-0.5

4750

1.8

1.9

-1.5

Solar

Yes

RGB_m2.0

-0.5

4920

1.9

1.9

-2.0

Solar

Yes

RGB_m2.5

-0.5

5050

1.9

1.9

-2.5

Solar

Yes

MSTO_m1.5

+3.5

6650

4.1

1.2

-1.5

Solar

Yes

TRGB_m1.5

-2.5

4070

0.5

2.3

-1.5

Solar

Yes

KGiant

4800

2.5

1.7

0.0

Solar

No

Ph_k0i_m0.0

4500

1.0

2.2

0.0

Solar

Yes

Ph_k0i_m1.0

4500

1.0

2.2

-1.0

Solar

Yes

Ph_k5iii_m0.0

4800

1.5

2.0

0.0

Solar

Yes

Ph_k5iii_m1.0

4800

1.5

2.0

-1.0

Solar

Yes

Pre-Computed Spectral Grid Organization

  • The first spectrum in each grid is generated with the stellar labels in the above table.

  • The next 2 spectra are generated with \(T_{eff}\) offset by \(\pm 50\) K.

  • The next 2 spectra are generated with \(\\log(g)\) offset by \(\pm 0.1\) dex.

  • The next 2 spectra are generated with \(v_{turb}\) offset by \(\pm 0.1\) km/s.

  • The next 2 spectra are generated with [\(\alpha\)/H] offset by \(\pm 0.05\) dex (if “Yes” in the “\(\alpha\) included?” column above).

  • The next 97x2 spectra are generated with [X/H] offset by \(\pm 0.05\) dex, where X refers to elements with atomic numbers between 3 (Li) and 99 (Es).

In total, these spectral grids will consist of 203 (201) spectra if the offsets to [\(\alpha\)/H] are (not) included.


Custom Reference Stars

Some Chem-I-Calc users may wish to use their own spectral grids to calculate the CRLBs for additional reference stars or with alternative spectral models (e.g., with 3D, non-LTE atmospheres). This can be done by calling ReferenceSpectra with the keyword arguments: ref_spec_file and ref_label_file. At present, these files must be in the same format as the default Chem-I-Calc files (reference_spectra_300000.h5 and reference_labels.h5).

Warning

Use of custom spectral grids has not been thoroughly tested. We welcome feedback and code contributions to improve this functionality (see Contributing to Chem-I-Calc.)


Footnotes

1

“Stellar Labels” broadly encompasses both atmospheric parameters (e.g., effective temperature, surface gravity, and microturbulent velocity) and elemental abundances.