gwkokab.errorsΒΆ

FunctionsΒΆ

banana_error(β†’ numpy.ndarray)

Add banana error to the given values. Section 3 of the `Model-independent

mock_spin_error(β†’ numpy.ndarray)

truncated_normal_error(β†’ numpy.ndarray)

Adds truncated normal error to the given values.

Module ContentsΒΆ

gwkokab.errors.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[source]ΒΆ

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.

\[ \begin{align}\begin{aligned}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]\end{aligned}\end{align} \]
Mc_truenp.ndarray

True chirp mass

eta_truenp.ndarray

True symmetric mass ratio

sizeint

number of samples

keyPRNGKeyArray

jax random key

scale_Mcfloat

scale of the chirp mass error, defaults to 1.0

scale_etafloat

scale of the symmetric mass ratio error, defaults to 1.0

estimatesdict[str | P, np.ndarray]

Parameter estimates performed so far

rhonp.ndarray

SNR of the event, used to scale the error

Returns:

array of values with added banana error

Return type:

np.ndarray

gwkokab.errors.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[source]ΒΆ
gwkokab.errors.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: float | None = None, high: float | None = None) numpy.ndarray[source]ΒΆ

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 cut_low and cut_high are both None, the function will return the sampled values without any truncation.

Note

if low or high is None, the TruncatedNormal distribution will not be truncated at those bounds.

Parameters:
  • x (np.ndarray) – Given values to which the error will be added.

  • size (int) – Number of samples to generate.

  • key (PRNGKeyArray) – JAX random key for sampling.

  • scale (float) – Scale parameter for the truncated normal distribution.

  • estimates (dict[str | P, np.ndarray]) – Parameter estimates performed so far

  • rho (np.ndarray) – SNR of the event, used to scale the error

  • low (Optional[float], optional) – Lower bound for the truncation, defaults to None (no lower bound).

  • high (Optional[float], optional) – Upper bound for the truncation, defaults to None (no upper bound).

Returns:

Array of values with added truncated normal error, with all values within the specified bounds.

Return type:

np.ndarray