GWForge.fisher.dali¶
Doublet-DALI likelihood and posterior sampling.
At order = 1 the log-likelihood is exactly quadratic, so the Fisher posterior is
Gaussian and \(\Sigma = F^{-1}\) describes it completely – every marginal is
an ellipse available in closed form.
The doublet adds cubic and quartic terms,
which has neither a closed-form normalisation nor closed-form marginals.
The contractions are written as flattened matrix products rather than
numpy.einsum() so they reach BLAS: measured at 1.9 million evaluations per
second versus 0.03 million for the equivalent einsum call.
Attributes¶
Classes¶
Doublet-DALI log-likelihood as a bilby likelihood. |
Functions¶
|
Load and validate the sampling priors. |
|
Sample a DALI posterior through bilby. |
Module Contents¶
- class GWForge.fisher.dali.DALILikelihood(fisher, order=2)[source]¶
Bases:
bilby.core.likelihood.LikelihoodDoublet-DALI log-likelihood as a bilby likelihood.
Examples
>>> likelihood = DALILikelihood(fisher) >>> result = sample_posterior(likelihood, priors, outdir="out", label="src0")
- Variables:
names (list of str) – Parameter names, in tensor order.
fiducial (dict) – The point the expansion is about; samples are offsets from it.
- log_likelihood(parameters=None)[source]¶
Log-likelihood at
parameters(or atself.parameters).- Parameters:
parameters (dict or None) – Absolute parameter values, not offsets. Accepting them as an argument is the bilby 3 interface; bilby 2 still sets
self.parametersinstead, and both work here.- Return type:
float
- GWForge.fisher.dali.build_priors(prior_file, names, fiducial, enforce_physicality=False, sigmas=None)[source]¶
Load and validate the sampling priors.
- Parameters:
prior_file (str) – Path to a bilby
.priorfile.names (sequence of str) – Fisher parameter names that must all be covered.
fiducial (dict) – Fiducial values, checked to lie inside the prior support – a prior that excludes the point the expansion is about would be sampling nothing.
enforce_physicality (bool) – Also reject samples outside
PHYSICAL_RANGES.sigmas (dict or None) – Fisher one-sigma widths. When given, priors narrower than
NARROW_PRIOR_SIGMASsigmas are warned about.
- Return type:
bilby.core.prior.PriorDict
- Raises:
KeyError – If the file does not define every parameter. bilby’s own prior files use
mass_ratio,a_1and friends, which do not line up with the default Fisher parameters, so this is a likely mistake and is worth failing loudly for rather than silently sampling the wrong space.ValueError – If a fiducial value falls outside its prior.
- GWForge.fisher.dali.sample_posterior(likelihood, priors, outdir, label, sampler='emcee', nwalkers=200, nsteps=2000, nburn=500, **kwargs)[source]¶
Sample a DALI posterior through bilby.
- Parameters:
likelihood (DALILikelihood)
priors (bilby.core.prior.PriorDict)
outdir (str) – Output directory for the sampler.
label (str) – Run label, used for the output filenames.
sampler (str) – Any bilby sampler;
emceeby default.nwalkers (int) – emcee settings, ignored by nested samplers.
nsteps (int) – emcee settings, ignored by nested samplers.
nburn (int) – emcee settings, ignored by nested samplers.
**kwargs – Passed straight to
bilby.run_sampler().
- Return type:
bilby.core.result.Result