gwkokab.errors ============== .. py:module:: gwkokab.errors Functions --------- .. autoapisummary:: gwkokab.errors.banana_error gwkokab.errors.mock_spin_error gwkokab.errors.truncated_normal_error Module Contents --------------- .. py:function:: banana_error(Mc_true: numpy.ndarray, eta_true: numpy.ndarray, size: int, key: jaxtyping.PRNGKeyArray, *, estimates: dict[str | gwkokab.parameters.Parameters, numpy.ndarray], rho: numpy.ndarray, scale_Mc: float = 1.0, scale_eta: float = 1.0) -> numpy.ndarray Add banana error to the given values. Section 3 of the `Model-independent inference on compact-binary observations `_ discusses the banana error. It adds errors in the chirp mass and symmetric mass ratio and then converts back to masses. .. math:: M_{c} = M_{c}^{T} \left[1+\beta\frac{12}{\rho}\left(r_{0}+r\right)\right] \eta = \eta^{T} \left[1+0.03\frac{12}{\rho}\left(r_{0}^{'}+r^{'}\right)\right] Mc_true : np.ndarray True chirp mass eta_true : np.ndarray True symmetric mass ratio size : int number of samples key : PRNGKeyArray jax random key scale_Mc : float scale of the chirp mass error, defaults to 1.0 scale_eta : float scale of the symmetric mass ratio error, defaults to 1.0 estimates : dict[str | P, np.ndarray] Parameter estimates performed so far rho : np.ndarray SNR of the event, used to scale the error :returns: array of values with added banana error :rtype: np.ndarray .. py:function:: mock_spin_error(chi_eff: numpy.ndarray, eta: numpy.ndarray, size: int, key: jaxtyping.PRNGKeyArray, *, estimates: dict[str | gwkokab.parameters.Parameters, numpy.ndarray], rho: numpy.ndarray, scale_chi_eff: numpy.ndarray) -> numpy.ndarray .. py:function:: truncated_normal_error(x: numpy.ndarray, size: int, key: jaxtyping.PRNGKeyArray, *, scale: float, estimates: dict[str | gwkokab.parameters.Parameters, numpy.ndarray], rho: numpy.ndarray, low: Optional[float] = None, high: Optional[float] = None) -> numpy.ndarray Adds truncated normal error to the given values. The error is sampled from a truncated normal distribution with the given parameters. The function will resample until all values are within the allowed range. .. note:: If :code:`cut_low` and :code:`cut_high` are both None, the function will return the sampled values without any truncation. .. note:: if :code:`low` or :code:`high` is None, the :code:`TruncatedNormal` distribution will not be truncated at those bounds. :param x: Given values to which the error will be added. :type x: np.ndarray :param size: Number of samples to generate. :type size: int :param key: JAX random key for sampling. :type key: PRNGKeyArray :param scale: Scale parameter for the truncated normal distribution. :type scale: float :param estimates: Parameter estimates performed so far :type estimates: dict[str | P, np.ndarray] :param rho: SNR of the event, used to scale the error :type rho: np.ndarray :param low: Lower bound for the truncation, defaults to None (no lower bound). :type low: Optional[float], optional :param high: Upper bound for the truncation, defaults to None (no upper bound). :type high: Optional[float], optional :returns: Array of values with added truncated normal error, with all values within the specified bounds. :rtype: np.ndarray