Skip to content
Python connection to Diffusive Nested Sampling.
Python C++
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



This package provides

  • Python connection to the C implementation of Diffusive Nested Sampling (DNest3).
  • Pure Python re-implementation of Diffusive Nested Sampling (

This software is in beta status -- verify the results and report bugs!

Using the Connector to DNest3

  1. Compile DNest into a shared library:

    cd /dir/to/DNest3
    patch -p1 < /dir/to/PyDNest/dnest3-build-sharedlib.patch
rebuild DNest as usual (cmake, make) You should find in the build directory.
  1. Build the PyDNest bridge:

    cd PyDNest
You should find in this directory.
  1. You are ready to go. Try the example in First tell it where to find the two libraries you created:

    export LD_LIBRARY_PATH=/dir/to/DNest3/build/:/dir/to/PyDNest/

For using in your application, just import and pass your functions to dnest_run. You need to define

  1. int allocate(): makes a new particle. returns a integer (or C-pointer) to know which particle we are talking about.
  2. double drawFromPrior(i): gets the integer from above, and draws a position from the prior for it (storing the position somewhere).
  3. perturb(i): gets the integer from above, and modifies the position. Returns H (usually 0?).
  4. likelihood(i): gets the integer from above, and returns the likelihood for this particle.

Author: Johannes Buchner

You can’t perform that action at this time.