Auxiliary Functions

Set of auxiliary functions for the GP_solar and MCMC codes.

src.magpy_rv.auxiliary.hparam_names(kernel_name, plotting=True)[source]

Function to get kernel hyperparameters names

Parameters
  • kernel_name (string) – Name of the kernel

  • plotting (bool, optional) – If True, return names in format for plots, if False, return names in standard format

Returns

hparam_names – Name of hyperparameters

Return type

list of strings

src.magpy_rv.auxiliary.mass_calc(model_param, Mstar, earth_mass=False)[source]
Parameters
  • model_param (2d array) – Array of all the model parameter in the mcmc

  • Mstar (float) – Stellar mass in solar masses

  • earth_mass (bool, optional) – True returns the planet mass in Earth masses, False returns the planet mass in Jupiter masses

Returns

  • Mpl_sini (float) – Minimum mass of the planet in Jupiter masses

  • Mpl_sini_e (float) – Minimum mass of the planet in Earth masses

src.magpy_rv.auxiliary.model_param_names(model_list, SkCk=False, plotting=True)[source]

Function to get model names

Parameters
  • model_name (string or list) – Name of the model, or list of names of the models

  • SkCk (boolean, optional) – If True, return the names of the Sk and Ck parameters. Default is False

  • plotting (bool, optional) – If True, return names in format for plots, if False, return names in standard format

Returns

param_names – Name of parameters

Return type

list of strings

src.magpy_rv.auxiliary.periastron_to_transit(t_0, P, ecc, omega)[source]
Parameters
  • t_0 (float) – Time of periastron

  • P (float) – Period of the planet

  • ecc (float) – Eccentricity of orbit

  • omega (float) – Argument of periastron

Returns

t_tr – Value of the time of transit (start of transit)

Return type

float

src.magpy_rv.auxiliary.phasefold(time, period, t0, zerocentre=True, returnepoch=False)[source]

Function to phase-fold data

Parameters
  • time (array, float) – Time array

  • period (float) – Period of the orbit

  • t0 (float) – Time of periastron passage

  • zerocentre (boolean) – If True, the time array is shifted to the zero-centre. Default is True

  • returnepoch (boolean) – Return the epoch of the phase-folded data. Default is False

Returns

  • true_phase (array, floats) – Phase array

  • epoch (array, floats, optional) – Epoch of the orbit at all points. Starting from 0. Only returned if returnepoch is True.

src.magpy_rv.auxiliary.printProgressBar(iteration, total, prefix='Progress: ', suffix='Complete', decimals=1, length=100, fill='█', printEnd='\r')[source]

Call in a loop to create terminal progress bar

Parameters
  • iteration (integer) – Current iteration

  • total (integer) – Total expected iterations

  • prefix (string, optional) – String before progress bar

  • suffix (string, optional) – String after percentage

  • decimals (integer, optional) – Number of decimals in the percetage

  • length (integer, optional) – Character lenght of the progress bar

  • fill (string, optional) – Bar fill character

  • printEnd (string, optional) – End character (e.g. carriage returns on same line or new line)

src.magpy_rv.auxiliary.to_SkCk(ecc, omega, ecc_err=None, omega_err=None)[source]
Parameters
  • ecc (float) – Eccentricity

  • omega (float, radians) – Angle of periastron

  • ecc_err (float, optional) – Error on the eccentricity, defaults to None

  • omega_err (float, optional) – Error on angle of periastron, defaults to None

Returns

  • Sk (float) – Sk value

  • Ck (float) – Ck value

  • Sk_err (float) – Error on Sk

  • Ck_err (float) – Error on Ck

src.magpy_rv.auxiliary.to_ecc(Sk, Ck, errSk=None, errCk=None)[source]
Parameters
  • Sk (float) – sqr(e)sin(omega)

  • Ck (float) – sqr()cos(omega)

  • errSk (float, optional) – error on Sk. Default None

  • errCk (float, optional) – error on Ck. Default None

Returns

  • ecc (float) – Eccentricity

  • omega (float, radians) – Angle of periastron

  • ecc_err (float, optional) – Error on the eccentricity

  • omega_err (float, optional) – Error on angle of periastron

src.magpy_rv.auxiliary.transit_to_periastron(t_tr, P, ecc, omega)[source]
Parameters
  • t_tr (float) – Value of the time of transit (start of transit)

  • P (float) – Period of the planet

  • ecc (float) – Eccentricity of orbit

  • omega (float) – Argument of periastron

Returns

t_0 – Time of periastron

Return type

float

src.magpy_rv.auxiliary.transpose(lst)[source]
Parameters

lst (list) – List you want to transpose

Returns

trans2 – Transposed list

Return type

list