Scaling Relations#

Provides the SRPredictor class, which allows the user to predict \(H,\,P,\,\) and \(\tau\) using the \(\nu_\mathrm{max}\) scaling relations in de Assis Peralta et al. 2018, complemented with my own fit for \(\alpha\) using the data from the same study.

class grannules.utils.scalingrelations.SRPredictor(relations: dict[str, tuple[float, float]] = {}, relations_with_phase: tuple[dict[str, tuple[float, float]]] = ({}, {}, {}), use_phase=True)[source]#

Uses \(\nu_\mathrm{max}\) scaling relations to predict red giant granulation parameters.

Defaults to using the relations for \(H,\, P,\,\) and \(\tau\) found in de Assis Peralta et al. 2018 Table B5, and a provided fit for \(\alpha\).

Parameters:
  • relations (dict[str, tuple[float, float]]) – If use_phase is False, overrides the “all” fits in the default relations with entries in this dict. Use keys “H”, “P”, “tau” and “alpha” to replace the respective scaling relations. The values should be tuples of float of length 2, where the first item is the coefficient of \(\nu_\mathrm{max}\), and the second is the exponent. Defaults to an empty dictionary (no overrides).

  • relations_with_phase (tuple[dict[str, tuple[float, float]]]) –

    This parameter is a tuple of length 3, where each element is a dict just like relations. Each dict corresponds to the scaling relations for the following stellar evolution phases:

    • 0: Unclassified/All

    • 1: Red Giant Branch

    • 2: Red Clump/Helium Burning

    If use_phase is True, each dict will override the default scaling relation of its respective phase, as with the relations parameter.

  • use_phase (bool) – Whether to use different scaling relations based on the phase of the input star.

predict(nu_max, phases=0) DataFrame[source]#
grannules.utils.scalingrelations.compare_psd(M: float | None = None, R: float | None = None, Teff: float | None = None, FeH: float | None = None, phase: float | None = None, KepMag: float | None = None, KIC=None, *, x: Series | None = None)[source]#

Compare the power spectral density (PSD) of a red giant derived from the default NNPredictor model and the scaling relations. Has functionality to optionally fetch observed PSD using lightkurve.

Important

This method requires holoviews to be installed.

To fetch Kepler lightcurves (i.e. running with KIC is not None), lightkurve is also required.

Parameters:
  • M (float, optional) – Stellar mass in solar units. Default is None.

  • R (float, optional) – Stellar radius in solar units. Default is None.

  • Teff (float, optional) – Effective temperature of the star in Kelvin. Default is None.

  • FeH (float, optional) – Metallicity of the star ([Fe/H]). Default is None.

  • phase (float, optional) – Evolutionary phase of the star. Default is None.

  • KepMag (float, optional) – Kepler magnitude of the star. Default is None.

  • KIC (int, optional) – Kepler Input Catalog (KIC) identifier for the star. Default is None.

  • x (pd.Series, optional) – A pandas Series containing the stellar parameters (M, R, Teff, FeH, phase, KepMag). If provided, individual parameters should not be passed. Default is None.

Returns:

A Holoviews Overlay object containing the PSD plots for the star, including:

  • The true PSD (if KIC is provided).

  • The binned PSD (if KIC is provided).

  • PSD predicted using scaling relations.

  • PSD predicted using a neural network.

  • A vertical line indicating the predicted nu_max value.

Return type:

holoviews.Overlay

Raises:

ValueError – If neither a pandas Series (x) nor individual stellar parameters are provided.

Note

  • The function uses Lightkurve to search, download, and process the light curve data for the given KIC.

  • The PSD is computed and compared against predictions from scaling relations and a neural network.

  • The function caches the PSD for a given KIC to avoid redundant computations.

grannules.utils.scalingrelations.compare_psd_bokeh(M: float | None = None, R: float | None = None, Teff: float | None = None, FeH: float | None = None, phase: float | None = None, KepMag: float | None = None, KIC=None, *, x: Series | None = None, cache={})[source]#

Compare the power spectral density (PSD) of a red giant derived from the default NNPredictor model and the scaling relations, returning a Bokeh figure.

Parameters:
  • M (float, optional) – Stellar mass in solar units. Default is None.

  • R (float, optional) – Stellar radius in solar units. Default is None.

  • Teff (float, optional) – Effective temperature of the star in Kelvin. Default is None.

  • FeH (float, optional) – Metallicity of the star ([Fe/H]). Default is None.

  • phase (float, optional) – Evolutionary phase of the star. Default is None.

  • KepMag (float, optional) – Kepler magnitude of the star. Default is None.

  • KIC (int, optional) – Kepler Input Catalog (KIC) identifier for the star. Default is None.

  • x (pd.Series, optional) – A pandas Series containing the stellar parameters (M, R, Teff, FeH, phase, KepMag). If provided, individual parameters should not be passed. Default is None.

Returns:

A Bokeh figure containing the PSD plots for the star, including: * PSD predicted using scaling relations. * PSD predicted using a neural network. * The true PSD (if KIC is provided). * A vertical line indicating the predicted nu_max value.

Return type:

bokeh.plotting.figure