l20models

The l20models module contains the model used to compute the l=0 mode frequencies. This currently only contains the asymptotic for p-modes.

class pbjam.l20models.Asyl20model(f, s, obs, addPriors, N_p, PCAsamples, PCAdims, vis={'V20': 0.71}, priorPath=None)[source]

A class for constructing the l20 model using the asymptotic relation for p-modes.

Parameters:
  • f (array-like) – The frequency array of the spectrum.

  • s (array-like) – The values of the power density spectrum.

  • obs (dict) – Dictionary of observational inputs.

  • addPriors (dict, optional) – Additional priors to be added. Default is an empty dictionary.

  • N_p (int, optional) – Number of radial orders to use for mode identification. Default is 7.

  • PCAsamples (int) – Number of samples for PCA.

  • PCAdims (int) – Number of dimensions for PCA.

  • vis (dict, optional) – Dictionary of visibility ratios for mode power given as V_{l}/V_{l=0}. Default is {‘V20’: 0.71}.

  • priorPath (str, optional) – Path to prior information. If None, assumes it is in the pbjam/data directory.

Nyquist

Nyquist frequency, defined as the highest frequency in f.

Type:

float

modelParLabels

Labels for model parameters.

Type:

list

log_obs

Logarithms of the observational data.

Type:

dict

background

Background model class instance for the frequency data.

Type:

bkgModel

ndims

Number of parameters in the model.

Type:

int

ell

Array of angular degrees of the modes (l=0 and l=2).

Type:

ndarray

emm

Array of azimuthal orders of modes (fixed at m=0 but this may change in the future).

Type:

ndarray

add20Pairs(d02, mode_width, nurot_e, inc, **kwargs)[source]

Adds l=2,0 mode pairs to the spectrum.

The mode heights are defined in terms of the SNR of the modes. The resulting model should therefore be multipled onto a background to get a correct spectrum model.

Parameters:
  • d02 (float) – The frequency separation between l=0 and l=2 modes.

  • mode_width (float) – The width of the modes.

  • nurot_e (float) – The envelope rotation frequency.

  • inc (float) – The inclination angle.

  • **kwargs (dict) – Additional keyword arguments for the asymptotic frequency calculation and envelope functions.

Returns:

  • modes (ndarray) – Spectrum model of the combined l=2,0 mode pairs.

  • nu0_p (ndarray) – The frequencies of the l=0 modes.

  • n_p (ndarray) – The radial order of the modes.

asymptotic_nu_p(numax, dnu, eps_p, alpha_p, **kwargs)[source]

Compute the l=0 mode frequencies from the asymptotic relation for p-modes

Parameters:
  • numax (float) – Frequency of maximum power of the p-mode envelope (muHz).

  • dnu (float) – Large separation of l=0 modes (muHz).

  • eps_p (float) – Epsilon phase term in asymptotic relation (unitless).

  • alpha_p (float) – Curvature factor of l=0 ridge (second order term, unitless).

Returns:

nu0s – Array of l=0 mode frequencies from the asymptotic relation (muHz).

Return type:

ndarray

model(thetaU)[source]

Computes the model spectrum by combining the l20 mode pairs and background components.

Notes

The l20 model is defined based on the SNR ratio of the modes, and so is multiplied onto the background model (instead of being added as is usually the case.)

Parameters:

thetaU (dict) – A dictionary of model parameters.

Returns:

mod – The computed model spectrum.

Return type:

ndarray

parseSamples(smp, Nmax=5000)[source]

Parses the samples to extract and organize the model parameters.

Attempts to include at most N samples from the model, but will default to the actual number of samples of the model parameters if it’s less than N.

The resulting dictionary contains some global parameters, ell, enn, emm etc. and two dictionaries, one containing the samples drawn and one with their summary statistics.

Samples and summary statistics are also included for the mode height, width and frequencies.

Parameters:
  • smp (dict) – A dictionary of sampled parameters.

  • Nmax (int, optional) – Maximum number of samples to include. Default is 5000.

Returns:

result – A dictionary containing parsed and organized model parameters.

Return type:

dict

setPriors()[source]

Assigns the priors attribute, which is a dictionary containing class instances of prior distributions for the different model parameters. Each must have ppf, pdf, logpdf and cdf as callable methods.

The latent parameters are assigned initially followed by any priors that might be manually specified in addPriors.

setupDR()[source]

Sets up the latent parameters as distribution class instances with callable ppf, pdf, logpdf and cdf methods.

Also assigns the projection functions for the dimensionality reduction to transform between the latent and model parameter spaces.

Parameters included in the addPriors argument are not included in the PCA dimensionality reduction.

Each latent parameter is assigned a parameter label theta_i.

unpackParams(theta)[source]

Put the parameters in theta in a dictionary.

Parameters:

theta (array) – Array of parameters drawn from the posterior distribution.

Returns:

thetaU – The unpacked parameters.

Return type:

dict