API documentation for kima¶
Data¶
Most analyses will start by using the RVData class to load
data from a set of files or arrays. Gaia epoch astrometry can also be read with
the GAIAdata class.
Example:¶
- With
skip=1, the first line of the file will be ignored. - A very simple plot of the dataset.
kima.RVData API
Load and store RV data
init(self, filenames: collections.abc.Sequence[str], units: str = 'ms', skip: int = 0, max_rows: int = 0, delimiter: str = ' \t,', indicators: collections.abc.Sequence[str] = [], double_lined: bool = False) -> None init(self, filename: str, units: str = 'ms', skip: int = 0, max_rows: int = 0, multi: bool = False, delimiter: str = ' \t,', indicators: collections.abc.Sequence[str] = [], double_lined: bool = False) -> None init(self, t: collections.abc.Sequence[float], y: collections.abc.Sequence[float], sig: collections.abc.Sequence[float], units: str = 'ms', instrument: str = '') -> None init(self, t: collections.abc.Sequence[collections.abc.Sequence[float]], y: collections.abc.Sequence[collections.abc.Sequence[float]], sig: collections.abc.Sequence[collections.abc.Sequence[float]], units: str = 'ms', instruments: collections.abc.Sequence[str] = []) -> None
Overloaded function.
__init__(self, filenames: collections.abc.Sequence[str], units: str = 'ms', skip: int = 0, max_rows: int = 0, delimiter: str = ' \t,', indicators: collections.abc.Sequence[str] = [], double_lined: bool = False) -> None
Load RV data from a list of files
__init__(self, filename: str, units: str = 'ms', skip: int = 0, max_rows: int = 0, multi: bool = False, delimiter: str = ' \t,', indicators: collections.abc.Sequence[str] = [], double_lined: bool = False) -> None
Load RV data from a file
__init__(self, t: collections.abc.Sequence[float], y: collections.abc.Sequence[float], sig: collections.abc.Sequence[float], units: str = 'ms', instrument: str = '') -> None
Load RV data from arrays
__init__(self, t: collections.abc.Sequence[collections.abc.Sequence[float]], y: collections.abc.Sequence[collections.abc.Sequence[float]], sig: collections.abc.Sequence[collections.abc.Sequence[float]], units: str = 'ms', instruments: collections.abc.Sequence[str] = []) -> None
Load RV data from arrays, for multiple instruments
M0_epoch
property
¶
reference epoch for the mean anomaly
N
property
¶
Total number of observations
actind
property
¶
Activity indicators
datafile
property
¶
The file name
datafiles
property
¶
The list of file names
double_lined
property
¶
if the data is for a double-lined binary
indicator_names
property
¶
names of activity indicators
instrument
property
¶
instrument name
instruments
property
¶
instrument names
multi
property
¶
Data comes from multiple instruments
normalized_actind
property
¶
Activity indicators normalized to [0,1]
obsi
property
¶
The instrument identifier
sig
property
¶
The observed RV uncertainties
skip
property
¶
Lines skipped when reading data
t
property
¶
The times of observations
units
property
¶
Units of the RVs and uncertainties
y
property
¶
The observed radial velocities
get_RV_max()
method descriptor
¶
get_RV_max(self) -> float
Get the maximum RV
get_RV_mean()
method descriptor
¶
get_RV_mean(self) -> float
Get the mean RV
get_RV_min()
method descriptor
¶
get_RV_min(self) -> float
Get the minimum RV
get_RV_span()
method descriptor
¶
get_RV_span(self) -> float
Get the RV span
get_RV_std()
method descriptor
¶
get_RV_std(self) -> float
Get the standard deviation of RVs
get_RV_var()
method descriptor
¶
get_RV_var(self) -> float
Get the variance of RVs
get_max_RV_span()
method descriptor
¶
get_max_RV_span(self) -> float
Get the maximum RV span of individual instruments
get_t_max()
method descriptor
¶
get_t_max(self) -> float
Get the maximum time
get_t_middle()
method descriptor
¶
get_t_middle(self) -> float
Get the middle time
get_t_min()
method descriptor
¶
get_t_min(self) -> float
Get the minimum time
get_timespan()
method descriptor
¶
get_timespan(self) -> float
Get the timespan
get_trend_magnitude()
method descriptor
¶
get_trend_magnitude(self, arg0: int, arg1: int, /) -> int
Order of magnitude of trend coefficient (of degree) given the data
load()
method descriptor
¶
load(self, filename: str, units: str, skip: int, max_rows: int, delimiter: str, indicators: collections.abc.Sequence[str]) -> None
Load RV data from a tab/space separated file with columns
Args: filename (str): the name of the file untis (str): units of the RVs and errors, either "kms" or "ms" skip (int): number of lines to skip in the beginning of the file (default = 2) indicators (list[str]): nodoc
topslope()
method descriptor
¶
topslope(self) -> float
Get the maximum slope allowed by the data
kima.GAIAdata API
Models¶
We can then create one of the several models currently implemented
Example:¶
kima.RVmodel API
RVmodel()
¶
init(self, fix: bool, npmax: int, data: kima.Data.RVData) -> None
Implements a sum-of-Keplerians model where the number of Keplerians can be free.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fix
|
bool
|
whether the number of Keplerians should be fixed |
required |
npmax
|
int
|
maximum number of Keplerians |
required |
data
|
RVData
|
the RV data |
required |
Cprior
property
¶
Prior for the systemic velocity
Jprior
property
¶
Prior for the extra white noise (jitter)
KO_Kprior
property
¶
Prior for KO semi-amplitude
KO_Pprior
property
¶
Prior for KO orbital period
KO_eprior
property
¶
Prior for KO eccentricity
KO_phiprior
property
¶
Prior for KO mean anomaly(ies)
KO_wprior
property
¶
Prior for KO argument of periastron
TR_Kprior
property
¶
Prior for TR semi-amplitude
TR_Pprior
property
¶
Prior for TR orbital period
TR_Tcprior
property
¶
Prior for TR mean anomaly(ies)
TR_eprior
property
¶
Prior for TR eccentricity
TR_wprior
property
¶
Prior for TR argument of periastron
beta_prior
property
¶
(Common) prior for the activity indicator coefficients
conditional
property
¶
(self) -> kima.RVmodel.KeplerianConditionalPrior
cubic_prior
property
¶
Prior for the cubic coefficient of the trend
data
property
¶
the data
degree
property
¶
degree of the polynomial trend
directory
property
¶
directory where the model ran
enforce_stability
property
¶
whether to enforce AMD-stability
fix
property
¶
whether the number of Keplerians is fixed
indicator_correlations
property
¶
include in the model linear correlations with indicators
individual_offset_prior
property
¶
Common prior for the between-instrument offsets
jitter_propto_indicator
property
¶
docs
jitter_propto_indicator_index
property
¶
docs
known_object
property
¶
whether the model includes (better) known extra Keplerian curve(s)
n_known_object
property
¶
how many known objects
n_transiting_planet
property
¶
how many transiting planets
npmax
property
¶
maximum number of Keplerians
nu_prior
property
¶
Prior for the degrees of freedom of the Student-t likelihood
offsets_prior
property
¶
Common prior for the between-instrument offsets
quadr_prior
property
¶
Prior for the quadratic coefficient of the trend
slope_prior
property
¶
Prior for the slope
star_mass
property
¶
stellar mass [Msun]
stellar_jitter_prior
property
¶
Prior for the stellar jitter (common to all instruments)
studentt
property
¶
use a Student-t distribution for the likelihood (instead of Gaussian)
transiting_planet
property
¶
whether the model includes transiting planet(s)
trend
property
¶
whether the model includes a polynomial trend
set_known_object()
method descriptor
¶
set_known_object(self, arg: int, /) -> None
set_loguniform_prior_Np()
method descriptor
¶
set_loguniform_prior_Np(self) -> None
set_transiting_planet()
method descriptor
¶
set_transiting_planet(self, arg: int, /) -> None
kima.GPmodel API
GPmodel()
¶
init(self, fix: bool, npmax: int, data: kima.Data.RVData) -> None
Implements a model for the RVs with a sum-of-Keplerians plus a correlated noise component given by a Gaussian process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fix
|
bool
|
whether the number of Keplerians should be fixed |
required |
npmax
|
int
|
maximum number of Keplerians |
required |
data
|
RVData
|
the RV data |
required |
Cprior
property
¶
Prior for the systemic velocity
Jprior
property
¶
Prior for the extra white noise (jitter)
KO_Kprior
property
¶
Prior for KO semi-amplitude
KO_Pprior
property
¶
Prior for KO orbital period
KO_eprior
property
¶
Prior for KO eccentricity
KO_phiprior
property
¶
Prior for KO mean anomaly(ies)
KO_wprior
property
¶
Prior for KO argument of periastron
Q_prior
property
¶
Prior for Q, the quality factor in SHO kernels
TR_Kprior
property
¶
Prior for TR semi-amplitude
TR_Pprior
property
¶
Prior for TR orbital period
TR_Tcprior
property
¶
Prior for TR mean anomaly(ies)
TR_eprior
property
¶
Prior for TR eccentricity
TR_wprior
property
¶
Prior for TR argument of periastron
beta_prior
property
¶
(Common) prior for the activity indicator coefficients
conditional
property
¶
(self) -> kima.RVmodel.KeplerianConditionalPrior
cubic_prior
property
¶
Prior for the cubic coefficient of the trend
data
property
¶
the data
degree
property
¶
degree of the polynomial trend
directory
property
¶
directory where the model ran
enforce_stability
property
¶
whether to enforce AMD-stability
eta1_prior
property
¶
Prior for η1, the GP 'amplitude'
eta2_prior
property
¶
Prior for η2, the GP correlation timescale
eta3_prior
property
¶
Prior for η3, the GP period
eta4_prior
property
¶
Prior for η4, the recurrence timescale or (inverse) harmonic complexity
eta5_prior
property
¶
Prior for η5
eta6_prior
property
¶
Prior for η6
eta7_prior
property
¶
Prior for η7
fix
property
¶
whether the number of Keplerians is fixed
indicator_correlations
property
¶
include in the model linear correlations with indicators
individual_offset_prior
property
¶
Common prior for the between-instrument offsets
kernel
property
¶
GP kernel to use
known_object
property
¶
whether the model includes (better) known extra Keplerian curve(s)
magnetic_cycle_kernel
property
¶
whether to consider a (periodic) GP kernel for a magnetic cycle
n_known_object
property
¶
how many known objects
n_transiting_planet
property
¶
how many transiting planets
npmax
property
¶
maximum number of Keplerians
offsets_prior
property
¶
Common prior for the between-instrument offsets
quadr_prior
property
¶
Prior for the quadratic coefficient of the trend
slope_prior
property
¶
Prior for the slope
star_mass
property
¶
stellar mass [Msun]
transiting_planet
property
¶
whether the model includes transiting planet(s)
trend
property
¶
whether the model includes a polynomial trend
eta2_larger_eta3()
method descriptor
¶
eta2_larger_eta3(self, factor: float = 1.0) -> None
Constrain η2 to be larger than factor * η3
set_known_object()
method descriptor
¶
set_known_object(self, arg: int, /) -> None
set_transiting_planet()
method descriptor
¶
set_transiting_planet(self, arg: int, /) -> None
kima.RVFWHMmodel API
RVFWHMmodel()
¶
init(self, fix: bool, npmax: int, data: kima.Data.RVData) -> None
Implements a joint model for RVs and FWHM with a GP component for activity signals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fix
|
bool
|
whether the number of Keplerians should be fixed |
required |
npmax
|
int
|
maximum number of Keplerians |
required |
data
|
RVData
|
the RV data |
required |
Cfwhm_prior
property
¶
Prior for the 'systemic' FWHM
Cprior
property
¶
Prior for the systemic velocity
Jfwhm_prior
property
¶
Prior for the extra white noise (jitter) in the FWHM
Jprior
property
¶
Prior for the extra white noise (jitter)
KO_Kprior
property
¶
Prior for KO semi-amplitude
KO_Pprior
property
¶
Prior for KO orbital period
KO_eprior
property
¶
Prior for KO eccentricity
KO_phiprior
property
¶
Prior for KO mean anomaly(ies)
KO_wprior
property
¶
Prior for KO argument of periastron
TR_Kprior
property
¶
Prior for TR semi-amplitude
TR_Pprior
property
¶
Prior for TR orbital period
TR_Tcprior
property
¶
Prior for TR mean anomaly(ies)
TR_eprior
property
¶
Prior for TR eccentricity
TR_wprior
property
¶
Prior for TR argument of periastron
conditional
property
¶
(self) -> kima.RVmodel.KeplerianConditionalPrior
cubic_fwhm_prior
property
¶
Prior for the cubic coefficient of the trend in the FWHM (in the FWHM)
cubic_prior
property
¶
Prior for the cubic coefficient of the trend (in the RVs)
data
property
¶
the data
degree
property
¶
degree of the polynomial trend (in the RVs)
degree_fwhm
property
¶
degree of the polynomial trend (in the FWHM)
directory
property
¶
directory where the model ran
enforce_stability
property
¶
whether to enforce AMD-stability
eta1_fwhm_prior
property
¶
Prior for the GP 'amplitude' on the FWHM
eta1_prior
property
¶
Prior for the GP 'amplitude' on the RVs
eta2_fwhm_prior
property
¶
Prior for η2, the GP correlation timescale, on the FWHM
eta2_prior
property
¶
Prior for η2, the GP correlation timescale, on the RVs
eta3_fwhm_prior
property
¶
Prior for η3, the GP period, on the FWHM
eta3_prior
property
¶
Prior for η3, the GP period, on the RVs
eta4_fwhm_prior
property
¶
Prior for η4, the recurrence timescale or (inverse) harmonic complexity, on the FWHM
eta4_prior
property
¶
Prior for η4, the recurrence timescale or (inverse) harmonic complexity, on the RVs
fix
property
¶
whether the number of Keplerians is fixed
known_object
property
¶
whether the model includes (better) known extra Keplerian curve(s)
n_known_object
property
¶
how many known objects
n_transiting_planet
property
¶
how many transiting planets
npmax
property
¶
maximum number of Keplerians
quadr_fwhm_prior
property
¶
Prior for the quadratic coefficient of the trend in the FWHM (in the FWHM)
quadr_prior
property
¶
Prior for the quadratic coefficient of the trend (in the RVs)
share_eta2
property
¶
whether the η2 parameter is shared between RVs and FWHM
share_eta3
property
¶
whether the η3 parameter is shared between RVs and FWHM
share_eta4
property
¶
whether the η4 parameter is shared between RVs and FWHM
slope_fwhm_prior
property
¶
Prior for the slope in the FWHM (in the FWHM)
slope_prior
property
¶
Prior for the slope (in the RVs)
star_mass
property
¶
stellar mass [Msun]
transiting_planet
property
¶
whether the model includes transiting planet(s)
trend
property
¶
whether the model includes a polynomial trend (in the RVs)
trend_fwhm
property
¶
whether the model includes a polynomial trend (in the FWHM)
set_known_object()
method descriptor
¶
set_known_object(self, arg: int, /) -> None
set_transiting_planet()
method descriptor
¶
set_transiting_planet(self, arg: int, /) -> None
kima.BINARIESmodel API
BINARIESmodel()
¶
init(self, fix: bool, npmax: int, data: kima.Data.RVData) -> None
Implements a sum-of-Keplerians model where the number of Keplerians can be free. This model assumes white, uncorrelated noise. This modules is tailored for the analysis of stellar binaries through the known object mode (without it this defaults to the RVmodel) The binary can have one set of RVs or two (one on each star). This model adds apsidal precession as a free parameter and accounts for GR and Tidal effects on the radial velocities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fix
|
bool, default=True
|
whether the number of Keplerians should be fixed |
required |
npmax
|
int, default=0
|
maximum number of Keplerians |
required |
data
|
RVData
|
the RV data |
required |
Cprior
property
¶
Prior for the systemic velocity
Jprior
property
¶
Prior for the extra white noise (jitter)
KO_Kprior
property
¶
Prior for Semi-amplitude of Binary orbit (+other known objects)
KO_Pprior
property
¶
Prior for Period of Binary orbit (+other known objects)
KO_cosiprior
property
¶
Prior for cosine of the inclination of Binary orbit (+other known objects) to the line-of-sight
KO_eprior
property
¶
Prior for eccentricity of Binary orbit (+other known objects)
KO_phiprior
property
¶
Prior for phase of Binary orbit at the reference time (+other known objects)
KO_qprior
property
¶
Prior for mass ratio of Binary (+other known objects), used if double lined
KO_wdotprior
property
¶
Prior for apsidal precession rate of Binary orbit (+other known objects)
KO_wprior
property
¶
Prior for argument of periastron of Binary orbit (+other known objects)
binary_mass
property
¶
secondary mass [Msun]
binary_radius
property
¶
secondary radius [Rsun]
conditional
property
¶
(self) -> kima.RVmodel.KeplerianConditionalPrior
cubic_prior
property
¶
Prior for the cubic coefficient of the trend
degree
property
¶
degree of the polynomial trend
directory
property
¶
directory where the model ran
double_lined
property
¶
whether the data is for a double lined binary, and has two sets of RVs for each epoch
eclipsing
property
¶
whether binary is eclipsing and the inclination can be fixed to 90, defaults to true. If false, default prior is uniform in cosi
enforce_stability
property
¶
whether to enforce AMD-stability
fix
property
¶
whether the number of Keplerians is fixed
known_object
property
¶
whether to include (better) known extra Keplerian curve(s), should be true for BINARIESmodel
n_known_object
property
¶
how many known objects, should be >=1 for BINARIESmodel
nu_prior
property
¶
Prior for the degrees of freedom of the Student-t likelihood
offsets_prior
property
¶
Common prior for the between-instrument offsets
quadr_prior
property
¶
Prior for the quadratic coefficient of the trend
relativistic_correction
property
¶
whether to perform the GR correction
slope_prior
property
¶
Prior for the slope
star_mass
property
¶
primary mass [Msun]
star_radius
property
¶
primary radius [Rsun]
studentt
property
¶
use a Student-t distribution for the likelihood (instead of Gaussian)
tidal_correction
property
¶
whether to perform the tidal correction
trend
property
¶
whether the model includes a polynomial trend
TODO: kima.RVHGPMmodel API
kima.GAIAmodel API
GAIAmodel()
¶
init(self, fix: bool, npmax: int, data: kima.Data.GAIAdata) -> None
Analysis of Gaia epoch astrometry. Implements a sum-of-Keplerians model where the number of Keplerians can be free. This model assumes white, uncorrelated noise. Known objects are given priors for geometric elements, free planet search has the choice of geometric or Thiele-Innes elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fix
|
bool, default=True
|
whether the number of Keplerians should be fixed |
required |
npmax
|
int, default=0
|
maximum number of Keplerians |
required |
data
|
GAIAdata
|
the astrometric data |
required |
Jprior
property
¶
Prior for the extra white noise (jitter)
KO_Omegaprior
property
¶
Prior for KO longitude(s) of ascending node
KO_Pprior
property
¶
Prior for KO orbital period(s)
KO_a0prior
property
¶
Prior for KO photocentre semi-major-axis(es)
KO_cosiprior
property
¶
Prior for cosine of KO inclination(s)
KO_eprior
property
¶
Prior for KO eccentricity(ies)
KO_omegaprior
property
¶
Prior for KO argument(s) of periastron
KO_phiprior
property
¶
Prior for KO mean anomaly(ies)
conditional
property
¶
(self) -> kima.GAIAmodel.GAIAConditionalPrior
da_prior
property
¶
Prior for the offset in right-ascension (mas)
dd_prior
property
¶
Prior for the the offset in declination (mas)
known_object
property
¶
whether the model includes (better) known extra Keplerian curve(s)
mua_prior
property
¶
Prior for the proper-motion in right-ascension
mud_prior
property
¶
Prior for the proper-motion in declination
n_known_object
property
¶
how many known objects
nu_prior
property
¶
Prior for the degrees of freedom of the Student-t likelihood
parallax_prior
property
¶
Prior for the parallax
studentt
property
¶
use a Student-t distribution for the likelihood (instead of Gaussian)
thiele_innes
property
¶
use the thiele-innes coefficients rather than geometric
set_known_object()
method descriptor
¶
set_known_object(self, arg: int, /) -> None
kima.RVGAIAmodel API
RVGAIAmodel()
¶
init(self, fix: bool, npmax: int, GAIAdata: kima.Data.GAIAdata, RVData: kima.Data.RVData) -> None
Combined analysis of Gaia epoch astrometry and radial velocity timeseries. Implements a sum-of-Keplerians model where the number of Keplerians can be free. This model assumes white, uncorrelated noise. Planets are to be given Mass priors in Solar-Mass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fix
|
bool, default=True
|
whether the number of Keplerians should be fixed |
required |
npmax
|
int, default=0
|
maximum number of Keplerians |
required |
GAIAdata
|
GAIAdata
|
the astrometric data |
required |
RVdata
|
RVData
|
the radial velocity data |
required |
Cprior
property
¶
Prior for the systemic velocity
GAIAdata
property
¶
the data
J_GAIA_prior
property
¶
Prior for the extra white noise (jitter) for GAIA data
J_RV_prior
property
¶
Prior for the extra white noise (jitter) for RV data
KO_Mprior
property
¶
Prior for KO mass(es) (M_sun)
KO_Omegaprior
property
¶
Prior for KO longitude(s) of ascending node
KO_Pprior
property
¶
Prior for KO orbital period(s)
KO_cosiprior
property
¶
Prior for cosine of KO inclination(s)
KO_eprior
property
¶
Prior for KO eccentricity(ies)
KO_omegaprior
property
¶
Prior for KO argument(s) of periastron
KO_phiprior
property
¶
Prior for KO mean anomaly(ies)
RVdata
property
¶
the data
conditional
property
¶
(self) -> kima.RVGAIAmodel.RVGAIAConditionalPrior
cubic_prior
property
¶
Prior for the cubic coefficient of the trend
da_prior
property
¶
Prior for the offset in right-ascension (mas)
dd_prior
property
¶
Prior for the the offset in declination (mas)
degree
property
¶
degree of the polynomial trend
directory
property
¶
directory where the model ran
fix
property
¶
whether the number of Keplerians is fixed
indicator_correlations
property
¶
include in the model linear correlations with indicators
individual_offset_prior
property
¶
Common prior for the between-instrument offsets
known_object
property
¶
whether the model includes (better) known extra Keplerian curve(s)
mua_prior
property
¶
Prior for the proper-motion in right-ascension
mud_prior
property
¶
Prior for the proper-motion in declination
n_known_object
property
¶
how many known objects
npmax
property
¶
maximum number of Keplerians
nu_GAIA_prior
property
¶
Prior for the degrees of freedom of the Student-t likelihood for GAIA data
nu_RV_prior
property
¶
Prior for the degrees of freedom of the Student-t likelihood for RV data
offsets_prior
property
¶
Common prior for the between-instrument offsets
parallax_prior
property
¶
Prior for the parallax
quadr_prior
property
¶
Prior for the quadratic coefficient of the trend
slope_prior
property
¶
Prior for the slope
star_mass
property
¶
stellar mass [Msun]
studentt
property
¶
use a Student-t distribution for the likelihood (instead of Gaussian)
trend
property
¶
whether the model includes a polynomial trend
set_known_object()
method descriptor
¶
set_known_object(self, arg: int, /) -> None
The model.conditional object contained in each model can be used to define the
priors for the orbital parameters. Different models may use different
conditionals, depending on the specific parameterisation:
RVmodel / GPmodel / RVFWHMmodel → KeplerianConditionalPrior
GAIAmodel → GAIAConditionalPrior
init(self) -> None
Aprior
property
¶
Prior thiele_innes parameter(s) A
Bprior
property
¶
Prior thiele_innes parameter(s) B
Fprior
property
¶
Prior thiele_innes parameter(s) F
Gprior
property
¶
Prior thiele_innes parameter(s) G
Omegaprior
property
¶
Prior for the longitude(s) of ascending node
Pprior
property
¶
Prior for the orbital period(s)
a0prior
property
¶
Prior for the photocentre semi-major-axis(es) (mas)
cosiprior
property
¶
Prior for cosine(s) of the orbital inclination
eprior
property
¶
Prior for the orbital eccentricity(ies)
omegaprior
property
¶
Prior for the argument(s) of periastron
phiprior
property
¶
Prior for the mean anomaly(ies)
thiele_innes
property
¶
use a Student-t distribution for the likelihood (instead of Gaussian)
TODO: RVHGPMmodel → RVHGPMConditionalPrior
Run¶
To run the sampler and estimate the posterior for the model parameters
just call kima.run
Example:¶
Distributions¶
The distributions sub-package contains the implementation of several probability distributions
that can be used as priors for a model parameter. All distributions have standard parameterizations,
as you would find e.g. in Wikipedia. Some distributions have a corresponding Truncated version
which truncates the support of the distribution to an interval $ [{\rm lower}, {\rm upper} ]$.
Example:¶
kima.distributions API
Cauchy()
¶
Cauchy distribution
init(self, loc: float, scale: float) -> None
loc
property
¶
Location parameter
scale
property
¶
Scale parameter
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
Exponential()
¶
Exponential distribution
init(self, scale: float) -> None
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
ExponentialRayleighMixture()
¶
docs
init(self, weight: float, scale: float, sigma: float) -> None
docs
scale
property
¶
(self) -> float
sigma
property
¶
(self) -> float
weight
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
Fixed()
¶
'Fixed' distribution
init(self, value: float) -> None
val
property
¶
Fixed value of the parameter
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
Gaussian()
¶
Gaussian distribution
init(self, loc: float, scale: float) -> None
loc
property
¶
Location parameter
scale
property
¶
Scale parameter
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
GaussianMixture()
¶
Mixture of Gaussian distributions
init(self, means: collections.abc.Sequence[float], sigmas: collections.abc.Sequence[float]) -> None init(self, means: collections.abc.Sequence[float], sigmas: collections.abc.Sequence[float], lower: float, upper: float) -> None init(self, means: collections.abc.Sequence[float], sigmas: collections.abc.Sequence[float], weights: collections.abc.Sequence[float], lower: float, upper: float) -> None
Overloaded function.
__init__(self, means: collections.abc.Sequence[float], sigmas: collections.abc.Sequence[float]) -> None
Instantiates a mixture of Gaussian distributions from lists of means and sigmas, with equal weights
__init__(self, means: collections.abc.Sequence[float], sigmas: collections.abc.Sequence[float], lower: float, upper: float) -> None
Instantiates a mixture of Gaussian distributions from lists of means and sigmas, with equal weights, truncated to [lower, upper]
__init__(self, means: collections.abc.Sequence[float], sigmas: collections.abc.Sequence[float], weights: collections.abc.Sequence[float], lower: float, upper: float) -> None
Instantiates a mixture of Gaussian distributions from lists of means, sigmas, and weights, truncated to [lower, upper]
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
HalfGaussian()
¶
Half-Gaussian distribution
init(self, scale: float) -> None
scale
property
¶
Scale parameter
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
InverseGamma()
¶
Inverse gamma distribution
init(self, alpha: float, beta: float) -> None
Inverse gamma distribution
alpha
property
¶
Shape parameter α
beta
property
¶
Scale parameter β
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
InverseMoment()
¶
InverseMoment prior
init(self, tau: float, kmax: float) -> None
kmax
property
¶
(self) -> float
tau
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
Kumaraswamy()
¶
Kumaraswamy distribution (similar to a Beta distribution)
init(self, a: float, b: float) -> None
a
property
¶
(self) -> float
b
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
Laplace()
¶
Laplace distribution
init(self, loc: float, scale: float) -> None
loc
property
¶
Location parameter
scale
property
¶
Scale parameter
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
LogUniform()
¶
LogUniform distribution (sometimes called reciprocal or Jeffrey's distribution)
init(self, lower: float, upper: float) -> None
lower
property
¶
(self) -> float
upper
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
ModifiedLogUniform()
¶
ModifiedLogUniform distribution
init(self, knee: float, upper: float) -> None
knee
property
¶
(self) -> float
upper
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
Pareto()
¶
Pareto distribution
init(self, min: float, alpha: float) -> None
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
RNG()
¶
Rayleigh()
¶
Rayleigh distribution
init(self, scale: float) -> None
scale
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
SingleTransitPeriodPrior()
¶
Prior for the orbital period when a single planet transit was observed
init(self, W: float, L: float, Pmax: float) -> None
L
property
¶
Mid-transit time minus the start of the observational window
Pmax
property
¶
Maximum orbital period
W
property
¶
Observational window
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
Triangular()
¶
Triangular distribution
init(self, lower: float, center: float, upper: float) -> None
center
property
¶
(self) -> float
lower
property
¶
(self) -> float
upper
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
TruncatedCauchy()
¶
docs
init(self, loc: float, scale: float, lower: float, upper: float) -> None
loc
property
¶
Location parameter
lower
property
¶
(self) -> float
scale
property
¶
Scale parameter
upper
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
TruncatedExponential()
¶
Exponential distribution truncated to [lower, upper]
init(self, scale: float, lower: float, upper: float) -> None
lower
property
¶
(self) -> float
scale
property
¶
(self) -> float
upper
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
TruncatedGaussian()
¶
Gaussian distribution truncated to [lower, upper] interval
init(self, loc: float, scale: float, lower: float, upper: float) -> None
loc
property
¶
Location parameter
lower
property
¶
Lower truncation boundary
scale
property
¶
Scale parameter
upper
property
¶
Upper truncation boundary
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
TruncatedPareto()
¶
Pareto distribution truncated to [lower, upper] interval
init(self, min: float, alpha: float, lower: float, upper: float) -> None
alpha
property
¶
Scale parameter
lower
property
¶
(self) -> float
min
property
¶
Location parameter
upper
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
TruncatedRayleigh()
¶
Rayleigh distribution truncated to [lower, upper] interval
init(self, scale: float, lower: float, upper: float) -> None
lower
property
¶
(self) -> float
scale
property
¶
(self) -> float
upper
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
Uniform()
¶
Uniform distribuion in [lower, upper]
init(self, lower: float, upper: float) -> None
lower
property
¶
(self) -> float
upper
property
¶
(self) -> float
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
UniformAngle()
¶
Uniform distribuion in [0, 2*PI]
init(self) -> None
cdf()
method descriptor
¶
cdf(self, x: float) -> float
Cumulative distribution function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the CDF |
required |
logpdf()
method descriptor
¶
logpdf(self, x: float) -> float
Logarithm of the probability density function evaluated at x
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
point at which to evaluate the PDF |
required |
ppf()
method descriptor
¶
ppf(self, q: float) -> float
Percent point function (inverse of cdf) evaluated at q
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float
|
point at which to evaluate the PPF |
required |
Keplerian¶
Finally, even though it sits at the core of what kima does, there is the keplerian function:
This is the default radial velocity keplerian function, though others exist for the more specific cases. There is the keplerian function for Gaia astrometry: