# Utility Functions¶

Calculate Msini

Calculate Msini for a given K, P, stellar mass, and e

Parameters: K (float) – Doppler semi-amplitude [m/s] P (float) – Orbital period [days] Mtotal (float) – Mass of star + mass of planet [Msun] e (float) – eccentricity = (Msini_units) – Msini [units = Msini_units] float

Convert datetime object to JD”

Parameters: date (datetime.datetime) – date to convert Julian date float
Parameters: mass (float) – mass, units = MR_units radius (float) – radius, units = MR_units MR_units – (optional) units of mass and radius. Must be ‘earth’, or ‘jupiter’ (default ‘earth’). density (g/cc)

Calculate median, 15.9, and 84.1 percentile values for a given vector.”

Parameters: vec (array) – vector, usually an MCMC chain for one parameter angular (bool) – (optional) Is this an angular parameter? if True vec should be in radians. This will perform some checks to ensure proper boundary wrapping. 50, 15.9 and 84.1 percentiles tuple

Convert JD to datetime.datetime object

Parameters: jd (float) – Julian date calendar date datetime.datetime

Compute Doppler semi-amplitude

Parameters: Msini (float) – mass of planet [Mjup] P (float) – Orbital period [days] Mtotal (float) – Mass of star + mass of planet [Msun] e (float) – eccentricity Msini_units (string) – Units of returned Msini. Must be ‘earth’, or ‘jupiter’ (default ‘jupiter’). Doppler semi-amplitude [m/s]

Format values with errors into an equal number of signficant figures.

Parameters: med (float) – median value errlow (float) – lower errorbar errhigh (float) – upper errorbar (med,errlow,errhigh) rounded to the lowest number of significant figures tuple