Priors

Redback uses bilby under the hood for priors. See here for general documentation of priors in bilby.

Analytical priors

Thanks to bilby there are several different priors already implemented.

  • Beta

  • Categorical

  • Cauchy

  • ChiSquared

  • Cosine

  • DeltaFunction

  • Exponential

  • FermiDirac

  • Gamma

  • Gaussian

  • HalfGaussian

  • LogGaussian

  • LogUniform

  • Logistic

  • Lorentzian

  • PowerLaw

  • Sine

  • StudentT

  • SymmetricLogUniform

  • TruncatedGaussian

  • Uniform

Interpolated or from file

Users can also create a prior from a grid of values i.e., an interpolated_prior. See documentation here.

Constrained priors

Sometimes there are some additional constraints on the priors that are difficult to parameterise or not on a sampled parameter.

For example, the rotational energy of a neutron star cannot be exceeded in a super luminous supernova. Or that a numerical surrogate is only valid in a certain domain etc. In redback, we have written several of these constraints. For models with built-in constraint metadata, the simplest way to use them is to pass constraint=True to get_priors.

For example,

import redback

model = "csm_nickel"
priors = redback.priors.get_priors(model=model, constraint=True)
samples = priors.sample(1000)

This attaches the relevant bilby Constraint priors and the corresponding conversion_function automatically. If a model has no built-in constraints configured, get_priors(..., constraint=True) returns the ordinary prior and logs a warning.

Built-in constraint loading is currently available for several model classes, including:

  • magnetar and superluminous supernova models with rotational-energy constraints,

  • TDE fallback and cooling-envelope models with physical-domain constraints,

  • CSM-interaction supernova models with shock-time/photosphere constraints,

  • kilonova ejecta-relation models with derived ejecta-mass and velocity domain constraints,

  • EOS-derived kilonova models with EOS and derived-ejecta constraints.

You can inspect or modify the returned prior like any other bilby prior dictionary.

priors = redback.priors.get_priors("gaussianrise_cooling_envelope", constraint=True)
priors["redshift"] = 0.075
samples = priors.sample(1000)

For custom constraints, or if you want different bounds from the built-in configuration, construct the prior dictionary manually by loading the particular constraint from redback.constraints and passing it to the bilby prior dictionary.

For example,

import redback
from bilby.core.prior import PriorDict, Uniform, Constraint

priors = PriorDict(conversion_function=redback.constraints.slsn_constraint)
priors['erot_constraint'] = Constraint(minimum=0, maximum=100)
priors['t_nebula_min'] = Constraint(minimum=0, maximum=100)

Then define our priors on all other parameters in the normal way. You can then check whether the constraints are set up correctly by sampling from the prior via

priors.sample(1000)

You can implement your own constraints by following the constraint templates and bilby documentation. If you are manually constructing a constrained prior dictionary, it can be updated to include the default prior via

model = 'slsn'
priors.update(redback.priors.get_priors(model=model))

Adding sigma to the prior

One can also add a sigma to the prior by using the sigma keyword in the prior dictionary. For the default redback likelihood, this will overwrite the sigma in the data and estimate a constant sigma. For other likelihoods, this may be added in quadrature to the y_err from the data. Or be a systematic offset proportional to the model that is added in quadrature to the measured noise. Please look at the likelihood documentation for more details.