chemicalc.crlb

chemicalc.crlb.init_crlb_df(reference: chemicalc.reference_spectra.ReferenceSpectra) → pandas.core.frame.DataFrame

Initialized CRLB dataframe with indices corresponding to all the labels included

Parameters

reference (ReferenceSpectra) – Reference star object (used to identify stellar labels)

Return pd.DataFrame

Empty CRLB dataframe

chemicalc.crlb.calc_crlb(reference: chemicalc.reference_spectra.ReferenceSpectra, instruments: Union[chemicalc.instruments.InstConfig, List[chemicalc.instruments.InstConfig]], pixel_corr: Optional[List[float]] = None, priors: Optional[Dict[str, float]] = None, bias_grad: Optional[pandas.core.frame.DataFrame] = None, use_alpha: bool = False, output_fisher: bool = False, chunk_size: int = 10000) → Union[pandas.core.frame.DataFrame, Tuple[pandas.core.frame.DataFrame, pandas.core.frame.DataFrame]]

Calculates the Fisher Information Matrix and Cramer-Rao Lower Bound from spectral gradients

Parameters
  • reference (ReferenceSpectra) – Reference star object

  • instruments (Union[InstConfig,List[InstConfig]]) – Instrument object or list of instrument objects

  • pixel_corr (Optional[List[float]]) – Correlation of adjacent pixels. This may considerably slow down the computation.

  • priors (Optional[Dict[str,float]]) – 1-sigma Gaussian priors for labels

  • bias_grad (Optional[pd.DataFrame]) – Gradient of the bias matrix

  • use_alpha (bool) – If true, uses bulk alpha gradients and zeros gradients of individual alpha elements (see chemicalc.reference_spectra.alpha_el)

  • output_fisher (bool) – If true, outputs Fisher information matrix

  • chunk_size (int) – Number of pixels to break spectra into. Helps with memory usage for large spectra.

Return Union[pd.DataFrame, Tuple[pd.DataFrame, np.ndarray]]

DataFrame of CRLBs. If output_fisher=True, also returns FIM

chemicalc.crlb.sort_crlb(crlb: pandas.core.frame.DataFrame, cutoff: float, sort_by: str = 'default', fancy_labels: bool = False) → pandas.core.frame.DataFrame

Sorts CRLB dataframe by decreasing precision of labels and removes labels with precisions worse than cutoff.

Parameters
  • crlb (pd.DataFrame) – dataframe of CRLBs

  • cutoff (float) – Cutoff precision of labels

  • sort_by (str) – Name of dataframe column to sort labels by. ‘default’ uses the column with the most labels recovered below the cutoff. ‘alphabetical’ sorts elemental labels alphabetically. ‘atomic_number’ sorts the elements by the order they appear on the periodic table.

  • fancy_labels (bool) – Replaces Teff, logg, and v_micro with math-formatted labels (for plotting).

Return pd.DataFrame

Sorted CRLB dataframe