Instances of Likelihood are called by worker sampling processes for evaluation of a likelihood function.

class xpsi.Likelihood.Likelihood(star, signals, num_energies=128, fast_rel_num_energies=0.25, threads=1, llzero=-1e+90, externally_updated=False, prior=None)[source]

Bases: xpsi.ParameterSubspace.ParameterSubspace

A container for all objects related to likelihood evaluation.

A collective for objects pertaining to a statistical analysis of X-ray signals. These objects include X-ray data (sub)sets, the model instruments used to acquire these data sets, and the model star and model backgrounds.

  • star (obj) – An instance of Star. This instance is the model star.
  • signals (list) –


  • num_energies (float) – Number of energies to compute specific photon flux signals at for likelihood evaluation. These energies will be distributed linearly in logarithmic space within the union of waveband coverages achieved by some set of instruments. Gaps in waveband coverage will be skipped.
  • fast_rel_num_energies (float) – Fraction of the normal number of energies to use in fast mode.
  • threads (int) – The number of OpenMP threads to spawn for integration. The default number of threads used by low-level integration routines is 1. The number can be increased if the parallelisation paradigm on a cluster is changed such that, e.g., per node there is one thread per CPU, instead of one OpenMPI process. It is recommended that threads is 1; more threads are useful when performing integrals at high resolution, but not necessarily when integrating many times as when sampling, because the MPI parallelisation paradigm is invoked.
  • llzero (float) – The minimum log-likelihood setting for MultiNest. Points whose log-likelihood is lower than this value are ignored, which is useful for defining complicated priors.
  • externally_updated (bool) – Update the parameter values upon call to the likelihood object? If so, then pass False. A parameter vector then needs to be passed to the likelihood object. Otherwise, safely assume that the new parameter values are set externally, e.g., in a prior object when inverse sampling the prior for nested sampling.
__call__(p=None, reinitialise=False, force=False)[source]

Evaluate the logarithm of the joint likelihood over all pulsations.

  • p (list) – Parameter vector if parameters not updated externally.
  • reinitialise (optional[bool]) – Call self.reinitialise()?
  • force (optional[bool]) – Force complete reevaluation even if some parameters are unchanged. To faciliate this, all parameter caches are cleared.

The logarithm of the likelihood.


Get a summary of the parameters constituting the subspace.

check(hypercube_points, loglikelihood_call_vals, rtol_loglike, atol_loglike=0.0, logprior_call_vals=None, rtol_logprior=None, atol_logprior=None, physical_points=None)[source]

Perform checks on the likelihood evaluator and the prior density.

Can be called from nested() to execute a check before automatically commencing a sampling process.

  • hypercube_points (ndarray[n,m]) – A set of n points in the unit hypercube, where m is dimensionality (self.num_params) of the sampling space – i.e., of the hypercube. If you want to pass the physical points instead, just pass None here.
  • physical_points (optional(ndarray[n,m])) – A set of n points in the physical parameter space, where m is dimensionality (self.num_params) of the sampling space. The hypercube_points, if not None, will be ignored.

Get a number less than the minimum log-likelihood threshold.


Get the minimum log-likelihood setting passed to MultiNest.


Get the minimum log-likelihood scaled randomly by up to an order of magnitude.


Get the list of Signal instances.


Get the instance of Star.

synthesise(p, reinitialise=False, force=False, **kwargs)[source]

Synthesise pulsation data.

  • p (list) – Parameter vector.
  • reinitialise (optional[bool]) – Call self.reinitialise()?
  • force (optional[bool]) – Force complete reevaluation even if some parameters are unchanged.
  • kwargs (dict) – Keyword arguments propagated to custom signal synthesis methods. Examples of such arguments include exposure times or required total count numbers (see example notebooks0.

Get the number of threads spawned for integration.