chemicalc.reference_spectra

chemicalc.reference_spectra.elements_included: List[str] = ['Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 'I', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', 'Ra', 'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es']

List of all elements included in the pre-computed spectral grids.

Type

List[str]

chemicalc.reference_spectra.alpha_el: List[str] = ['O', 'Ne', 'Mg', 'Si', 'S', 'Ar', 'Ca', 'Ti']

List of elements considered when calculating bulk [\(\alpha\)/H].

Type

List[str]

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

Bases: object

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

add_rv_spec(d_rv: float, symmetric: bool = True) → None

Adds spectra and labels corresponding to a small doppler shift of the reference spectra. Assumes that the first spectra in ref_spec_file is a reference w/ no offsets to any labels.

Parameters
  • d_rv (float) – small doppler shift in km/s

  • symmetric (bool) – if True, applies both positive and negative doppler shifts

Returns

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

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_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_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() → List[str]

Get names of all spectra contained in this object

Return List[str]

List of spectra names that this object contains.

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() → None

Resets object to only the initial high-res spectra

Returns