# 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 which can be used by simply loading the particular constraint from redback.constraints and passing them 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 implement your own constraints by following the constraint templates and `bilby`

documentation.