core

The PBjam core module contains the session and star classes which take care of many of the parts of setting up a peakbagging pipeline. This is meant to be a high-level interface with the more detailed methods that PBjam makes use of and so may not be the best choice if constructing a custom pipeline. In such cases see the modeID and peakbag classes.

class pbjam.core.session(name, obs, timeseries=None, spectrum=None, lk_kwargs={}, outpath=None, downloadDir=None)[source]

Main class used to initiate peakbagging for several stars.

Use this class to initialize a star class instance for one or more targets. Once initialized, calling the session class instance will execute a complete peakbagging run.

The observational constraints, such numax, dnu, teff, bp_rp, must be provided through keyword entries in a dictionary, which is then passed via the obs argument when initializing the session class.

Unless you provide the time series or spectrum, PBjam will download it. In which case it will do some rudimentary reduction, like removing outliers, removing NaN values and running a median filter through the light curve, with a width appropriate for the provided numax.

Parameters:
  • name (str) – Target name, most commonly used identifiers can be used if you want PBjam to download the data (KIC, TIC, HD, Bayer etc.). If you provide data yourself the name can be any string.

  • obs (dict) – Dictionary of observational inputs: numax, dnu, teff, bp_rp.

  • timeseries (object, optional) – Timeseries input. Leave as None for PBjam to download it automatically. Otherwise, arrays of shape (2,N).

  • spectrum (object, optional) – Spectrum input. Leave as None for PBjam to use Timeseries to compute it for you. Otherwise, arrays of shape (2,N).

  • lk_kwargs (dict, optional) – Arguments passed to lightkurve to download the time series.

  • outpath (str, optional) – Path to store the plots and results for the various stages of the peakbagging process.

  • downloadDir (str, optional) – Directory to cache lightkurve downloads. Lightkurve will place the fits files in the default lightkurve cache path in your home directory.

class pbjam.core.star(name, f, s, obs, outpath=None, **kwargs)[source]

Main class used to initiate peakbagging for a single stars.

Use this class to initialize a star class instance for one target. Once initialized, calling the star class instance will execute a complete peakbagging run.

The observational constraints, such numax, dnu, teff, bp_rp, must be provided through keyword entries in a dictionary, which is then passed via the obs argument when initializing the session class.

The star class only accepts a power density spectrum in the form of a list of frequency bins ‘f’ and power density ‘s’.

Parameters:
  • name (str) – Target name, most commonly used identifiers can be used if you want PBjam to download the data (KIC, TIC, HD, Bayer etc.). If you provide data yourself the name can be any string.

  • f (array-like) – Frequency bins of the power density spectrum.

  • s (array-like) – Power density spectrum with the same shape as ‘f’.

  • obs (dict) – Dictionary of observational inputs: numax, dnu, teff, bp_rp.

  • outpath (str, optional) – Path to store the plots and results for the various stages of the peakbagging process. Default is to output to the working directory.

  • kwargs (dict) – Dictionary of additional keyword arguments for either modeID or peakbag.

runModeID(modeID_kwargs={})[source]

Run the mode identification process using the provided or default keyword arguments.

This method creates a modeID instance and executes it with the arguments provided in modeID_kwargs or from the current object’s attributes. If priorpath is not specified, it fetches the path to the prior file.

Parameters:

modeID_kwargs (dict, optional) – Dictionary of additional keyword arguments to update or override the current object’s attributes when initializing the modeID instance. Default is an empty dictionary.

Raises:

KeyError – If required parameters for mode identification are missing.

runPeakbag(peakbag_kwargs={})[source]

Run the peakbagging process using the provided or default keyword arguments.

This method creates a peakbag instance and executes it with the arguments provided in peakbag_kwargs or from the current object’s attributes. It uses mode identification results to set missing parameters if necessary.

Parameters:

peakbag_kwargs (dict, optional) – Dictionary of additional keyword arguments to update or override the current object’s attributes when initializing the peakbag instance. Default is an empty dictionary.