ravest.param
Parameter handling and orbital parameterisation conversions.
Attributes
Classes
Handle conversions between different orbital parameterisations. |
|
Represents a model parameter with value, unit, and fixed/free status. |
Functions
|
Convert a parameter key to a LaTeX-formatted label for plotting. |
|
Return the internal unit string for a parameter key. |
Module Contents
- ravest.param.ALLOWED_PARAMETERISATIONS = ['P K e w Tp', 'P K e w Tc', 'P K ecosw esinw Tp', 'P K ecosw esinw Tc', 'P K secosw sesinw Tp',...
- class ravest.param.Parameterisation(parameterisation: str)[source]
Handle conversions between different orbital parameterisations.
- static _validate_period(per: float | numpy.ndarray) None[source]
Validate orbital period.
- Parameters:
per (float or array-like) – Orbital period(s) to validate.
- static _validate_semi_amplitude(k: float | numpy.ndarray) None[source]
Validate RV semi-amplitude.
- Parameters:
k (float or array-like) – RV semi-amplitude(s) to validate.
- static _validate_eccentricity(e: float | numpy.ndarray) None[source]
Validate orbital eccentricity.
- Parameters:
e (float or array-like) – Eccentricity value(s) to validate.
- static _validate_argument_periastron(w: float | numpy.ndarray) None[source]
Validate argument of periastron.
- Parameters:
w (float or array-like) – Argument of periastron value(s) to validate.
- validate_default_parameterisation_params(params_dict: dict[str, float | numpy.ndarray]) None[source]
Validate all parameters in default parameterisation (per k e w tp).
- Parameters:
params_dict (dict) – Dictionary with keys: per, k, e, w, tp
- Raises:
ValueError – If any parameter is invalid
- validate_planetary_params(params_dict: dict[str, float | numpy.ndarray]) None[source]
Validate planetary parameters are astrophysically valid, in any parameterisation.
- Parameters:
params_dict (dict) – Dictionary with planetary parameters in current parameterisation
- Raises:
ValueError – If any parameter is invalid for this parameterisation
- parameterisation
- pars
- _time_given_true_anomaly(true_anomaly: float | numpy.ndarray, period: float | numpy.ndarray, eccentricity: float | numpy.ndarray, time_peri: float | numpy.ndarray) float | numpy.ndarray[source]
Calculate the time that the star will be at a given true anomaly.
- Parameters:
true_anomaly (float) – The true anomaly of the planet at the wanted time
period (float) – The orbital period of the planet (day)
eccentricity (float) – The eccentricity of the orbit, 0 <= e < 1 (dimensionless).
time_peri (float) – The time of periastron (day).
- Returns:
The time corresponding to the given true anomaly (days).
- Return type:
float
- convert_tp_to_tc(time_peri: float | numpy.ndarray, period: float | numpy.ndarray, eccentricity: float | numpy.ndarray, arg_peri: float | numpy.ndarray) float | numpy.ndarray[source]
Calculate the time of transit centre, given time of periastron passage.
This is only a time of (primary) transit centre if the planet is actually transiting the star from the observer’s viewpoint/inclination. Therefore technically this is a time of (inferior) conjunction.
- Returns:
Time of primary transit centre/inferior conjunction (days)
- Return type:
float
- convert_tc_to_tp(time_conj: float | numpy.ndarray, period: float | numpy.ndarray, eccentricity: float | numpy.ndarray, arg_peri: float | numpy.ndarray) float | numpy.ndarray[source]
Calculate the time of periastron passage, given time of primary transit.
- Returns:
Time of periastron passage (days).
- Return type:
float
- convert_secosw_sesinw_to_e_w(secosw: float | numpy.ndarray, sesinw: float | numpy.ndarray) tuple[float | numpy.ndarray, float | numpy.ndarray][source]
Convert sqrt(e)cos(w), sqrt(e)sin(w) to eccentricity and argument of periastron.
- Parameters:
secosw (float) – sqrt(e) * cos(w)
sesinw (float) – sqrt(e) * sin(w)
- Returns:
Eccentricity e and argument of periastron w
- Return type:
float, float
- convert_e_w_to_secosw_sesinw(e: float | numpy.ndarray, w: float | numpy.ndarray) tuple[float | numpy.ndarray, float | numpy.ndarray][source]
Convert eccentricity and argument of periastron to sqrt(e)cos(w), sqrt(e)sin(w).
- Parameters:
e (float) – Eccentricity
w (float) – Argument of periastron
- Returns:
sqrt(e)*cos(w) and sqrt(e)*sin(w)
- Return type:
float, float
- convert_ecosw_esinw_to_e_w(ecosw: float | numpy.ndarray, esinw: float | numpy.ndarray) tuple[float | numpy.ndarray, float | numpy.ndarray][source]
Convert e*cos(w), e*sin(w) to eccentricity and argument of periastron.
- Parameters:
ecosw (float) – e * cos(w)
esinw (float) – e * sin(w)
- Returns:
Eccentricity e and argument of periastron w
- Return type:
float, float
- convert_e_w_to_ecosw_esinw(e: float | numpy.ndarray, w: float | numpy.ndarray) tuple[float | numpy.ndarray, float | numpy.ndarray][source]
Convert eccentricity and argument of periastron to e*cos(w), e*sin(w).
- Parameters:
e (float) – Eccentricity
w (float) – Argument of periastron
- Returns:
e*cos(w) and e*sin(w)
- Return type:
float, float
- convert_pars_to_default_parameterisation(inpars: dict[str, float | numpy.ndarray]) dict[str, float | numpy.ndarray][source]
Convert parameters from this parameterisation to default (per k e w tp).
- Parameters:
inpars (dict) – Parameters in this parameterisation
- Returns:
Parameters in default parameterisation (P K e w Tp)
- Return type:
dict
- convert_pars_from_default_parameterisation(default_pars: dict[str, float]) dict[str, float][source]
Convert parameters from default (per k e w tp) to this parameterisation.
- Parameters:
default_pars (dict) – Dictionary with keys: per, k, e, w, tp
- Returns:
Parameters in this parameterisation
- Return type:
dict
- ravest.param.param_key_to_latex(key: str) str[source]
Convert a parameter key to a LaTeX-formatted label for plotting.
- Parameters:
key (str) – Parameter key, e.g. ‘P_b’, ‘w_c’, ‘jit_HARPS’, ‘gp_amp’.
- Returns:
LaTeX-formatted string suitable for matplotlib labels. Returns the input key unchanged if the parameter is not recognised.
- Return type:
str
- ravest.param.param_key_to_unit(key: str) str | None[source]
Return the internal unit string for a parameter key.
All parameters in ravest have fixed internal units — this function returns the correct unit for a given parameter key. Useful for labelling plots and formatting results tables.
- Parameters:
key (str) – Parameter key, e.g. ‘P_b’, ‘K_c’, ‘jit_HARPS’, ‘gp_amp’.
- Returns:
Unit string (e.g. ‘d’, ‘m/s’, ‘rad’). Returns ‘’ for dimensionless parameters. Returns None if the parameter is not recognised.
- Return type:
str or None