star

The `star’ class is the core of PBjam and refers to a single target that is to be peakbagged. Each `star’ instance is assigned an ID and physical input parameters, as well as a time series or power spectrum.

The different steps in the peakbagging process are then passed the `star’ instance, updating it with the results of each step. The outputs of each step are stored in a dedicated directory created with the star ID.

The `session’ class wraps one or more star class instances and peakbags them all sequentially. The recommended use of PBjam is the use the `session’ class, and only use the `star’ class for more granular control of the peakbagging process.

pbjam.star.get_bp_rp(ID)[source]

Search online for bp_rp values based on ID.

First a check is made to see if the target is a TIC number, in which case the TIC will be queried, since this is already cross-matched with Gaia DR2.

If it is not a TIC number, Simbad is queried to identify a possible Gaia source ID.

As a last resort MAST is queried to provide the target coordinates, after which a Gaia query is launched to find the closest target. The default search radius is 20” around the provided coordinates.

Parameters:ID (str) – Target identifier to search for.
Returns:bp_rp – Gaia bp-rp value for the target. Is nan if no result is found or the queries failed.
Return type:float
class pbjam.star.star(ID, pg, numax, dnu, teff=[None, None], bp_rp=[None, None], path=None, prior_file=None)[source]

Class for each star to be peakbagged

Additional attributes are added for each step of the peakbagging process

Note spectrum is flattened (background divided out.)

Examples

Peakbag using the star class. Note that the star class only takes Lightkurve periodograms, pg, as spectrum input.

>>> st = pbjam.star(ID='KIC4448777', pg=pg, numax=[220.0, 3.0],
                       dnu=[16.97, 0.01], teff=[4750, 100],
                       bp_rp = [1.34, 0.01])
>>> st(make_plots=True)
Parameters:
  • ID (string, int) – Target identifier. If custom timeseries/periodogram is provided, it must be resolvable by LightKurve (KIC, TIC, EPIC, HD, etc.).
  • pg (lightkurve.periodogram.Periodogram object) – A lightkurve periodogram object containing frequencies in units of microhertz and power (in arbitrary units).
  • numax (list) – List of the form [numax, numax_error].
  • dnu (list) – List of the form [dnu, dnu_error].
  • teff (list) – List of the form [teff, teff_error].
  • bp_rp (list) – List of the form [bp_rp, bp_rp_error].
  • path (str, optional) – The path at which to store output. If no path is set but make_plots is True, output will be saved in the current working directory. Default is the current working directory.
  • prior_file (str, optional) – Path to the csv file containing the prior data. Default is pbjam/data/prior_data.csv
f

Array of power spectrum frequencies

Type:array
s

power spectrum

Type:array
run_asy_peakbag(norders, make_plots=False, store_chains=False, method='emcee', developer_mode=False)[source]

Run all steps involving asy_peakbag.

Performs a fit of the asymptotic relation to the spectrum (l=2,0 only), using initial guesses and prior for the fit parameters from KDE.

Parameters:
  • norders (int) – Number of orders to include in the fits.
  • make_plots (bool, optional) – Whether or not to produce plots of the results. Default is False.
  • store_chains (bool, optional) – Whether or not to store posterior samples on disk. Default is False.
  • method (string) – Method to be used for sampling the posterior. Options are ‘emcee’ or ‘cpnest. Default method is ‘emcee’ that will call emcee, alternative is ‘cpnest’ to call nested sampling with CPnest.
  • developer_mode (bool) – Run asy_peakbag in developer mode. Currently just retains the input value of dnu and numax as priors, for the purposes of expanding the prior sample. Important: This is not good practice for getting science results!
run_kde(bw_fac=1.0, make_plots=False, store_chains=False)[source]

Run all steps involving KDE.

Starts by creating a KDE based on the prior data sample. Then samples this KDE for initial starting positions for asy_peakbag.

Parameters:
  • bw_fac (float) – Scaling factor for the KDE bandwidth. By default the bandwidth is automatically set, but may be scaled to adjust for sparsity of the prior sample.
  • make_plots (bool, optional) – Whether or not to produce plots of the results. Default is False.
  • store_chains (bool, optional) – Whether or not to store posterior samples on disk. Default is False.
run_peakbag(model_type='simple', tune=1500, nthreads=1, make_plots=False, store_chains=False)[source]

Run all steps involving peakbag.

Performs fit using simple Lorentzian profile pairs to subsections of the power spectrum, based on results from asy_peakbag.

Parameters:
  • model_type (str) – Can be either ‘simple’ or ‘model_gp’ which sets the type of mode width model. Defaults is ‘simple’.
  • tune (int, optional) – Numer of tuning steps passed to pm.sample. Default is 1500.
  • nthreads (int, optional.) – Number of processes to spin up in pymc3. Default is 1.
  • make_plots (bool, optional.) – Whether or not to produce plots of the results. Default is False.
  • store_chains (bool, optional) – Whether or not to store posterior samples on disk. Default is False.