ravest.param ============ .. py:module:: ravest.param .. autoapi-nested-parse:: Parameter handling and orbital parameterisation conversions. Attributes ---------- .. autoapisummary:: ravest.param.ALLOWED_PARAMETERISATIONS Classes ------- .. autoapisummary:: ravest.param.Parameterisation ravest.param.Parameter Functions --------- .. autoapisummary:: ravest.param.param_key_to_latex ravest.param.param_key_to_unit Module Contents --------------- .. py:data:: ALLOWED_PARAMETERISATIONS :value: ['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',... .. py:class:: Parameterisation(parameterisation: str) Handle conversions between different orbital parameterisations. .. py:method:: _validate_period(per: float | numpy.ndarray) -> None :staticmethod: Validate orbital period. :param per: Orbital period(s) to validate. :type per: float or array-like .. py:method:: _validate_semi_amplitude(k: float | numpy.ndarray) -> None :staticmethod: Validate RV semi-amplitude. :param k: RV semi-amplitude(s) to validate. :type k: float or array-like .. py:method:: _validate_eccentricity(e: float | numpy.ndarray) -> None :staticmethod: Validate orbital eccentricity. :param e: Eccentricity value(s) to validate. :type e: float or array-like .. py:method:: _validate_argument_periastron(w: float | numpy.ndarray) -> None :staticmethod: Validate argument of periastron. :param w: Argument of periastron value(s) to validate. :type w: float or array-like .. py:method:: validate_default_parameterisation_params(params_dict: dict[str, float | numpy.ndarray]) -> None Validate all parameters in default parameterisation (per k e w tp). :param params_dict: Dictionary with keys: per, k, e, w, tp :type params_dict: dict :raises ValueError: If any parameter is invalid .. py:method:: validate_planetary_params(params_dict: dict[str, float | numpy.ndarray]) -> None Validate planetary parameters are astrophysically valid, in any parameterisation. :param params_dict: Dictionary with planetary parameters in current parameterisation :type params_dict: dict :raises ValueError: If any parameter is invalid for this parameterisation .. py:attribute:: parameterisation .. py:attribute:: pars .. py:method:: __str__() -> str .. py:method:: __repr__() -> str .. py:method:: _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 Calculate the time that the star will be at a given true anomaly. :param true_anomaly: The true anomaly of the planet at the wanted time :type true_anomaly: `float` :param period: The orbital period of the planet (day) :type period: `float` :param eccentricity: The eccentricity of the orbit, 0 <= e < 1 (dimensionless). :type eccentricity: `float` :param time_peri: The time of periastron (day). :type time_peri: `float` :returns: The time corresponding to the given true anomaly (days). :rtype: `float` .. py:method:: 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 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) :rtype: `float` .. py:method:: 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 Calculate the time of periastron passage, given time of primary transit. :returns: Time of periastron passage (days). :rtype: `float` .. py:method:: convert_secosw_sesinw_to_e_w(secosw: float | numpy.ndarray, sesinw: float | numpy.ndarray) -> tuple[float | numpy.ndarray, float | numpy.ndarray] Convert sqrt(e)cos(w), sqrt(e)sin(w) to eccentricity and argument of periastron. :param secosw: sqrt(e) * cos(w) :type secosw: float :param sesinw: sqrt(e) * sin(w) :type sesinw: float :returns: Eccentricity e and argument of periastron w :rtype: float, float .. py:method:: convert_e_w_to_secosw_sesinw(e: float | numpy.ndarray, w: float | numpy.ndarray) -> tuple[float | numpy.ndarray, float | numpy.ndarray] Convert eccentricity and argument of periastron to sqrt(e)cos(w), sqrt(e)sin(w). :param e: Eccentricity :type e: float :param w: Argument of periastron :type w: float :returns: sqrt(e)*cos(w) and sqrt(e)*sin(w) :rtype: float, float .. py:method:: convert_ecosw_esinw_to_e_w(ecosw: float | numpy.ndarray, esinw: float | numpy.ndarray) -> tuple[float | numpy.ndarray, float | numpy.ndarray] Convert e*cos(w), e*sin(w) to eccentricity and argument of periastron. :param ecosw: e * cos(w) :type ecosw: float :param esinw: e * sin(w) :type esinw: float :returns: Eccentricity e and argument of periastron w :rtype: float, float .. py:method:: convert_e_w_to_ecosw_esinw(e: float | numpy.ndarray, w: float | numpy.ndarray) -> tuple[float | numpy.ndarray, float | numpy.ndarray] Convert eccentricity and argument of periastron to e*cos(w), e*sin(w). :param e: Eccentricity :type e: float :param w: Argument of periastron :type w: float :returns: e*cos(w) and e*sin(w) :rtype: float, float .. py:method:: convert_pars_to_default_parameterisation(inpars: dict[str, float | numpy.ndarray]) -> dict[str, float | numpy.ndarray] Convert parameters from this parameterisation to default (per k e w tp). :param inpars: Parameters in this parameterisation :type inpars: dict :returns: Parameters in default parameterisation (P K e w Tp) :rtype: dict .. py:method:: convert_pars_from_default_parameterisation(default_pars: dict[str, float]) -> dict[str, float] Convert parameters from default (per k e w tp) to this parameterisation. :param default_pars: Dictionary with keys: per, k, e, w, tp :type default_pars: dict :returns: Parameters in this parameterisation :rtype: dict .. py:function:: param_key_to_latex(key: str) -> str Convert a parameter key to a LaTeX-formatted label for plotting. :param key: Parameter key, e.g. 'P_b', 'w_c', 'jit_HARPS', 'gp_amp'. :type key: str :returns: LaTeX-formatted string suitable for matplotlib labels. Returns the input key unchanged if the parameter is not recognised. :rtype: str .. py:function:: param_key_to_unit(key: str) -> str | None 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. :param key: Parameter key, e.g. 'P_b', 'K_c', 'jit_HARPS', 'gp_amp'. :type key: str :returns: Unit string (e.g. 'd', 'm/s', 'rad'). Returns '' for dimensionless parameters. Returns None if the parameter is not recognised. :rtype: str or None .. py:class:: Parameter(value: float, unit: str, fixed: bool = False) Represents a model parameter with value, unit, and fixed/free status. .. py:attribute:: value .. py:attribute:: unit .. py:attribute:: fixed :value: False .. py:method:: __repr__() -> str .. py:method:: __str__() -> str