lightcurvelynx.math_nodes.bilby_priors

Wrapper classes for sampling from Bilby’s prior module.

Classes

BilbyPriorNode

The base class for sampling from Bilby's prior module.

Module Contents

class BilbyPriorNode(prior, seed=None, **kwargs)[source]

Bases: lightcurvelynx.base_models.FunctionNode, citation_compass.CiteClass

The base class for sampling from Bilby’s prior module.

prior[source]

The Bilby prior object to sample from.

Type:

bilby.prior.PriorDict

Parameters:
  • prior (dict or bilby.prior.PriorDict) – A dictionary mapping the names of the parameters to their prior distributions.

  • seed (int, optional) – The seed to use.

Note

The BilbyPriorNode’s compute() function does not use the random number generator passed to it. Rather it uses Bilby’s internal random number generator. You can set the seed for this using the seed argument when initializing the node or by calling the set_seed method. However, you cannot control the samples from this node via a simulation-wide random number generator.

Citations

Cite as:

@article{bilby_paper,
    author = "Ashton, Gregory and others",
    title = "{BILBY: A user-friendly Bayesian inference library for gravitational-wave astronomy}",
    eprint = "1811.02042",
    archivePrefix = "arXiv",
    primaryClass = "astro-ph.IM",
    doi = "10.3847/1538-4365/ab06fc",
    journal = "Astrophys. J. Suppl.",
    volume = "241",
    number = "2",
    pages = "27",
    year = "2019"
}
prior[source]
set_seed(new_seed)[source]

Update the random number generator’s seed to a given value.

Parameters:

new_seed (int) – The given seed

compute(graph_state, rng_info=None, **kwargs)[source]

Sample from the wrapped prior.

The input arguments are taken from the current graph_state and the outputs are written to graph_state.

Parameters:
  • graph_state (GraphState) – An object mapping graph parameters to their values. This object is modified in place as it is sampled.

  • rng_info (numpy.random._generator.Generator, optional) – This random number generator is not used by this node. Instead, Bilby’s internal random number generator is used. You can set the seed for this using the seed argument when initializing the node or by calling the set_seed() method.

  • **kwargs (dict, optional) – Additional function arguments.

Returns:

results – The result of the computation. This return value is provided so that testing functions can easily access the results.

Return type:

any

Raises:

ValueError – if func attribute is None.