API Reference
Core Functions
- compute_amdk(m, e, di, a)[source]
Compute the angular momentum deficit (AMD) for a planet in a system or for multiple planets.
- Parameters:
m (float, np.array) – Mass of the planet.
e (float, np.array) – Eccentricity of the planet’s orbit.
di (float, np.array) – Relative angle (inclination or obliquity) of the planet’s orbit in degrees w.r.t. a reference (e.g. the most massive planet in the system).
a (float, np.array) – Semi-major axis of the planet’s orbit.
- Returns:
amdk – Angular momentum deficit.
- Return type:
- compute_namd(amdk, m, sqrt_a)[source]
Compute the normalized angular momentum deficit (NAMD) for a given system.
- Parameters:
amdk (np.array) – Angular momentum deficit for the planets in a system.
m (np.array) – Mass of the planets in the system
sqrt_a (np.array) – Square root of the semi-major axis of the planets in the system
- Returns:
namd – Normalized angular momentum deficit.
- Return type:
Data Management
Calculation Tools
- solve_a_rs(sma, rstar, ars)[source]
Solve semi-major axis – stellar radius system of equations.
- Parameters:
sma (Float) – Orbital semi-major axis (AU).
rstar (Float) – Stellar radius (r_sun).
ars (Float) – sma–rstar ratio.
- solve_rprs(rplanet, rstar, rprs)[source]
Solve planet radius – stellar radius system of equations.
- Parameters:
rplanet (Float) – Planet radius (r_earth).
rstar (Float) – Stellar radius (r_sun).
rprs (Float) – Planet–star radius ratio.
- solve_a_period(period, sma, mstar)[source]
Solve period-sma-mstar system of equations.
- Parameters:
period (Float) – Orbital period (days).
sma (Float) – Orbital semi-major axis (AU).
mstar (Float) – Stellar mass (m_sun).
- solve_relincl(row, df)[source]
Computes the relative inclination of a planet with respect to the most massive planet in the same system.
- Parameters:
row (pandas.Series) – A row from the planet table.
df (pandas.DataFrame) – The planet table.
- Returns:
A pandas Series containing the relative inclination and the associated uncertainties.
- Return type:
pandas.Series
- solve_amdk(row, kind)[source]
Wrapper of the function compute_amdk to compute the angular momentum deficit (AMD) for a planet (or planets) in a system.
- Parameters:
row (pandas.Series) – A row from the planet table.
kind (str) – Which type of AMD to compute. One of ‘rel’ (relative, using the relative inclination) or ‘abs’ (absolute, using the obliquity).
- Returns:
A pandas Series containing the angular momentum deficit and the associated mass and sqrt of the semi-major axis.
- Return type:
pandas.Series
- solve_namd(host, kind)[source]
Wrapper of the functions solve_amdk and compute_namd to compute the normalized angular momentum deficit (NAMD) for a given system.
- Parameters:
host (pandas.DataFrame) – A DataFrame containing the planet table.
kind (str) – Which type of NAMD to compute. One of ‘rel’ (relative, using the relative inclination) or ‘abs’ (absolute, using the obliquity).
- Returns:
A pandas Series containing the normalized angular momentum deficit.
- Return type:
pandas.Series
- solve_amdk_mc(row, kind, Npt, threshold, use_trunc_normal=True)[source]
Compute the absolute or relative angular momentum deficit (AMD) for a given planet using a Monte Carlo approach.
- Parameters:
row (pandas.Series) – A row from the planet table.
kind (str) – Which type of AMD to compute. One of ‘rel’ (relative, using the relative inclination) or ‘abs’ (absolute, using the obliquity).
Npt (int) – Number of Monte Carlo samples.
threshold (int) – Minimum number of valid samples required.
use_trunc_normal (bool) – If True, use a truncated normal distribution to sample the parameters. If False, use a normal distribution with rejection sampling.
- Returns:
A pandas Series containing the absolute or relative AMD, the associated mass and sqrt of the semi-major axis.
- Return type:
pandas.Series
- solve_namd_mc(host, kind, Npt, threshold, use_trunc_normal, full=False)[source]
Wrapper of the functions solve_amdk_mc and compute_namd to compute the normalized angular momentum deficit (NAMD) for a given system using a Monte Carlo approach.
- Parameters:
host (pandas.DataFrame) – A DataFrame containing the system table.
kind (str) – Which type of NAMD to compute. One of ‘rel’ (relative, using the relative inclination) or ‘abs’ (absolute, using the obliquity).
Npt (int) – Number of Monte Carlo samples.
threshold (int) – Minimum number of valid samples required.
use_trunc_normal (bool) – If True, use a truncated normal distribution to sample the parameters. If False, use a normal distribution with rejection sampling.
full (bool) – If True, return the full array of NAMD values. Otherwise, return only the 16th, 50th and 84th percentiles.
- Returns:
A pandas Series containing the normalized angular momentum deficit results.
- Return type:
pandas.Series
Logging
This module was directly inspired by the log module in the PAOS package.
- addLogFile(fname='exonamd.log')[source]
Adds a new log file for logging.
- Parameters:
fname (str, optional) – The filename for the log file. Defaults to ‘exonamd.log’.
- Return type:
None
- setLogLevel(level='INFO')[source]
Configures the logging level for the logger.
- Parameters:
level (str, optional) – The logging level to set. Defaults to ‘INFO’. Possible values include ‘DEBUG’, ‘INFO’, ‘WARNING’, ‘ERROR’, ‘CRITICAL’, etc.
- Return type:
None
Visualization
- simple_plot(df, kind, title='', which='namd', ylabel='Frequency', xlabel=None, scale='linear', bins=50, out_path=None, figsize=None, xlim=(None, None))[source]
- pop_plot(df, kind, title='', which='namd', yscale='log', xoffs=0.3, out_path=None, replace_nan=False)[source]
- plot_host_namd(df, hostname, kind, Npt=100000, threshold=1000, out_path=None)[source]
Plot the NAMD for a given host.
- Parameters:
df (pd.DataFrame) – The NAMD database. If None, the function reloads the database from disk.
hostname (str) – The hostname to plot.
kind (str) – Which type of NAMD to plot. One of ‘rel’ (relative NAMD) or ‘abs’ (absolute NAMD).
Npt (int) – Number of Monte Carlo samples.
threshold (int) – Minimum number of valid samples required.
out_path (str) –
- Return type:
None