persephone.inversion#

The inversion submodule provides seismic inversion tools.

Rotational inversion#

persephone.inversion.invert_parametric_rotation_profile(modes, input_param, eigenfunction_directory='.', template_filename=None, prescription='tanh', nwalkers=32, nsteps=1000, discard=500, thin=1, filename_chain=None, parallelise=False, progress=True, existing_chain='read', filename_cornerplot=None, bins=10, figsize=(6, 6), custom_rotation_profile=None, formatted_label=None, **kwargs)#

Invert a parametric rotation profile using the constraints from a set of observed splittings.

Parameters:
  • modes (ndarray) – Mode information relevant for the rotation inversion. One row correspond to a mode, columns must be in this order: order n, degree l, azimuthal number m, frequency, uncertainty on frequency, rotational splittings, uncertainty on rotational splittings.

  • input_param (dict) – Input param is a dictionary with the name of the parameters to fit and the corresponding initial value, lower bound and upper bound, and fitting flag (True if the parameter must be fitted, False otherwise).

  • eigenfunction_directory (str or Path instance) – Directory where the function will read the mode eigenfunctions in order to compute the kernels. Optional, default ".".

  • template_filename (str) – Name template of the GYRE detail files to read. Optional, default None.

  • prescription (str) – Prescription for parametric rotation profile to consider. Can be either "tanh", "gaussian", or "custom". If custom is selected, custom_rotation_profile has to be provided as a function. Optional, default "tanh"

  • nwalkers (int) – Number of walkers for the emcee sampler.

  • nsteps (int) – Number of steps for the emcee sampler.

  • discard (int) – Number of discarded steps for the emcee sampler.

  • thin (int) – Thin factor the emcee sampler.

  • filename_chain (str or Path instance) – Name under which the sampled chain will be saved.

  • parallelise (bool) – If set to True, the sampling will be run in parallel.

  • progress (bool) – Whether to display or not the sampling progression.

  • existing_chain (str) – Determine how the function will deal with existing chains under filename_chain. Can be "read", "sample", or "reset".

  • filename_cornerplot (str or Path instance) – If given, the cornerplot corresponding to the chain will be saved under this name.

  • bins (int) – Number of bins in the cornerplot histogram.

  • figsize (tuple) – Figure size for the cornerplot.

  • custom_rotation_profile (fun) – Function specifying the custom rotation profile to use for the parameter exploration. The first argument of the function has to be the stellar radius r, while the parameter must be ordered the same way as the keys of the input_param dictionary provided as input.

  • formatted_label (array-like) – Formatted label to display on the corner plot when using a custom rotation profile. If not provided, the input_param keys will be used.

Returns:

A tuple containg the emcee sampler, the fitted parameters and their uncertainty, the kernels (given as a tuple of three dictionary, the first one containing the radius arrays, the second one the beta_nl coefficients and the third one the K_nl kernels), and the cornerplot figure (this will be None if save_cornerplot is False).

Return type:

tuple

persephone.inversion.compute_rotation_profile(r, param, prescription='tanh', custom_rotation_profile=None)#

Compute rotation profile from the provided parameters.

persephone.inversion.compute_splittings_set(param, dict_r, dict_beta_nl, dict_K_nl, prescription='tanh', custom_rotation_profile=None)#

For each mode, compute the set of theoretical splittings expected from a given rotation profile.