Giter VIP home page Giter VIP logo

johannesbuchner / ultranest Goto Github PK

View Code? Open in Web Editor NEW
131.0 7.0 24.0 159.77 MB

Fit and compare complex models reliably and rapidly. Advanced nested sampling.

Home Page: https://johannesbuchner.github.io/UltraNest/

License: Other

Makefile 0.76% Python 89.37% C++ 0.13% C 0.13% Fortran 0.13% Julia 0.07% R 0.09% Cython 9.32%
nested-sampling python model-selection parallel-computing monte-carlo

ultranest's Introduction

UltraNest

Fit and compare complex models reliably and rapidly with advanced sampling techniques.

image

image

Documentation Status

Github repository

Software paper

Correctness. Speed. Ease of use. πŸ¦”

About

When scientific models are compared to data, two tasks are important: 1) contraining the model parameters and 2) comparing the model to other models. Different techniques have been developed to explore model parameter spaces. This package implements a Monte Carlo technique called nested sampling.

Nested sampling allows Bayesian inference on arbitrary user-defined likelihoods. In particular, posterior probability distributions on model parameters are constructed, and the marginal likelihood ("evidence") Z is computed. The former can be used to describe the parameter constraints of the data, the latter can be used for model comparison (via Bayes factors) as a measure of the prediction parsimony of a model.

In the last decade, multiple variants of nested sampling have been developed. These differ in how nested sampling finds better and better fits while respecting the priors (constrained likelihood prior sampling techniques), and whether it is allowed to go back to worse fits and explore the parameter space more.

This package develops novel, advanced techniques for both (See How it works). They are especially remarkable for being free of tuning parameters and theoretically justified. Beyond that, UltraNest has support for Big Data sets and high-performance computing applications.

UltraNest is intended for fitting complex physical models with slow likelihood evaluations, with one to hundreds of parameters. UltraNest intends to replace heuristic methods like multi-ellipsoid nested sampling and dynamic nested sampling with more rigorous methods. UltraNest also attempts to provide feature parity compared to other packages (such as MultiNest).

You can help by testing UltraNest and reporting issues. Code contributions are welcome. See the Contributing page.

Features

  • Pythonic
    • pip and conda installable
    • Easy to program for: Sanity checks with meaningful errors
    • Can control the run programmatically and check status
    • Reasonable defaults, but customizable
    • Thoroughly tested with many unit and integration tests
    • NEW: supports likelihood functions written in Python, C, C++, Fortran, Julia and R
  • Robust exploration easily handles:
    • Degenerate parameter spaces such as bananas or tight correlations
    • Multiple modes/solutions in the parameter space
    • Robust, parameter-free MLFriends algorithm (metric learning RadFriends, Buchner+14,+19), with new improvements (region follows new live points, clustering improves metric iteratively, NEW in v4.0: refined local metric).
    • High-dimensional problems with hit-and-run sampling
    • Wrapped/circular parameters, derived parameters
    • Fast-slow parameters
  • Lightweight and fast
  • Advanced visualisation and crash recovery:
    • Live view of the exploration for Jupyter notebooks and terminals
    • Publication-ready visualisations
    • Corner plots, run and parameter exploration diagnostic plots
    • Checkpointing and resuming, even with different number of live points
    • Warm-start: resume from modified data / model
  • strategic nested sampling
    • can vary (increase) number of live points (akin to dynamic nested sampling, but with different targets)
    • can sample clusters optimally (e.g., at least 50 points per cluster/mode/solution)
    • can target minimizing parameter estimation uncertainties
    • can target a desired evidence uncertainty threshold
    • can target a desired number of effective samples
    • or any combination of the above
    • Robust ln(Z) uncertainties by bootstrapping live points.

Usage

Get started!

Read the full documentation with tutorials at:

https://johannesbuchner.github.io/UltraNest/

API Reference:.

Code repository: https://github.com/JohannesBuchner/UltraNest/

Licence

How to cite UltraNest.

GPLv3 (see LICENCE file). If you require another license, please contact me.

The cute hedgehog icon was made by Freepik. It symbolises UltraNest's approach of carefully walking up a likelihood, ready to defend against any encountered danger.

ultranest's People

Contributors

adipol-ph avatar ahnitz avatar facero avatar gregorydavidmartinez avatar johannesbuchner avatar nsusemiehl avatar qzgao avatar smirngreg avatar warrickball avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ultranest's Issues

Start-up is not parallelized

First of all, thanks A LOT for your awesome package!

  • UltraNest version: 3.3.0
  • Python version: 3.8.8
  • Operating System:
    Operating System: SUSE Linux Enterprise Server 12 SP5
    CPE OS Name: cpe:/o:suse:sles:12:sp5
    Kernel: Linux 4.12.14-122.80-default
    Architecture: x86-64

Description

I am running ReactiveNestedSampler with a likelihood function which takes minutes to compute on a single core (can't be parallelized) on a large MPI cluster with many nodes, 80 cpu each. This works fine, but the first live points are not using MPI and are just calculated sequentially. When I set minimum live points to 100, it takes 100 x few minutes to get started, reporting with
[ultranest] Sampling 100 live points from prior ...

When I set it below 80, I get an error that a number of live points should be at least the number of cpus on mpi (I did not save the exact error message).

When it finishes, the rest of points are calculated in parallel as expected. But with scaling to 32 nodes x 80 cpu (2560 cpus total) the first 100 points take the same time as the rest 25k, which is not good. What should I do?

What I Did

#within sbatch script
srun python -u my_fitting_script.py

Unable to start runs when using MPI

  • UltraNest version: 2.0.4
  • Python version: 3.7.4
  • Operating System: CentOS Linux 7 (Core)
  • MPI version: OpenMPI 3.1.3, (OpenRTE)
  • h5py version: 2.9.0

Description

When I attempt to run the 100-D Gaussian example using MPI,

mpirun -np 2 python3 gauss.py --x_dim=100 --num_live_points=400 --slice --slice_steps=100

the following OSError occurs:

File "h5py/h5f.pyx", line 85, in h5py.h5f.open
OSError: Unable to open file (truncated file: eof = 96, sblock->base_addr = 0, stored_eof = 2048)

During the handling of this exception, other exceptions occur. I have included the full report here.

The example ran fine without MPI. I renamed the logs directory before running this. The error occurred both with and without setting OMP_NUM_THREADS=1

subfolder with mpi4py

  • UltraNest version: 3.2.0
  • Python version: 3.8.5

Is it possible to have n independent subfolder outputs of the nested sampler when running with n cores in parallel?
For example in the gauss.py code given in the documentation (https://johannesbuchner.github.io/UltraNest/performance.html#using-multiple-cores) the execution is mpiexec -np 4 python3 gauss.py.
However, this leads to only one output folder even if in the ReactiveNestedSampler we have resume='subfolder'.
What I would like to have is in this case 4 output folders of each running CPU, i.e. run1 for the results of CPU1 run2 for the results of CPU2,...

Obtain MAP Estimate

  • UltraNest version: 2.1.2
  • Python version: 3.7
  • Operating System: Mac OSX 10.14

Description

While the documentation is clear about how to obtain the maximum likelihood estimate (MLE), it is not clear about how to obtain the maximum a posteriori (MAP) estimate.

What I Did

The point resulting from the code below does not seem to correspond to the MAP. My posterior distribution is pretty Gaussian, so I was surprised by how different the two parameter values were.

# MLE
imax1 = np.argmax(sampler.results['weighted_samples']['L'])
v_mle = sampler.results['weighted_samples']['v'][imax1, :]

# MAP?
imax2 = np.argmax(sampler.results['weighted_samples']['w'])
v_map = sampler.results['weighted_samples']['v'][imax2, :]

Ultranest attempts a requirement import during installation

  • UltraNest version: 3.3.3
  • Python version: 3.9+
  • Operating System: Mac OS Big Sur

Description

During installation Ultranest tries to import Cython. Pip installations bundle gathering dependencies and then at a later stage they install all the dependencies. The bundles aren't actually installed yet. So when Ultranest tries to reference Cython during the installation process in setup.py, it's unavailable.

someorg:EXOTIC jpl-jengelke$ pip install -r requirements.txt 
Ignoring importlib-metadata: markers 'python_version <= "3.7"' don't match your environment
Ignoring dynesty: markers 'platform_system == "Windows"' don't match your environment
Collecting wheel
  Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (60.9.3)
Collecting python_version
  Downloading python_version-0.0.2-py2.py3-none-any.whl (3.4 kB)
Collecting astroalign~=2.4
  Downloading astroalign-2.4.1.tar.gz (1.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 10.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting astropy>=4.3
  Downloading astropy-5.0.2-cp39-cp39-macosx_10_9_x86_64.whl (6.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.9/6.9 MB 12.4 MB/s eta 0:00:00
Collecting astroquery~=0.4
  Downloading astroquery-0.4.5-py3-none-any.whl (4.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 15.3 MB/s eta 0:00:00
Collecting barycorrpy~=0.4
  Downloading barycorrpy-0.4.4-py3-none-any.whl (9.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.6/9.6 MB 14.5 MB/s eta 0:00:00
Collecting cython~=0.29.26
  Downloading Cython-0.29.28-py2.py3-none-any.whl (983 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 983.8/983.8 KB 8.5 MB/s eta 0:00:00
Collecting holoviews~=1.14
  Downloading holoviews-1.14.8-py2.py3-none-any.whl (4.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 15.2 MB/s eta 0:00:00
Collecting LDTk~=1.7
  Downloading LDTk-1.7.0-py3-none-any.whl (37 kB)
Collecting lmfit~=1.0
  Downloading lmfit-1.0.3.tar.gz (292 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 292.5/292.5 KB 6.4 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting matplotlib>=3.4
  Downloading matplotlib-3.5.1-cp39-cp39-macosx_10_9_x86_64.whl (7.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.3/7.3 MB 3.7 MB/s eta 0:00:00
Collecting numpy~=1.21
  Downloading numpy-1.22.3-cp39-cp39-macosx_10_14_x86_64.whl (17.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.6/17.6 MB 14.3 MB/s eta 0:00:00
Collecting pandas~=1.3
  Downloading pandas-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl (11.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.5/11.5 MB 15.2 MB/s eta 0:00:00
Collecting panel~=0.12
  Downloading panel-0.12.6-py2.py3-none-any.whl (12.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.9/12.9 MB 15.6 MB/s eta 0:00:00
Collecting photutils>=0.7
  Downloading photutils-1.3.0-cp39-cp39-macosx_10_9_x86_64.whl (559 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 559.1/559.1 KB 8.2 MB/s eta 0:00:00
Collecting python_dateutil~=2.8
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 KB 5.6 MB/s eta 0:00:00
Collecting pyvo~=1.2
  Downloading pyvo-1.3-py3-none-any.whl (829 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 829.6/829.6 KB 8.5 MB/s eta 0:00:00
Collecting requests~=2.27
  Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.1/63.1 KB 2.0 MB/s eta 0:00:00
Collecting scipy~=1.7
  Downloading scipy-1.8.0-cp39-cp39-macosx_12_0_universal2.macosx_10_9_x86_64.whl (55.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.6/55.6 MB 13.2 MB/s eta 0:00:00
Collecting scikit-image~=0.18
  Downloading scikit_image-0.19.2-cp39-cp39-macosx_10_13_x86_64.whl (13.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.3/13.3 MB 15.7 MB/s eta 0:00:00
Collecting tenacity~=8.0
  Downloading tenacity-8.0.1-py3-none-any.whl (24 kB)
Collecting ultranest~=3.3.3
  Downloading ultranest-3.3.3.tar.gz (21.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 21.5/21.5 MB 14.3 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  Γ— python setup.py egg_info did not run successfully.
  β”‚ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/0_/0mssd1656q78c47k0_yk7sn00000gp/T/pip-install-zzyhdkbo/ultranest_45cde6e84d9d4627ab12dbddb6315fea/setup.py", line 9, in <module>
          from Cython.Build import cythonize
      ModuleNotFoundError: No module named 'Cython'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Γ— Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: You are using pip version 22.0.3; however, version 22.0.4 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m pip install --upgrade pip' command.

What I Did

Workaround is to install Cython first, so Ultranest can use it on a second install pass. We made two requirements files to call. 

Installation Errors

  • UltraNest version: 3.2.0
  • Python version: 3.6 / 3.8
  • Operating System: Linux / Windows subsystem for Linux

Description

Installing ultranest on my laptop (WSL enviroment) and on our supercomputer (LinuxOS), both using a virtual enviroment and NOT conda.

NOTE: Everything works fine in my Windows conda enviroment (which already had Cython installed).

What I Did

pip install ultranest==3.2.0

Collecting ultranest==3.2.0
  Downloading https://files.pythonhosted.org/packages/ae/e9/753e53e5ab71e67f363cb493b54d02d4ea623a3419f8b63962afd15a50e1/ultranest-3.2.0.tar.gz (21.4MB)
    100% |################################| 21.4MB 47kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-i_rq5u6o/ultranest/setup.py", line 9, in <module>
        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'

I figure this is due to a missing requirement in the release.

However, even if I install cython manually via pip install cython I then get the following error:

(PyAuto) [dc-nigh1@login5b PyAutoFit]$ pip install cython
Collecting cython
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/16/9a/2eece92da53d954cc5ede815f9825b8ec795252471d0772ff9a591166c98/Cython-0.29.23-cp36-cp36m-manylinux1_x86_64.whl (2.0MB)
    100% |################################| 2.0MB 457kB/s
Installing collected packages: cython
Successfully installed cython-0.29.23
You are using pip version 9.0.3, however version 21.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(PyAuto) [dc-nigh1@login5b PyAutoFit]$ pip install ultranest==3.2.0
Collecting ultranest==3.2.0
  Using cached https://files.pythonhosted.org/packages/ae/e9/753e53e5ab71e67f363cb493b54d02d4ea623a3419f8b63962afd15a50e1/ultranest-3.2.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ml119ibv/ultranest/setup.py", line 22, in <module>
        readme = readme_file.read()
      File "/cosma/local/Python/3.6.5/lib/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 773: ordinal not in range(128)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ml119ibv/ultranest/
You are using pip version 9.0.3, however version 21.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

🀷

"ValueError: Buffer dtype mismatch, expected 'int64_t' but got 'long'" (Windows compatibility issue?)

  • UltraNest version: 2.2.1
  • Python version: 3.7
  • Operating System: Windows 10

Description

I was trying to fit a line to simulated data when I encountered the the error "ValueError: Buffer dtype mismatch, expected 'int64_t' but got 'long'". This occured after the line "result = sampler.run(min_num_live_points=50, min_ess=100)". I have pasted the full code I was using below. I encountered the same issue while running UltraNest's basic usage demo and line fitting tutorial.

import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
import ultranest
from ultranest.plot import cornerplot

x_true = np.linspace(0,10, 1000)
slope_true = 2
int_true = 3
y_true = x_true * slope_true + int_true

N = 25
x_sample = np.random.choice(x_true, N)
y_sample = x_sample * slope_true + int_true

dispersion_true = 0.5
x_err = np.random.normal(0, dispersion_true, size = N)
y_err = np.random.normal(0, dispersion_true, size = N)

x = x_sample + x_err
y = y_sample + y_err

parameters = ['slope', 'intercept', "dispersion"]

def prior_transform(cube):
    # the argument, cube, consists of values from 0 to 1
    # we have to convert them to physical scales

    params = cube.copy()

    lo = -0
    hi = +4
    params[0] = cube[0] * (hi - lo) + lo

    lo = 1
    hi = 5
    params[1] = cube[1] * (hi - lo) + lo

    lo = 0
    hi = 2
    params[2] = cube[2] * (hi - lo) + lo

    return params

def log_likelihood(params):

	slope, intercept, dispersion = params
	dispersion = max(dispersion, 0)

	model_y = x * slope + intercept
	data_y = y_sample
	error = dispersion**2 + y_err**2 + (slope * x_err)**2

	ll = np.nan_to_num(-0.5 * sum(np.power(np.subtract(data_y, model_y), 2) / np.power(error, 2)))

	return ll

sampler = ultranest.ReactiveNestedSampler(parameters, log_likelihood, prior_transform)
result = sampler.run(min_num_live_points=50, min_ess=100)
cornerplot(sampler.result)

What I Did

I was not able to find any information on this error code online specific to UltraNest, but this issue seems to arise in other packages that depend on cython for Windows users. I installed a development version of UltraNest via pip and edited lines 1451 and 1452 of ultranest's integrator.py to be dtype=np.int64 instead of dtype=int, but this did not fix the issue. Are there any known compatibility issues between UltraNest and Windows?

Crash report:

Traceback (most recent call last):
  File "test2.py", line 68, in <module>
    result = sampler.run(min_num_live_points=50, min_ess=100)
  File "c:\users\nsuse\ultranest\ultranest\integrator.py", line 1788, in run
    viz_callback=viz_callback,
  File "c:\users\nsuse\ultranest\ultranest\integrator.py", line 1971, in run_iter
    minvol=exp(main_iterator.logVolremaining))
  File "c:\users\nsuse\ultranest\ultranest\integrator.py", line 1492, in _update_region
    nextTransformLayer = self.transformLayer.create_new(active_u, self.region.maxradiussq, minvol=minvol)
  File "ultranest\mlfriends.pyx", line 502, in ultranest.mlfriends.AffineLayer.create_new
  File "ultranest\mlfriends.pyx", line 199, in ultranest.mlfriends.update_clusters
  File "ultranest\mlfriends.pyx", line 48, in ultranest.mlfriends.find_nearby
ValueError: Buffer dtype mismatch, expected 'int64_t' but got 'long'

Error upon importing ultranest

  • UltraNest version: 3.2.0
  • Python version: 3.7
  • Operating System: macOS 10.14.6

Description

Describe what you were trying to get done.

Trying to import ultranest.

Tell us what happened, what went wrong, and what you expected to happen.
There is a valueError upon import:

ValueError                                Traceback (most recent call last)
<ipython-input-2-b7f2dc2ff625> in <module>
----> 1 import ultranest
      2 #import species
      3 import numpy as np
      4 from astropy.io import fits
      5 #species.SpeciesInit()

~/anaconda3/lib/python3.7/site-packages/ultranest/__init__.py in <module>
      5 """
      6 
----> 7 from .integrator import NestedSampler, ReactiveNestedSampler, read_file
      8 from .utils import vectorize
      9 

~/anaconda3/lib/python3.7/site-packages/ultranest/integrator.py in <module>
     18 
     19 from .utils import create_logger, make_run_dir, resample_equal, vol_prefactor, vectorize, listify as _listify, is_affine_transform, normalised_kendall_tau_distance
---> 20 from ultranest.mlfriends import MLFriends, AffineLayer, ScalingLayer, find_nearby, WrappingEllipsoid
     21 from .store import HDF5PointStore, TextPointStore, NullPointStore
     22 from .viz import get_default_viz_callback, nicelogger

~/anaconda3/lib/python3.7/site-packages/ultranest/mlfriends.pyx in init ultranest.mlfriends()

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject```

### What I Did

import ultranest


This happened from a clean conda environment, using pip install ultranest to install the package.

Assertion error , nan value in log likelihood

  • UltraNest version: 3.3.3
  • Python version: 3.6.9
  • Operating System: ubuntu mate 18.04

Description

Dear @JohannesBuchner ,

I hope you are healthy and doing good. I am using your amazing program to marginalize my model parameters through the chi^2 of observed and theory parameters.

What I Did

firstly, I defined one of the chi^2 as

def chiH(Om0, w, wa, CC, h, rd):
        class= CLPCDM(Om0, w, wa, CC, h, rd)
        H_th = clas2.HUBz(0.)
        chiH1 = np.sum((74.0-H_th)**2./1.432**2)
        return chiH1 

and some other chi2 . Then I calculated the total chi^2. after that I defined the priors as this,

def my_prior_transform(cube):
	params = cube.copy()
 #### from 0.2 to 0.5
	params[0] = cube[0] * 0.3+0.2
###-3 to 3 
	params[1] = cube[1] * 6 - 3
 #### -3 to 3 
	params[2] = cube[2] * 6 - 3
 ##### this goes from -6 to 0
	params[3] = cube[3] * 5.999-0.6
##### 0.6 to 0.8
	params[4] = cube[4] * 0.2 + 0.6
######120 to 160
	params[5] = cube[5] * 40 + 120
#####-19.4 to -19
	params[6] = cube[6] * 0.4- 19.4
	return params   

and then I defined the loglike like this

def my_likelihood(params):
    Om0, w, wa, CC, h, rd, M = params
    return lnlike(Om0, w, wa, CC, h, rd, M)

where lnlike = -0.5*chi2(Om0, w, wa, CC, h, rd, M) Then I run it with the command

sampler = ultranest.ReactiveNestedSampler(param_names, my_likelihood, my_prior_transform,log_dir='shan/')

result = sampler.run()
sampler.print_results()

But I get the assertion error, where the log likelihood is coming to be nan for some combinations of the parameter space. The error is like this,

error in log likelihood function: returned non-finite numbers for input u=%s p=%s" % (logl, u, p)) assertionerror: error in loglikelihood function: returned non-finite number: [ nan -121726.57582046] for input u=[[0.78765003 0.00515522 0.81853438 0.81965105 0.5427253 0.18686831 0.66807462] [0.09369217 0.65672809 0.29540557 0.59462096 0.39587013 0.76211824 0.91300439]] p=[[ 7.08885029e-01 -2.96906866e+00 1.91120629e+00 -5.05059022e+00 7.08545060e-01 1.27474732e+02 -1.92672298e+01] [ 8.43229506e-02 9.40368563e-01 -1.22756659e+00 -1.13512078e+01 6.79174026e-01 1.50484730e+02 -1.93652018e+01]]

I think this may be the problem where I give the priors in my_prior_transform. I may have wrongly given the priors for (-6,0). Please, guide me through this. That will be very helpful to me. Thanks in advance. Please, don't mind if the question is too trivial. I am still learning.

With the best regards,
shan.

Can I pass heavy-data to my Likelihood function across parallelized samplers?

Hi all!

I'm running data-heavy exoplanet atmospheric retrievals with PyMultinest (and will soon update to UltraNest). For that purpose, I have a computation-heavy likelihood function which calculates a forward model using a huge database (used by petitRADTRANS, see Mollière A&A 627, A67 (2019)). I therefore need to parallelize the sampling process across, say, N cores (or equivalently N samplers each on its own processor). At the moment, I run my code using a command-line like mpiexec -n N python retrieval.py, which unfortunately loads the huge database N times, resulting in a gigantic RAM-usage (scaling like ~N). I would like to be able to load this database only one time, and share it across all N parallel cores. As far as I understand, a possibility to do that would be to pass this database as an argument (or kwarg) to the likelihood function (maybe by pickling it like in emcee? see Foreman-Mackey 2013 arXiv:1202.3665v4, https://emcee.readthedocs.io/en/stable/tutorials/parallel/#parallel). Another possibility would be to work with multithreading instead of parallelisation, and then have each thread refer to the same database (again by passing some argument to the likelihood function).

A bit more precisely: this huge database is encoded as a self-written python class, which I would love to be able to define once at the start of the retrieval, and pass it each time the likelihood function is evaluated.

Is either of those possiblities already possible with UltraNest, or being planned to be added? Or is there another option doing the same thing (spare some RAM, but not at the cost of reading data directly to a disc-drive)?

I would be happy to talk directly to Johannes Buchner, or anyone else working on this project, to give further details.

Thank you for your answer!

Convergence from MWW test

  • UltraNest version: 3.2.0
  • Python version: 3.6.8
  • Operating System: MacOS 10.13

This is more of a general question rather than a technical issue.
In the ordertest module, a routine performing a Mann-Whitney-Wilcoxon test is implemented (in the ultranest 3.2.0 version a MWW test is performed by default at the end of each run, and the result is store in the result.json file). In many cases I get a negative outcome (converged = False) even if the fit looks good (e.g. criteria on logZerr and dK satisfied, gaussian-like posterior distributions). Question: how much weight should I give to the outcome of this test? Can I consider my fit formally converged even if this condition is not satisfied? And if not, how can I "improve" my fit to get a convergence for the MWW test, e.g. increase the number of samples, decrease the logZerr threshold ?

Thanks a lot.

Model comparison example typo

In the model comparison example the comment above the prior transform for the period says it goes from 0.3 to 30, when the actual prior transform goes from 1 to 100 (see below).

def prior_transform1(cube):
    # the argument, cube, consists of values from 0 to 1
    # we have to convert them to physical scales

    params = cube.copy()
    # let background level go from -10 to +10
    params[0] = cube[0] * 20 - 10
    # let amplitude go from 0.1 to 100
    params[1] = 10**(cube[1] * 3 - 1)
    # let period go from 0.3 to 30
    params[2] = 10**(cube[2] * 2)
    # let time go from 0 to 1
    params[3] = cube[3]
    return params

The comment should either be changed, or the prior transform changed to be params[2] = 10**(cube[2] * 2 + np.log10(0.3)). It's probably also worth noting (for more novice users) that the amplitude and period prior transforms represent uniform in log priors.

Unable to restart job. HDF5 error, possibly broken points.h5 file.

  • UltraNest version: 3.2.0 (installed through pip)
  • Python version: 3.8.5 (Anaconda)
  • Operating System: RHEL 8

Description

I've been able to get large runs going with MPI on my local cluster, which uses SLURM for job submission. It has worked well for smaller tasks. For larger jobs, things seemed to be going fine, I'd been able to start jobs, and this particular job was able to restart multiple times without issue after the previous submission timed out. However, on the 5th restart the job fails with the following error message:

Traceback (most recent call last):
  File "/homes/dittmann/python/anaconda3/lib/python3.8/site-packages/h5py/_hl/files.py", line 185, in make_fid
    fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5f.pyx", line 88, in h5py.h5f.open
OSError: Unable to open file (wrong B-tree signature)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "syntheticTest.py", line 24, in <module>
    sampler = ReactiveNestedSampler(paramnames, loglike, transform=transform,
  File "/homes/dittmann/python/anaconda3/lib/python3.8/site-packages/ultranest/integrator.py", line 1049, in __init__
    self.pointstore = HDF5PointStore(storage_filename, storage_num_cols, mode='a' if resume else 'w')
  File "/homes/dittmann/python/anaconda3/lib/python3.8/site-packages/ultranest/store.py", line 186, in __init__
    self.fileobj = h5py.File(filepath, **h5_file_args)
  File "/homes/dittmann/python/anaconda3/lib/python3.8/site-packages/h5py/_hl/files.py", line 406, in __init__
    fid = make_fid(name, mode, userblock_size,
  File "/homes/dittmann/python/anaconda3/lib/python3.8/site-packages/h5py/_hl/files.py", line 187, in make_fid
    fid = h5f.create(name, h5f.ACC_EXCL, fapl=fapl, fcpl=fcpl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5f.pyx", line 108, in h5py.h5f.create
OSError: Unable to create file (unable to open file: name = 'logs/synthetic400HzRNS-8d/results/points.hdf5', errno = 17, error message = 'File exists', flags = 15, o_flags = c2)

When I try to use h5ls to check out the results/points.h5 file, I get the following:

H5tools-DIAG: Error detected in HDF5:tools (1.10.6) thread 0:
  #000: h5trav.c line 1064 in h5trav_visit(): traverse failed
    major: Failure in tools library
    minor: error in function
  #001: h5trav.c line 297 in traverse(): H5Literate_by_name failed
    major: Failure in tools library
    minor: error in function

My guess is that the job may have just timed out while files were being written so they are incomplete. Do have any ideas on how to test this? Or could there be some other problem? The final output of the slurm file the last time the job successfully started doesn't have anything out of the ordinary, nor does the debug.log file. Let me know if attaching any other files could help get to the bottom of this.

Resuming run does not write progress to hdf5 file when terminated, restarting always repeats the same iterations

  • UltraNest version: 3.3.3
  • Python version: 3.8.5
  • Operating System: Rocky Linux 8.4

Description

I am in a situation where I have to run UltraNest on a checkpoint queue on a cluster, and the job gets interrupted every 5 hours. As a result, I have been attempting to use the resume feature, but I'm having some difficulty understanding how it works. It seems that it will resume at a certain number of ncalls that is lower than the ncalls that it left off on. It goes back to the same ncalls nearly every time it is interrupted and resumed, so the code is not able to move past that number of ncalls most of the time. I will attach my debug.log file here so you know what I mean. Thank you in advance for your help!

debug.log

No attribute '__name__' error

  • UltraNest version: 3.3.3
  • Python version: 3.7.3
  • Operating System: Ubuntu 20.04

Description

The sampler raises an error when I use an object created by partial or a class with __call__. This is not very convenient.

What I Did

For example,

from functools import partial

def test_func(x, mu):
    return -np.sum((x - mu)**2, axis=-1)

sampler = ultranest.ReactiveNestedSampler(['x0', 'x1'], Test())
sampler.run()

yields

~/programs/anaconda3/lib/python3.7/site-packages/ultranest/utils.py in vectorize(function)
    131         return np.asarray([function(arg) for arg in args])
    132 
--> 133     vectorized.__name__ = function.__name__
    134     return vectorized
    135 

AttributeError: 'functools.partial' object has no attribute '__name__'

Similarly,

class Test:
    def __call__(self, x):
        return -np.sum(x**2, axis=-1)
    
sampler = ultranest.ReactiveNestedSampler(['x0', 'x1'], Test())
sampler.run()

yields

~/programs/anaconda3/lib/python3.7/site-packages/ultranest/utils.py in vectorize(function)
    131         return np.asarray([function(arg) for arg in args])
    132 
--> 133     vectorized.__name__ = function.__name__
    134     return vectorized
    135 

AttributeError: 'Test' object has no attribute '__name__'

Logs not saved if existing logs aren't a continuous sequence

  • UltraNest version: 3.3.0
  • Python version: 3.9.5
  • Operating System: Fedora 33

Description

I've been variously re-running a scientific problem of mine, comparing results for different runs which appear under e.g. my_results/runX. But if I delete a folder manually (particularly, run1), subsequent runs don't save results.

What I Did

Here's my 2-d Gaussian test script, mwe.py:

#!/usr/bin/env python3                                                                                                                                                                                                                                        

import numpy as np
import ultranest

def prior_transform(cube):
    return 20.*cube - 10

def log_likelihood(params):
    return -0.5*np.sum(params**2)

names = ['Ξ±', 'Ξ²']

S = ultranest.ReactiveNestedSampler(names, log_likelihood, prior_transform, log_dir='mwe')
r = S.run(min_num_live_points=400)

Now let's run it a few times, tinkering with results folders.

$ python3 mwe.py
...
$ ls mwe
run1
$ python3 mwe.py
...
$ ls mwe
run1  run2
$ rm -r mwe/run1
$ ls mwe
run2
$ python3 mwe.py
...
$ ls mwe
run2

where I would've expected a new folder run1 or maybe run3. I've tried to find a new debug.log file but can only find the one in run2.

$ find . -iname debug.log
./mwe/run2/debug.log

I can work around it be moving the existing data into a continuous sequence and I'll have a look at the source this afternoon.

AttributeError: 'ReactiveNestedSampler' object has no attribute 'logger'

  • UltraNest version: 2.0.0, installed using pip
  • Python version: 3.7, anaconda distribution
  • Operating System: Scientific Linux release 6.5

Description

I attempted to apply UltraNest to a test problem, using MPI. After a warning message that UltraNest was unable to update a region, as well as numpy singular matrix errors associated with ultranest/integrator.py, I received the message:

During handling of the above exception, another exception occurred:
/anaconda3/lib/python3.7/site-packages/ultranest/integrator.py", line 1519, in _update_region
    self.logger.warning("not updating region", exc_info=True)
AttributeError: 'ReactiveNestedSampler' object has no attribute 'logger'

after which the job stalled until I interrupted it. A full traceback is attached. This occurred after about 46,000 iterations.
ultranest_error_log.txt

Vectorized stepsampler

  • UltraNest version: 3.3.3
  • Python version: 3.9.4
  • Operating System: Linux

Description

I would like to run a vectorized stepsampler as described in issue 14. I can run the vectorized ReactiveNestedSampler correctly. For my problem, however, a stepsampler is much better suited.
The vectorized stepsampler crashes with an error directly after launch.

What I Did

I run this code:

sampler = ReactiveNestedSampler(
            parameters,
            log_likelihood, 
            prior_transform,
            vectorized=True,
            ndraw_min=100,
            ndraw_max=400,
            )
sampler.stepsampler = ultranest.stepsampler.AHARMSampler(nsteps=400)
result = sampler.run()

without the line sampler.stepsampler = ultranest.stepsampler.AHARMSampler(nsteps=400) it runs correctly.
With this line it crashes:

starting at [0.37035903 0.26168261 0.74545311 0.13944934 0.86101038 0.0762323
 0.67986505 0.67523488 0.73274571 0.75403661 0.65612488 0.18768482
 0.13987624]
Traceback (most recent call last):
  File "/home/michael//1.py", line 304, in <module>
    result = sampler.run()
  File "/home/michael/miniconda3/envs/py39/lib/python3.9/site-packages/ultranest/integrator.py", line 2170, in run
    for result in self.run_iter(
  File "/home/michael/miniconda3/envs/py39/lib/python3.9/site-packages/ultranest/integrator.py", line 2430, in run_iter
    u, p, L = self._create_point(Lmin=Lmin, ndraw=ndraw, active_u=active_u, active_values=active_values)
  File "/home/michael/miniconda3/envs/py39/lib/python3.9/site-packages/ultranest/integrator.py", line 1697, in _create_point
    u, v, logl, nc = self.stepsampler.__next__(
  File "/home/michael/miniconda3/envs/py39/lib/python3.9/site-packages/ultranest/stepsampler.py", line 1433, in __next__
    assert self.nsteps_done == len(self.history), (self.nsteps_done, len(self.history))
AssertionError: (90, 100)

Run N instances of the sampler in parallel

  • UltraNest version: 3.3.0
  • Python version: 3.8.8
  • Operating System: macOS Catalina

Description

I am trying to process a list of N noisy observation in parallel using the the multiprocessing module and its pool.map function to process a list of N samplers to take advantage of my 8 core machine. I would expect to have 8 samplers running simultaneously but I get prompted with an error.

What I Did

Here is a code snippet of the likelihood function and the parallel process I'm trying to implement:

class LogLikelihood:
    #  likelihood function is defined as a callable object to allow for different sets of data 
    #  to be evaluated and is defined as:
    def __init__(self, y, y_err, model_func, vectorized=False):
        self.y = y 
        self.y_err = y_err
        self._call = model_func 
        self._axis = 1 if vectorized else 0
        
    def __call__(self, theta):
        return self._evaluate(theta)
    
    def _evaluate(self, theta):
        theta_interp = theta.copy()
        theta_interp[:,:2] = 10**theta_interp[:,:2]
        y_model = self._call(theta_interp) 
        like = -0.5 * np.power((self.y - y_model) / self.y_err, 2).sum(axis=self._axis)
        return like

wrapper function that implements the sampler.run(...) function

def wrapper_run_sampler(sampler):
    return sampler.run(viz_callback=False)

parellel setup snippet from my .py file


samplers = []
for i in range(n_obs):
    # instantiate loglike function for the different noisy observations
    log_like = LogLikelihood(y_list[i], y_err_list[i], model_grid_interp, vectorize=True)
    sampler = ultranest.ReactiveNestedSampler(param_names=param_names, 
                                            loglike=log_like, 
                                            transform=prior_transform,
                                            vectorized=True)
    samplers.append(sampler)

# run samplers in parallel
with mp.Pool(mp.cpu_count() - 1) as pool:
    res = pool.map(wrapper_run_sampler, samplers)

This is the resulting output I attempt to run in parallel:

TypeError                                 Traceback (most recent call last)
<ipython-input-6-440cbff57264> in <module>
----> 1 results = run_un.run_retrivals_parallel(filenames[0])

~/Box/Projects/LUVOIR-B IFS Simulations/Python Files/retrievals_parallel_un.py in run_retrivals_parallel(filename)
    238         t_1 = time.time()
    239         with mp.Pool(mp.cpu_count() - 1) as pool:
--> 240             res = pool.map(_run_ultranest, samplers)
    241         t_2 = time.time()
    242         print(f'--- Ellapse Time (iter): {t_2 - t_1} s')

~/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in map(self, func, iterable, chunksize)
    362         in a list that is returned.
    363         '''
--> 364         return self._map_async(func, iterable, mapstar, chunksize).get()
    365 
    366     def starmap(self, func, iterable, chunksize=None):

~/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in get(self, timeout)
    769             return self._value
    770         else:
--> 771             raise self._value
    772 
    773     def _set(self, i, obj):

~/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in _handle_tasks(taskqueue, put, outqueue, pool, cache)
    535                         break
    536                     try:
--> 537                         put(task)
    538                     except Exception as e:
    539                         job, idx = task[:2]

~/opt/anaconda3/lib/python3.8/multiprocessing/connection.py in send(self, obj)
    204         self._check_closed()
    205         self._check_writable()
--> 206         self._send_bytes(_ForkingPickler.dumps(obj))
    207 
    208     def recv_bytes(self, maxlength=None):

~/opt/anaconda3/lib/python3.8/multiprocessing/reduction.py in dumps(cls, obj, protocol)
     49     def dumps(cls, obj, protocol=None):
     50         buf = io.BytesIO()
---> 51         cls(buf, protocol).dump(obj)
     52         return buf.getbuffer()
     53 

TypeError: cannot pickle 'mpi4py.MPI.Intracomm' object

Is ultranest capable of running a list observations in parallel?

Thank you for your time.

Slower with MPI?

  • UltraNest version:3.3.0
  • Python version:3.8.8
  • Operating System: Red Hat Enterprise Linux Server 7.7

I'm running UltraNest/MultiNest on GALPROP, a numerical code for calculating cosmic ray propogation. I vary upto 10 parameters with flat priors. I wrote a likelihood function which runs GALPROP(creates an input file, reads the output file), and compares the output to data. I have attached the likelihood function below.

def loglikelihood(cube):

    identity = secrets.token_hex(4) 

    # generate job id

    # create galdef file
    create_galdef(cube, identity)

    # run galprop
    galprop = os.system('/home/varun/galprop/bin/galprop -r {} -f /home/varun/galprop/FITS -g /work/varun/GALDEF -o /work/varun/output'.format(identity))

    # delete galdef file
    os.remove('/work/varun/GALDEF/galdef_56_{}'.format(identity))

    # calculate chi2
    if galprop == 0:
        galprop_model = fits.open('/work/varun/output/nuclei_56_{}.gz'.format(identity))[0].data[0,:,0,10]/(galprop_energy*1000)**2*1e7

        os.remove('/work/varun/output/nuclei_56_{}.gz'.format(identity))
        galp = splrep(galprop_energy,galprop_model)
        dampe_model = splev(dampe_energy,galp)
        ams_model = splev(ams_energy,galp)
        ams_chi2 = ((ams_data-ams_model)**2/(ams_error)**2)[22:]
        dampe_chi2 = ((dampe_data-dampe_model)**2/(dampe_error)**2)
        chi2value=np.sum(ams_chi2)+np.sum(dampe_chi2)

        return -chi2value/2

Each evaluation of the likelihood takes 2.5 seconds on the cluster.

When I run this in parallel with either UltraNest/MultiNest, it actually slows down the code with each additional CPU. I checked that both UltraNest/MultiNest have a single header in the output, and in fact achieved speedup with the example problems in parallel. I picked the bash script from Scaling when parallelizing?#142 and tested parallizing the example problem mentioned there. I achieved speedup as expected.

#!/bin/bash
#SBATCH --job-name=Ultranest
#SBATCH --output=Ultranest-%j.out
#SBATCH --error=Ultranest-%j.err
#SBATCH --nodes=1
#SBATCH --ntasks=4
#SBATCH --time=01:00:00


mpiexec -n 4 Utragalproptest1.py

What can be causing this slowing down of the script with mpi? I'm considering following your solution to #36
but I've got no experience with parallelization and I'm unsure if this
from joblib import delayed, Parallel can be used with the above submit script and whether mpi usage of UltraNest or MultiNest will clash with this parallelization.
I have access to a lot of cores and core hours but can only run a single code for 6 days.
Thanks,
-Varun

LinAlgError: degenerate live points / singular matrix with Metropolis sampler

  • UltraNest version: 3.2.0
  • Python version: 3.8
  • Operating System: Windows subsystem for Linux

Description

Around 10000 iterations into a model fit using the RegionMHSampler (nsteps=10) I get the errors below. I also have seen Error 2 for the CubeMHSampler. No issues for normal sampler or slice samplers, so something specific to a Region sampler.

This probably indicates some undeseriable behaviour in my LH function, but would be very tricky to fix via changing the LH function. I have tried the options that 'improve' my LH function, but to no avail.

We don't see this issue for MCMC / MultiNest, but I think the same issue comes up with Dynesty. We managed to hack a fix for Dynesty, by restarting the algorithm via a try and except (doesn't work so well here due to the backend meaning it reuses the results).

What I Did

**Error 1:**

DEBUG:ultranest:iteration=937, ncalls=9555, logz=1214.48, remainder_fraction=100.0000%, Lmin=1235.84, Lmax=1269.88
DEBUG:ultranest:iteration=940, ncalls=9555, logz=1214.86, remainder_fraction=100.0000%, Lmin=1236.39, Lmax=1269.88
DEBUG:ultranest:iteration=945, ncalls=9555, logz=1215.47, remainder_fraction=100.0000%, Lmin=1236.94, Lmax=1269.88


Mono-modal Volume: ~exp(-71.40)   Expected Volume: exp(-19.75) Quality: correlation length: 153 (+)

   positive degeneracy between centre_1 and centre_0: rho=0.76
   positive degeneracy between elliptical_comps_0 and centre_0: rho=0.91
   positive degeneracy between elliptical_comps_0 and centre_1: rho=0.78
   negative degeneracy between elliptical_comps_0 and centre_1: rho=-0.88
   negative degeneracy between elliptical_comps_0 and elliptical_comps_0: rho=-0.79
   negative degeneracy between elliptical_comps_1 and elliptical_comps_0: rho=-0.84
   positive degeneracy between elliptical_comps_1 and elliptical_comps_0: rho=0.77
   negative degeneracy between sersic_index and centre_1: rho=-0.89
   negative degeneracy between sersic_index and elliptical_comps_0: rho=-0.82
   negative degeneracy between sersic_index and elliptical_comps_0: rho=-0.77
   positive degeneracy between sersic_index and elliptical_comps_0: rho=0.85
   positive degeneracy between sersic_index and elliptical_comps_1: rho=0.91
centre_0          :     +0.00|                        +0.09  * ***********  +0.12                                                                                                                    |    +0.48
centre_1          :     +0.00|                                                                                      +0.06  *  **              * *   *********** * ***   *  +0.08                     |    +0.10
elliptical_comps_0:      -1.0|                                                         -0.2  **  *****  -0.1                                                                                         |     +1.0
elliptical_comps_1:     +0.00|                                                         +0.04  **              *   *   *** ** **** *****  *****   *  +0.07                                            |    +0.10
einstein_radius   :     +0.00|                                                          +1.18  *****  +1.24                                                                                          |    +3.00
elliptical_comps_0:     +0.00|                                                                                              +0.06  *   **  * * ** **************    **   * *  +0.08                  |    +0.10
elliptical_comps_1:     -0.20|               -0.15  ********  -0.13                                                                                                                                  |    +0.20
centre_0          :     +0.00|         +0.10  ***  +0.11                                                                                                                                             |    +1.00
centre_1          :     -1.00|                                                -0.34  * *****  -0.27                                                                                                  |    +1.00
elliptical_comps_0:      -1.0|                                            -0.4  ******  -0.3                                                                                                         |     +1.0
elliptical_comps_1:     +0.00|       +0.09  ***********     **  +0.19                                                                                                                                |    +1.00
intensity         :   +0.0000|                    +0.0018  ** ********  +0.0024                                                                                                                      |  +0.0100
effective_radius  :      +0.0|       +0.8  *********  +1.3                                                                                                                                           |    +10.0
sersic_index      :      +0.5|                                                                           +2.7  ************      ***  +3.2                                                           |     +5.0

DEBUG:ultranest:iteration=950, ncalls=9555, logz=1216.06, remainder_fraction=100.0000%, Lmin=1237.90, Lmax=1269.88
Traceback (most recent call last):
  File "imaging/searches/parametric/initialization/UltraNest.py", line 89, in <module>
    result = search.fit(model=model, analysis=analysis)
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoFit/autofit/non_linear/abstract_search.py", line 299, in fit
    self._fit(model=model, analysis=analysis, log_likelihood_cap=log_likelihood_cap)
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoFit/autofit/non_linear/nest/ultranest.py", line 185, in _fit
    self.sampler.run(
  File "/home/jammy/venvs/PyAuto/lib/python3.8/site-packages/ultranest/integrator.py", line 2124, in run
    for result in self.run_iter(
  File "/home/jammy/venvs/PyAuto/lib/python3.8/site-packages/ultranest/integrator.py", line 2323, in run_iter
    region_fresh = self._update_region(
  File "/home/jammy/venvs/PyAuto/lib/python3.8/site-packages/ultranest/integrator.py", line 1802, in _update_region
    _update_region_bootstrap(self.region, nbootstraps, minvol, self.comm if self.use_mpi else None, self.mpi_size)
  File "/home/jammy/venvs/PyAuto/lib/python3.8/site-packages/ultranest/integrator.py", line 347, in _update_region_bootstrap
    r, f = region.compute_enlargement(
  File "ultranest/mlfriends.pyx", line 721, in ultranest.mlfriends.MLFriends.compute_enlargement
  File "<__array_function__ internals>", line 5, in inv
  File "/home/jammy/venvs/PyAuto/lib/python3.8/site-packages/numpy/linalg/linalg.py", line 545, in inv
    ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj)
  File "/home/jammy/venvs/PyAuto/lib/python3.8/site-packages/numpy/linalg/linalg.py", line 88, in _raise_linalgerror_singular
    raise LinAlgError("Singular matrix")
numpy.linalg.LinAlgError: Singular matrix

**Error 2:**

DEBUG:ultranest:iteration=559, ncalls=5543, logz=895.65, remainder_fraction=100.0000%, Lmin=911.25, Lmax=937.97
DEBUG:ultranest:iteration=560, ncalls=5553, logz=895.86, remainder_fraction=100.0000%, Lmin=911.44, Lmax=937.97
DEBUG:ultranest:iteration=562, ncalls=5573, logz=896.38, remainder_fraction=100.0000%, Lmin=912.40, Lmax=937.97
DEBUG:ultranest:iteration=564, ncalls=5593, logz=896.97, remainder_fraction=100.0000%, Lmin=912.84, Lmax=937.97
DEBUG:ultranest:iteration=565, ncalls=5603, logz=897.21, remainder_fraction=100.0000%, Lmin=912.92, Lmax=939.97
Traceback (most recent call last):
  File "imaging/searches/parametric/initialization/UltraNest.py", line 90, in <module>
    result = search.fit(model=model, analysis=analysis)
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoFit/autofit/non_linear/abstract_search.py", line 299, in fit
    self._fit(model=model, analysis=analysis, log_likelihood_cap=log_likelihood_cap)
  File "/mnt/c/Users/Jammy/Code/PyAuto/PyAutoFit/autofit/non_linear/nest/ultranest.py", line 185, in _fit
    self.sampler.run(
  File "/home/jammy/venvs/PyAuto/lib/python3.8/site-packages/ultranest/integrator.py", line 2124, in run
    for result in self.run_iter(
  File "/home/jammy/venvs/PyAuto/lib/python3.8/site-packages/ultranest/integrator.py", line 2323, in run_iter
    region_fresh = self._update_region(
  File "/home/jammy/venvs/PyAuto/lib/python3.8/site-packages/ultranest/integrator.py", line 1869, in _update_region
    r, f = _update_region_bootstrap(nextregion, nbootstraps, minvol, self.comm if self.use_mpi else None, self.mpi_size)
  File "/home/jammy/venvs/PyAuto/lib/python3.8/site-packages/ultranest/integrator.py", line 347, in _update_region_bootstrap
    r, f = region.compute_enlargement(
  File "ultranest/mlfriends.pyx", line 727, in ultranest.mlfriends.MLFriends.compute_enlargement
AssertionError: (-1.916767446404755e-21, 23, 15, array([[-4.44208167e-03,  2.92142064e-01, -2.65329781e-01,
        -8.44868962e-02, -4.42092643e-02, -2.19140765e-02,
        -6.99844548e-03,  7.87475158e-02, -1.50341519e-01,
        -9.25057776e-02,  1.80759457e-02,  8.33992292e-03,

Ultranest sets up logging like a standalone application, not a library

  • UltraNest version: 3.2.1
  • Python version: 3.9.5
  • Operating System: Mac OS Catalina

Thank you for Ultranest as it is an incredible nested sampling library -- very fast and efficient. In the interest of improving the application for scientific users, this ticket is submitted to simplify logging configurations.

Description

We are running ultranest.ReactiveNestedSampler(...).run(..., show_status=self.verbose, viz_callback=self.verbose). We set show_statusandviz_callback` to False. We expected logging of every pointrun to stop. It didn't.

This is a request to simplify logging configuration to further the intent of science API users.

What I Did

I traced through Ultranest to witness how logging is set. In method create_logger(...) it is actually instantiating an entire logging setup. This is unusual for a Python application library. Usually, they are simply setting a placeholder per class (or file) to build off the importing application's log configuration by declaring, logger = logging.getLogger(__name__). However, Ultranest is requiring users to go through a complex procedural setup that includes adding a custom log handler just to override internals. To wit, something like this is required simply to change log levels (an additional log configuration to that for the importing application):

ultranest_logger = logging.getLogger("ultranest")
ultranest_handler = logging.StreamHandler(sys.stdout)
ultranest_handler.setLevel(logging.INFO)
ultranest_formatter = logging.Formatter("%(levelname)s:{}:%(message)s".format("ultranest"))
ultranest_handler.setFormatter(ultranest_formatter)
ultranest_logger.addHandler(ultranest_handler)
ultranest_logger.setLevel(logging.INFO)

(The current documented instructions have an error. NOTE the last line and the fourth line which differ from the Q&A. The last line is required to actually override the entire logger's level as setting the handler level directly did not have an effect. Also, the Formatter(...) clause in line four references module_name which is effectively an undefined variable and should be simply "ultranest".)

Many other API libraries simply require a single line bolted on to the importing application's root logging:

logging.getLogger("matplotlib.font_manager").setLevel("WARN")

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

When the importing application itself is misconfigured logging consists of a separate line added into logs for each and every iteration of the sampler. This results in extended and long log files with tens or hundreds of thousands (or more) extra lines of text. Such log files are very large and difficult to review for errors.

Please simplify the logging or at least make the show_status and viz_callback parameters to the run(...) class of methods suppress the extended logging as appropriately set.

what is equivalent of random walk steps in ultranest

  • UltraNest version:
  • Python version:
  • Operating System:

Description

I want to have a fixed number of values for free parameters for each run. I am aware that in emcee package that is done by setting the step number. Could you kindly tell me how I can obtain a similar result in ultranest package?

What I Did

I tried setting the steps and max_nsteps variables but it didn't help.

Vectorized stepsampler

Computationally speaking, step samplers are a tad slow at the moment, because they take little advantage of vectorized likelihoods, proposing one point at a time. A implementation that proposes multiple points at once may be advantageous. This is difficult because it is unknown beforehand whether a step will be accepted or not, producing a large tree of possibilities. However, because most points are accepted, we can optimistically propose.

Generating results from points.hdf5

  • UltraNest version: 3.3.0
  • Python version: 3.9.6
  • Operating System: NA

First off, thanks for a great and very comprehensive package!

I was wondering if it is possible (/ how is best) to generate results (chains/*, info/*, etc.) from a points.hdf5 file without the need to re-evaluate the likelihood?

My use case is that I have a very long MPI run going which regularly times out on the job queue. This run requires several GPU-enabled nodes to evaluate the likelihood (meaning long wait times to get my jobs allocated) and therefore I would like to be able to generate intermediate results from the run without needing to set max_iters/max_ncalls and restart it with the resources necessary to evaluate the likelihood.

I've a feeling that there should be some combination of integrator parameters (num_test_samples, max_iters, max_num_improvement_loops etc.) that will provide me with the desired result, but I can't figure out what they are...

Ultranest for correlated error

Hello, I am quite novice to the concept of bayesian analysis and specifically Ultranest. I plan to use ultranest for spectral modeling of radio fluxes with correlated noise and model comparison. In the example provided for ultranest tutorial, the errors are independent and models are computed accordingly. Could you kindly guide me how I can approach ultranest with correlated error.

For help

  • UltraNest version:lasted
  • Python version:3.7
  • Operating System:ubuntu

Description

How can I do when the number of a model's params more than 323?

What I Did

the cube has length 323. when there are more params,what can do to avoid problem below?
图片

Thanks for your time!

MPI is slow or hangs

MPI runs can hang or be unnecessarily slow.

The reason is a incorrect ordering in the distributed live point evaluations when initially sampling (roots, from the entire prior volume). The bug occurs stochastically, as it depends on the order of MPI ranks returning results.

Efficiency warning when fitting a dataset with a number of duplicates

  • UltraNest version: 2.1.2
  • Python version: 3.7
  • Operating System: Mac OS X 10.14.6

Description

I am trying to use bootstrapping with UltraNest to test the effect of outliers on straight line fits to some data. To do this, the code resamples the original dataset allowing repeats, N times and fits with UltraNest each time. However, if a large enough portion of the resampled dataset are repeats, the fit doesn't finish, and I get the following warning about efficiency:

UserWarning: Sampling from region seems inefficient. You can try increasing nlive, frac_remain, dlogz, dKL, decrease min_ess). [0/40 accepted, it=2500]
warnings.warn("Sampling from region seems inefficient. You can try increasing nlive, frac_remain, dlogz, dKL, decrease min_ess). [%d/%d accepted, it=%d]" % (accepted.sum(), ndraw, nit))

I've tried altering the arguments mentioned in the warning, and also Lepsilon, but the values I've tried haven't fixed the issue. I've also tried narrowing the initial priors on the slope and offset, but the allowed range had to be so small to not actually include the maximum posterior parameters derived from other fits to the data without duplicates.

Fixing the maximum number of duplicates allowed in the resampled dataset worked, but this might bias the interpretation from bootstrapping the data.

What I Did

(Here, df is a pandas dataframe).

def prior_transform(cube):
    params = cube.copy()
    lo = -10.
    hi = +10.
    params[0] = cube[0] * (hi - lo) + lo
    lo = -50.
    hi = +50.
    params[1] = cube[1] * (hi - lo) + lo
    lo = np.log10(0.001)
    hi = np.log10(10)
    params[2] = 10**(cube[2] * (hi - lo) + lo)
    return params

def log_likelihood(params):
    slope, offset, scatter = params
     y_expected = (samples[:,0]) * slope + offset
    probs_samples = scipy.stats.norm(y_expected, scatter).pdf(samples[:,1])
    probs_objects = probs_samples.mean(axis=1)
    assert len(probs_objects) == n_data
    loglike = np.log(probs_objects + 1e-100).sum()
    return loglike

n_data = len(df)
print(str(n_data) + " sources")
bs_df = nh_df.sample(n = n_data, replace = True).reset_index(drop = True)
duplicates = len(bs_df) - len(bs_df.drop_duplicates())

print(str(duplicates) + " dupilicates")
n_data = len(bs_df)

## this generates a sample of points for every datapoint in bs_df, given xPar and yPar
samples = get_samples(bs_df, xPar, yPar)

sampler = ultranest.ReactiveNestedSampler(parameters, log_likelihood, prior_transform, log_dir = saveLoc)
result = sampler.run(Lepsilon = 0.5)

Output is as follows:
26 sources
INFO:ultranest:PointStore: have 0 items
INFO:ultranest:Sampling 400 live points from prior ...
14 dupilicates
Creating directory for new run
DEBUG:ultranest:minimal_widths_sequence: [(-inf, 400.0), (inf, 400.0)]
VBox(children=(HTML(value=''), GridspecLayout(children=(HTML(value="<div style='background-color:#6E6BF4;'>&nb…
Z=-74.9(0.34%) | Like=-67.52..-60.34 [-67.5999..-64.7221] | it/evals=2347/6383 eff=39.2278% N=400 0    
DEBUG:ultranest:clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
Z=-74.0(0.81%) | Like=-66.48..-60.34 [-67.5999..-64.7221] | it/evals=2429/6772 eff=38.1199% N=400 
DEBUG:ultranest:clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
Z=-70.3(26.93%) | Like=-62.48..-57.80 [-62.4761..-62.4759]*| it/evals=3157/10117 eff=32.4895% N=400 
DEBUG:ultranest:clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
Z=-69.3(70.66%) | Like=-61.03..-56.61 [-61.0316..-61.0316]*| it/evals=4046/24286 eff=16.9388% N=400 
DEBUG:ultranest:clustering found some stray points [need_accept=False] (array([1, 2, 3]), array([125, 274,   1]))
Z=-69.3(72.70%) | Like=-60.93..-56.61 [-60.9329..-60.9328]*| it/evals=4129/27378 eff=15.3051% N=400 
DEBUG:ultranest:clustering found some stray points [need_accept=False] (array([1, 2, 3]), array([ 95, 304,   1]))
Z=-69.1(87.03%) | Like=-59.17..-53.94 [-59.1669..-59.0719]*| it/evals=5321/212271 eff=2.5114% N=400 
UserWarning: Sampling from region seems inefficient. You can try increasing nlive, frac_remain, dlogz, dKL, decrease min_ess). [0/40 accepted, it=2500]
  warnings.warn("Sampling from region seems inefficient. You can try increasing nlive, frac_remain, dlogz, dKL, decrease min_ess). [%d/%d accepted, it=%d]" % (accepted.sum(), ndraw, nit))

cython requirement warning

In setup.py, when the from Cython.Build import cythonize import fails, we should display a nice error message to the user, saying "please install cython first".

Logging output to a txt-File?

Dear Johannes

This might a very trivial thing but do you mind explaining here, how one can pipe the output to txt-file in a simple way?
You describe in [1] a method to redirect the output to a logger but I'm not familiar with this module, making it difficult to find a simple solution to the problem.

[1] https://johannesbuchner.github.io/UltraNest/issues.html#frequently-asked-questions

FYI, I tested ultranest and follow your nice explanation, which was very helpful. So far, it works well. I plan to implement it in a scientific project, which will produce a python fitting tool as one outcome.

integrator.py index error

  • UltraNest version: 3.2.0
  • Python version: 3.7.9
  • Operating System: Deepin Linux 20.1

I run BXA in pyxspec, sometimes I got the following errors. It seems that the size of self.region is smaller than self.region_nodes.

"integrator.py", line 2494, in run_iter
self.region.u[worst] = u
IndexError: index 495 is out of bounds for axis 0 with size 484

Crash when the number of points changes on the latest version

  • UltraNest version: 3.3.2
  • Python version: 3.8.8
  • Operating System:
    Operating System: SUSE Linux Enterprise Server 12 SP5
    CPE OS Name: cpe:/o:suse:sles:12:sp5
    Kernel: Linux 4.12.14-122.80-default
    Architecture: x86-64

Description

With the recent version 3.3.2, I am getting an error when the number of living points changes.

What I Did

Z=-4.2(93.28%) | Like=-0.38..-0.01 [-0.3843..-0.3842]*| it/evals=2640/46125 eff=inf% N=400 ^MZ=-4.2(93.85%) | Like=-0.37..-0.01 [-0.3702..-0.3695]*| it/evals=2680/46125 eff=inf% N=400

Mono-modal Volume: ~exp(-7.21)   Expected Volume: exp(-6.75) Quality: ok

   negative degeneracy between $log_{10}(M_{gas}/M_\odot)$ and $Tapering radius, au$: rho=-0.89
   positive degeneracy between $T_{mid}, K$ and $Temperature slope$: rho=0.98
$Tapering radius, au$      :  +3.0e+01|      ******************** ***| +2.0e+02
$log_{10}(M_{gas}/M_\odot)$:      -4.0|         ************* * *    |     -2.0
$Temperature slope$        :      +0.4|******************************|     +0.7
$T_{atm}, K$               :  +2.0e+02| *****************************| +2.0e+03
$T_{mid}, K$               :  +5.0e+01|   ***************************| +4.0e+02

Z=-4.2(94.26%) | Like=-0.35..-0.01 [-0.3535..-0.3530]*| it/evals=2712/47212 eff=249.4940% N=400 ^MZ=-4.2(94.36%) | Like=-0.35..-0.01 [-0.3505..-0.3500]*| it/evals=2720/47212 eff=250.2300% N=400 ^MZ=-4.2(94.60%) | Like=-0.34..-0.01 [-0.3437..-0.3421]*| it/evals=2739/48306 eff=125.5846% N=400 ^MZ=-4.2(94.84%) | Like=-0.33..-0.01 [-0.3341..-0.3340]*| it/evals=2760/48306 eff=126.5475% N=400 ^MZ=-4.2(94.87%) | Like=-0.33..-0.01 [-0.3332..-0.3330]*| it/evals=2763/49391 eff=84.5989% N=400 ^M[ultranest] Explored until L=-0.01
[ultranest] Likelihood function evaluations: 49391
[ultranest] Writing samples and results to disk ...
[ultranest] Writing samples and results to disk ... done
[ultranest]   logZ = -4.278 +- 0
[ultranest] Effective samples strategy satisfied (ESS = 1744.1, need >400)
[ultranest] Posterior uncertainty strategy is satisfied (KL: 0.44+-0.00 nat, need <0.10 nat)
[ultranest] Evidency uncertainty strategy wants 564 minimum live points (dlogz from 0.12 to 0.12, need <0.1)
[ultranest]   logZ error budget: single: 0.08 bs:0.00 tail:0.05 total:0.05 required:<0.10
[ultranest] Widening roots to 798 live points (have 400 already) ...
[ultranest] Sampling 398 live points from prior ...
  File "/cobra/u/smirngre/soft/UltraNest/ultranest/integrator.py", line 2596, in run_iter
  File "/cobra/u/smirngre/soft/UltraNest/ultranest/integrator.py", line 1356, in _widen_roots
  File "<__array_function__ internals>", line 5, in concatenate
ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 398 has 1 dimension(s)

(I am not sure I recreated them in the correct order)

Here is the log as I ran it first for half an hour, then the process was killed by the slurm, and then I resumed. It started fine, but then crashed when the number of living points changed, and crashed again the same way when I restarted.

13:08:10 [ultranest] [DEBUG] ReactiveNestedSampler: dims=5+0, resume=True, log_dir=ultranest, backend=hdf5, vectorized=False, nbootstraps=30, ndraw=128..65536
13:08:53 [ultranest] [INFO] Sampling 400 live points from prior ...
13:10:22 [ultranest] [DEBUG] run_iter dlogz=0.1, dKL=0.1, frac_remain=0.05, Lepsilon=0.0100, min_ess=400
13:10:22 [ultranest] [DEBUG] max_iters=-1, max_ncalls=-1, max_num_improvement_loops=-1, min_num_live_points=400, cluster_num_live_points=40
13:10:22 [ultranest] [DEBUG] minimal_widths_sequence: [(-inf, 400.0), (inf, 400.0)]
13:10:42 [ultranest] [DEBUG] iteration=0, ncalls=520, logz=-inf, remainder_fraction=100.0000%, Lmin=-3503.33, Lmax=-0.55
13:10:42 [ultranest] [DEBUG] iteration=40, ncalls=520, logz=-266.58, remainder_fraction=100.0000%, Lmin=-243.21, Lmax=-0.55
13:10:42 [ultranest] [DEBUG] iteration=80, ncalls=520, logz=-83.38, remainder_fraction=100.0000%, Lmin=-76.16, Lmax=-0.55
13:10:42 [ultranest] [DEBUG] iteration=90, ncalls=520, logz=-66.15, remainder_fraction=100.0000%, Lmin=-58.15, Lmax=-0.55
13:11:02 [ultranest] [DEBUG] iteration=106, ncalls=640, logz=-41.28, remainder_fraction=100.0000%, Lmin=-35.17, Lmax=-0.55
13:11:02 [ultranest] [DEBUG] iteration=120, ncalls=640, logz=-33.22, remainder_fraction=100.0000%, Lmin=-28.08, Lmax=-0.55
13:11:02 [ultranest] [DEBUG] iteration=160, ncalls=640, logz=-28.58, remainder_fraction=100.0000%, Lmin=-24.92, Lmax=-0.55
13:11:23 [ultranest] [DEBUG] iteration=194, ncalls=760, logz=-25.76, remainder_fraction=100.0000%, Lmin=-21.70, Lmax=-0.55
13:11:23 [ultranest] [DEBUG] iteration=200, ncalls=760, logz=-25.23, remainder_fraction=100.0000%, Lmin=-21.21, Lmax=-0.55
13:11:23 [ultranest] [DEBUG] iteration=240, ncalls=760, logz=-22.32, remainder_fraction=100.0000%, Lmin=-18.53, Lmax=-0.55
13:11:43 [ultranest] [DEBUG] iteration=261, ncalls=880, logz=-21.20, remainder_fraction=100.0000%, Lmin=-17.54, Lmax=-0.55
13:11:43 [ultranest] [DEBUG] iteration=280, ncalls=880, logz=-20.25, remainder_fraction=100.0000%, Lmin=-16.54, Lmax=-0.55
13:12:03 [ultranest] [DEBUG] iteration=319, ncalls=1000, logz=-18.45, remainder_fraction=99.9999%, Lmin=-14.92, Lmax=-0.55
13:12:03 [ultranest] [DEBUG] iteration=320, ncalls=1000, logz=-18.41, remainder_fraction=99.9999%, Lmin=-14.84, Lmax=-0.55
13:12:03 [ultranest] [DEBUG] iteration=360, ncalls=1000, logz=-16.73, remainder_fraction=99.9996%, Lmin=-13.00, Lmax=-0.55
13:16:28 [ultranest] [DEBUG] ReactiveNestedSampler: dims=5+0, resume=True, log_dir=ultranest, backend=hdf5, vectorized=False, nbootstraps=30, ndraw=128..65536
13:16:54 [ultranest] [DEBUG] Testing resume consistency: [-1.49171366e+01 -1.22306280e+01  0.00000000e+00  3.29514736e-01
  6.32361044e-01  9.60940081e-01  3.40401888e-01  2.32443817e-01
  8.60175051e+01 -2.73527791e+00  6.88282024e-01  8.12723398e+02
  1.31355336e+02]: u=[0.32951474 0.63236104 0.96094008 0.34040189 0.23244382] -> p=[ 8.60175051e+01 -2.73527791e+00  6.88282024e-01  8.12723398e+02
  1.31355336e+02] -> L=-12.230627982784394
13:17:15 [ultranest] [INFO] Resuming from 822 stored points
13:17:15 [ultranest] [DEBUG] run_iter dlogz=0.1, dKL=0.1, frac_remain=0.05, Lepsilon=0.0100, min_ess=400
13:17:15 [ultranest] [DEBUG] max_iters=-1, max_ncalls=-1, max_num_improvement_loops=-1, min_num_live_points=400, cluster_num_live_points=40
13:17:15 [ultranest] [DEBUG] minimal_widths_sequence: [(-inf, 400.0), (inf, 400.0)]
13:17:47 [ultranest] [DEBUG] iteration=0, ncalls=1000, logz=-inf, remainder_fraction=100.0000%, Lmin=-3503.33, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] iteration=40, ncalls=1000, logz=-266.58, remainder_fraction=100.0000%, Lmin=-243.21, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] iteration=80, ncalls=1000, logz=-83.38, remainder_fraction=100.0000%, Lmin=-76.16, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] iteration=90, ncalls=1000, logz=-66.15, remainder_fraction=100.0000%, Lmin=-58.15, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] iteration=120, ncalls=1000, logz=-33.22, remainder_fraction=100.0000%, Lmin=-28.08, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] iteration=160, ncalls=1000, logz=-28.58, remainder_fraction=100.0000%, Lmin=-24.92, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] iteration=180, ncalls=1000, logz=-27.11, remainder_fraction=100.0000%, Lmin=-22.77, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] iteration=200, ncalls=1000, logz=-25.23, remainder_fraction=100.0000%, Lmin=-21.21, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] iteration=240, ncalls=1000, logz=-22.32, remainder_fraction=100.0000%, Lmin=-18.53, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
13:17:47 [ultranest] [DEBUG] iteration=280, ncalls=1000, logz=-20.25, remainder_fraction=100.0000%, Lmin=-16.54, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] iteration=320, ncalls=1000, logz=-18.41, remainder_fraction=99.9999%, Lmin=-14.84, Lmax=-0.55
13:17:47 [ultranest] [DEBUG] iteration=360, ncalls=1000, logz=-16.73, remainder_fraction=99.9996%, Lmin=-13.00, Lmax=-0.55
13:18:32 [ultranest] [DEBUG] iteration=374, ncalls=2280, logz=-16.13, remainder_fraction=99.9992%, Lmin=-12.41, Lmax=-0.55
13:18:32 [ultranest] [DEBUG] iteration=400, ncalls=2280, logz=-15.23, remainder_fraction=99.9980%, Lmin=-11.65, Lmax=-0.55
13:18:32 [ultranest] [DEBUG] iteration=440, ncalls=2280, logz=-14.11, remainder_fraction=99.9939%, Lmin=-10.71, Lmax=-0.46
13:18:32 [ultranest] [DEBUG] iteration=480, ncalls=2280, logz=-13.26, remainder_fraction=99.9863%, Lmin=-10.04, Lmax=-0.46
13:18:32 [ultranest] [DEBUG] iteration=520, ncalls=2280, logz=-12.53, remainder_fraction=99.9729%, Lmin=-9.23, Lmax=-0.46
13:18:32 [ultranest] [DEBUG] clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
13:18:32 [ultranest] [DEBUG] iteration=560, ncalls=2280, logz=-11.89, remainder_fraction=99.9464%, Lmin=-8.73, Lmax=-0.46
13:18:32 [ultranest] [DEBUG] iteration=600, ncalls=2280, logz=-11.30, remainder_fraction=99.9038%, Lmin=-7.96, Lmax=-0.46
13:18:32 [ultranest] [DEBUG] iteration=640, ncalls=2280, logz=-10.72, remainder_fraction=99.8373%, Lmin=-7.43, Lmax=-0.45
13:18:32 [ultranest] [DEBUG] iteration=680, ncalls=2280, logz=-10.11, remainder_fraction=99.7050%, Lmin=-6.68, Lmax=-0.45
13:18:32 [ultranest] [DEBUG] iteration=720, ncalls=2280, logz=-9.59, remainder_fraction=99.5115%, Lmin=-6.20, Lmax=-0.45
13:18:32 [ultranest] [DEBUG] iteration=760, ncalls=2280, logz=-9.15, remainder_fraction=99.2361%, Lmin=-5.73, Lmax=-0.39
13:19:15 [ultranest] [DEBUG] iteration=764, ncalls=3560, logz=-9.10, remainder_fraction=99.1963%, Lmin=-5.69, Lmax=-0.39
13:19:15 [ultranest] [DEBUG] iteration=800, ncalls=3560, logz=-8.72, remainder_fraction=98.8527%, Lmin=-5.33, Lmax=-0.33
13:19:15 [ultranest] [DEBUG] iteration=840, ncalls=3560, logz=-8.30, remainder_fraction=98.2992%, Lmin=-4.77, Lmax=-0.33
13:19:15 [ultranest] [DEBUG] iteration=880, ncalls=3560, logz=-7.91, remainder_fraction=97.5320%, Lmin=-4.38, Lmax=-0.33
13:19:15 [ultranest] [DEBUG] iteration=920, ncalls=3560, logz=-7.54, remainder_fraction=96.4367%, Lmin=-3.97, Lmax=-0.26
13:19:15 [ultranest] [DEBUG] iteration=960, ncalls=3560, logz=-7.20, remainder_fraction=94.9681%, Lmin=-3.62, Lmax=-0.26
13:19:16 [ultranest] [DEBUG] iteration=1000, ncalls=3560, logz=-6.91, remainder_fraction=93.3339%, Lmin=-3.41, Lmax=-0.26
13:20:00 [ultranest] [DEBUG] iteration=1007, ncalls=4840, logz=-6.86, remainder_fraction=93.0061%, Lmin=-3.34, Lmax=-0.26
13:20:00 [ultranest] [DEBUG] iteration=1040, ncalls=4840, logz=-6.65, remainder_fraction=91.3085%, Lmin=-3.16, Lmax=-0.26
13:20:00 [ultranest] [DEBUG] iteration=1080, ncalls=4840, logz=-6.41, remainder_fraction=89.3956%, Lmin=-2.91, Lmax=-0.21
13:20:00 [ultranest] [DEBUG] iteration=1120, ncalls=4840, logz=-6.21, remainder_fraction=87.2515%, Lmin=-2.80, Lmax=-0.21
13:20:00 [ultranest] [DEBUG] iteration=1160, ncalls=4840, logz=-6.03, remainder_fraction=84.8927%, Lmin=-2.59, Lmax=-0.21
13:20:43 [ultranest] [DEBUG] iteration=1167, ncalls=6120, logz=-6.00, remainder_fraction=84.4594%, Lmin=-2.53, Lmax=-0.21
13:20:43 [ultranest] [DEBUG] iteration=1200, ncalls=6120, logz=-5.86, remainder_fraction=82.1579%, Lmin=-2.38, Lmax=-0.21
13:20:43 [ultranest] [DEBUG] iteration=1240, ncalls=6120, logz=-5.71, remainder_fraction=79.2065%, Lmin=-2.21, Lmax=-0.21
13:20:43 [ultranest] [DEBUG] iteration=1280, ncalls=6120, logz=-5.57, remainder_fraction=75.9271%, Lmin=-2.08, Lmax=-0.21
13:21:27 [ultranest] [DEBUG] iteration=1300, ncalls=7400, logz=-5.50, remainder_fraction=74.1952%, Lmin=-1.99, Lmax=-0.21
13:21:27 [ultranest] [DEBUG] iteration=1320, ncalls=7400, logz=-5.44, remainder_fraction=72.5026%, Lmin=-1.94, Lmax=-0.03
13:21:27 [ultranest] [DEBUG] iteration=1360, ncalls=7400, logz=-5.32, remainder_fraction=68.9207%, Lmin=-1.81, Lmax=-0.03
13:22:10 [ultranest] [DEBUG] iteration=1394, ncalls=8680, logz=-5.23, remainder_fraction=65.9066%, Lmin=-1.72, Lmax=-0.03
13:22:10 [ultranest] [DEBUG] iteration=1400, ncalls=8680, logz=-5.21, remainder_fraction=65.3345%, Lmin=-1.71, Lmax=-0.03
13:22:10 [ultranest] [DEBUG] iteration=1440, ncalls=8680, logz=-5.12, remainder_fraction=61.7966%, Lmin=-1.64, Lmax=-0.03
13:22:54 [ultranest] [DEBUG] iteration=1460, ncalls=9960, logz=-5.08, remainder_fraction=60.2661%, Lmin=-1.60, Lmax=-0.03
13:22:54 [ultranest] [DEBUG] iteration=1480, ncalls=9960, logz=-5.04, remainder_fraction=58.4329%, Lmin=-1.56, Lmax=-0.03
13:22:54 [ultranest] [DEBUG] iteration=1520, ncalls=9960, logz=-4.96, remainder_fraction=55.3254%, Lmin=-1.47, Lmax=-0.03
13:23:38 [ultranest] [DEBUG] iteration=1539, ncalls=11240, logz=-4.93, remainder_fraction=53.9398%, Lmin=-1.43, Lmax=-0.03
13:23:38 [ultranest] [DEBUG] iteration=1560, ncalls=11240, logz=-4.89, remainder_fraction=52.1975%, Lmin=-1.40, Lmax=-0.03
13:23:38 [ultranest] [DEBUG] iteration=1600, ncalls=11240, logz=-4.83, remainder_fraction=48.9275%, Lmin=-1.34, Lmax=-0.03
13:24:21 [ultranest] [DEBUG] iteration=1609, ncalls=12520, logz=-4.81, remainder_fraction=48.1538%, Lmin=-1.32, Lmax=-0.03
13:24:21 [ultranest] [DEBUG] iteration=1640, ncalls=12520, logz=-4.77, remainder_fraction=45.8320%, Lmin=-1.27, Lmax=-0.03
13:25:04 [ultranest] [DEBUG] iteration=1671, ncalls=13800, logz=-4.73, remainder_fraction=43.5299%, Lmin=-1.23, Lmax=-0.03
13:25:04 [ultranest] [DEBUG] iteration=1680, ncalls=13800, logz=-4.72, remainder_fraction=42.9151%, Lmin=-1.23, Lmax=-0.03
13:25:04 [ultranest] [DEBUG] iteration=1710, ncalls=13800, logz=-4.68, remainder_fraction=40.7870%, Lmin=-1.18, Lmax=-0.03
13:25:04 [ultranest] [DEBUG] iteration=1720, ncalls=13800, logz=-4.67, remainder_fraction=40.0820%, Lmin=-1.17, Lmax=-0.03
13:25:50 [ultranest] [DEBUG] iteration=1724, ncalls=15080, logz=-4.67, remainder_fraction=39.8337%, Lmin=-1.17, Lmax=-0.03
13:25:50 [ultranest] [DEBUG] iteration=1760, ncalls=15080, logz=-4.63, remainder_fraction=37.4712%, Lmin=-1.13, Lmax=-0.03
13:26:34 [ultranest] [DEBUG] iteration=1772, ncalls=16360, logz=-4.62, remainder_fraction=36.6409%, Lmin=-1.13, Lmax=-0.03
13:26:34 [ultranest] [DEBUG] iteration=1800, ncalls=16360, logz=-4.59, remainder_fraction=35.0385%, Lmin=-1.10, Lmax=-0.03
13:27:17 [ultranest] [DEBUG] iteration=1829, ncalls=17640, logz=-4.56, remainder_fraction=33.3130%, Lmin=-1.07, Lmax=-0.03
13:27:17 [ultranest] [DEBUG] iteration=1840, ncalls=17640, logz=-4.55, remainder_fraction=32.6755%, Lmin=-1.04, Lmax=-0.03
13:27:17 [ultranest] [DEBUG] iteration=1880, ncalls=17640, logz=-4.52, remainder_fraction=30.6079%, Lmin=-1.00, Lmax=-0.03
13:28:00 [ultranest] [DEBUG] iteration=1882, ncalls=18920, logz=-4.52, remainder_fraction=30.5100%, Lmin=-0.99, Lmax=-0.03
13:28:00 [ultranest] [DEBUG] iteration=1920, ncalls=18920, logz=-4.49, remainder_fraction=28.4986%, Lmin=-0.95, Lmax=-0.03
13:28:44 [ultranest] [DEBUG] iteration=1930, ncalls=20200, logz=-4.49, remainder_fraction=27.9641%, Lmin=-0.93, Lmax=-0.03
13:28:44 [ultranest] [DEBUG] iteration=1960, ncalls=20200, logz=-4.47, remainder_fraction=26.5014%, Lmin=-0.91, Lmax=-0.03
13:29:27 [ultranest] [DEBUG] iteration=1970, ncalls=21480, logz=-4.46, remainder_fraction=26.0679%, Lmin=-0.90, Lmax=-0.03
13:29:27 [ultranest] [DEBUG] iteration=2000, ncalls=21480, logz=-4.44, remainder_fraction=24.6253%, Lmin=-0.87, Lmax=-0.03
13:30:11 [ultranest] [DEBUG] iteration=2015, ncalls=22759, logz=-4.43, remainder_fraction=23.9611%, Lmin=-0.86, Lmax=-0.03
13:30:11 [ultranest] [DEBUG] iteration=2040, ncalls=22759, logz=-4.42, remainder_fraction=22.8879%, Lmin=-0.83, Lmax=-0.03
13:30:55 [ultranest] [DEBUG] iteration=2055, ncalls=24038, logz=-4.41, remainder_fraction=22.1828%, Lmin=-0.81, Lmax=-0.03
13:30:55 [ultranest] [DEBUG] iteration=2080, ncalls=24038, logz=-4.40, remainder_fraction=21.1788%, Lmin=-0.78, Lmax=-0.03
13:31:39 [ultranest] [DEBUG] iteration=2086, ncalls=25318, logz=-4.39, remainder_fraction=20.9364%, Lmin=-0.78, Lmax=-0.03
13:32:24 [ultranest] [DEBUG] iteration=2118, ncalls=26598, logz=-4.38, remainder_fraction=19.6661%, Lmin=-0.74, Lmax=-0.03
13:32:24 [ultranest] [DEBUG] iteration=2120, ncalls=26598, logz=-4.38, remainder_fraction=19.5983%, Lmin=-0.74, Lmax=-0.03
13:33:14 [ultranest] [DEBUG] iteration=2154, ncalls=27878, logz=-4.36, remainder_fraction=18.4066%, Lmin=-0.71, Lmax=-0.01
13:33:14 [ultranest] [DEBUG] iteration=2160, ncalls=27878, logz=-4.36, remainder_fraction=18.1847%, Lmin=-0.71, Lmax=-0.01
13:33:58 [ultranest] [DEBUG] iteration=2176, ncalls=29147, logz=-4.35, remainder_fraction=17.6541%, Lmin=-0.69, Lmax=-0.01
13:33:58 [ultranest] [DEBUG] iteration=2200, ncalls=29147, logz=-4.34, remainder_fraction=16.8117%, Lmin=-0.67, Lmax=-0.01
13:34:41 [ultranest] [DEBUG] iteration=2216, ncalls=30412, logz=-4.34, remainder_fraction=16.3118%, Lmin=-0.65, Lmax=-0.01
13:34:41 [ultranest] [DEBUG] iteration=2240, ncalls=30412, logz=-4.33, remainder_fraction=15.5803%, Lmin=-0.64, Lmax=-0.01
13:34:41 [ultranest] [DEBUG] clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
13:35:24 [ultranest] [DEBUG] iteration=2262, ncalls=31675, logz=-4.32, remainder_fraction=14.9475%, Lmin=-0.62, Lmax=-0.01
13:35:24 [ultranest] [DEBUG] iteration=2280, ncalls=31675, logz=-4.31, remainder_fraction=14.3684%, Lmin=-0.60, Lmax=-0.01
13:36:08 [ultranest] [DEBUG] iteration=2313, ncalls=32936, logz=-4.30, remainder_fraction=13.4560%, Lmin=-0.58, Lmax=-0.01
13:36:08 [ultranest] [DEBUG] iteration=2320, ncalls=32936, logz=-4.30, remainder_fraction=13.2576%, Lmin=-0.58, Lmax=-0.01
13:36:50 [ultranest] [DEBUG] iteration=2350, ncalls=34191, logz=-4.29, remainder_fraction=12.4921%, Lmin=-0.56, Lmax=-0.01
13:36:50 [ultranest] [DEBUG] iteration=2360, ncalls=34191, logz=-4.29, remainder_fraction=12.2455%, Lmin=-0.55, Lmax=-0.01
13:37:40 [ultranest] [DEBUG] iteration=2392, ncalls=35445, logz=-4.28, remainder_fraction=11.4913%, Lmin=-0.53, Lmax=-0.01
13:37:40 [ultranest] [DEBUG] iteration=2400, ncalls=35445, logz=-4.28, remainder_fraction=11.3105%, Lmin=-0.52, Lmax=-0.01
13:38:27 [ultranest] [DEBUG] iteration=2430, ncalls=36660, logz=-4.27, remainder_fraction=10.5926%, Lmin=-0.50, Lmax=-0.01
13:38:27 [ultranest] [DEBUG] iteration=2440, ncalls=36660, logz=-4.27, remainder_fraction=10.3732%, Lmin=-0.49, Lmax=-0.01
13:39:08 [ultranest] [DEBUG] iteration=2477, ncalls=37866, logz=-4.26, remainder_fraction=9.5909%, Lmin=-0.48, Lmax=-0.01
13:39:08 [ultranest] [DEBUG] iteration=2480, ncalls=37866, logz=-4.26, remainder_fraction=9.5317%, Lmin=-0.47, Lmax=-0.01
13:39:51 [ultranest] [DEBUG] iteration=2501, ncalls=39058, logz=-4.25, remainder_fraction=9.1052%, Lmin=-0.46, Lmax=-0.01
13:39:51 [ultranest] [DEBUG] iteration=2520, ncalls=39058, logz=-4.25, remainder_fraction=8.7372%, Lmin=-0.45, Lmax=-0.01
13:40:34 [ultranest] [DEBUG] iteration=2532, ncalls=40233, logz=-4.25, remainder_fraction=8.5171%, Lmin=-0.44, Lmax=-0.01
13:41:15 [ultranest] [DEBUG] iteration=2559, ncalls=41408, logz=-4.24, remainder_fraction=8.0396%, Lmin=-0.43, Lmax=-0.01
13:41:15 [ultranest] [DEBUG] iteration=2560, ncalls=41408, logz=-4.24, remainder_fraction=8.0205%, Lmin=-0.43, Lmax=-0.01
13:41:56 [ultranest] [DEBUG] iteration=2590, ncalls=42597, logz=-4.23, remainder_fraction=7.5158%, Lmin=-0.41, Lmax=-0.01
13:41:56 [ultranest] [DEBUG] iteration=2600, ncalls=42597, logz=-4.23, remainder_fraction=7.3461%, Lmin=-0.41, Lmax=-0.01
13:42:36 [ultranest] [DEBUG] iteration=2626, ncalls=43777, logz=-4.23, remainder_fraction=6.9315%, Lmin=-0.39, Lmax=-0.01
13:42:36 [ultranest] [DEBUG] iteration=2640, ncalls=43777, logz=-4.23, remainder_fraction=6.7204%, Lmin=-0.38, Lmax=-0.01
13:43:16 [ultranest] [DEBUG] iteration=2648, ncalls=44943, logz=-4.23, remainder_fraction=6.6011%, Lmin=-0.38, Lmax=-0.01
13:43:58 [ultranest] [DEBUG] iteration=2677, ncalls=46125, logz=-4.22, remainder_fraction=6.1918%, Lmin=-0.37, Lmax=-0.01
13:43:58 [ultranest] [DEBUG] iteration=2680, ncalls=46125, logz=-4.22, remainder_fraction=6.1488%, Lmin=-0.37, Lmax=-0.01
13:44:38 [ultranest] [DEBUG] iteration=2712, ncalls=47272, logz=-4.22, remainder_fraction=5.7368%, Lmin=-0.35, Lmax=-0.01
13:44:38 [ultranest] [DEBUG] iteration=2720, ncalls=47272, logz=-4.21, remainder_fraction=5.6349%, Lmin=-0.35, Lmax=-0.01
13:45:19 [ultranest] [DEBUG] iteration=2733, ncalls=48437, logz=-4.21, remainder_fraction=5.4729%, Lmin=-0.35, Lmax=-0.01
13:50:21 [ultranest] [DEBUG] ReactiveNestedSampler: dims=5+0, resume=True, log_dir=ultranest, backend=hdf5, vectorized=False, nbootstraps=30, ndraw=128..65536
13:51:02 [ultranest] [DEBUG] Testing resume consistency: [-3.71737116e-01 -3.20741040e-01  0.00000000e+00  5.39214878e-01
  3.86956953e-01  6.72768769e-01  8.73180552e-01  6.72118570e-01
  1.21666529e+02 -3.22608609e+00  6.01830631e-01  1.77172499e+03
  2.85241500e+02]: u=[0.53921488 0.38695695 0.67276877 0.87318055 0.67211857] -> p=[ 1.21666529e+02 -3.22608609e+00  6.01830631e-01  1.77172499e+03
  2.85241500e+02] -> L=-0.3207410403537414
13:51:25 [ultranest] [INFO] Resuming from 3618 stored points
13:51:26 [ultranest] [DEBUG] run_iter dlogz=0.1, dKL=0.1, frac_remain=0.05, Lepsilon=0.0100, min_ess=400
13:51:26 [ultranest] [DEBUG] max_iters=-1, max_ncalls=-1, max_num_improvement_loops=-1, min_num_live_points=400, cluster_num_live_points=40
13:51:26 [ultranest] [DEBUG] minimal_widths_sequence: [(-inf, 400.0), (inf, 400.0)]
13:51:31 [ultranest] [DEBUG] iteration=0, ncalls=46125, logz=-inf, remainder_fraction=100.0000%, Lmin=-3503.33, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=40, ncalls=46125, logz=-266.58, remainder_fraction=100.0000%, Lmin=-243.21, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=80, ncalls=46125, logz=-83.38, remainder_fraction=100.0000%, Lmin=-76.16, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=90, ncalls=46125, logz=-66.15, remainder_fraction=100.0000%, Lmin=-58.15, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=120, ncalls=46125, logz=-33.22, remainder_fraction=100.0000%, Lmin=-28.08, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=160, ncalls=46125, logz=-28.58, remainder_fraction=100.0000%, Lmin=-24.92, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=200, ncalls=46125, logz=-25.23, remainder_fraction=100.0000%, Lmin=-21.21, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=240, ncalls=46125, logz=-22.32, remainder_fraction=100.0000%, Lmin=-18.53, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=280, ncalls=46125, logz=-20.25, remainder_fraction=100.0000%, Lmin=-16.54, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=320, ncalls=46125, logz=-18.41, remainder_fraction=99.9999%, Lmin=-14.84, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=360, ncalls=46125, logz=-16.73, remainder_fraction=99.9996%, Lmin=-13.00, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=400, ncalls=46125, logz=-15.23, remainder_fraction=99.9980%, Lmin=-11.65, Lmax=-0.55
13:51:31 [ultranest] [DEBUG] iteration=440, ncalls=46125, logz=-14.11, remainder_fraction=99.9939%, Lmin=-10.71, Lmax=-0.46
13:51:31 [ultranest] [DEBUG] iteration=450, ncalls=46125, logz=-13.87, remainder_fraction=99.9922%, Lmin=-10.49, Lmax=-0.46
13:51:31 [ultranest] [DEBUG] iteration=480, ncalls=46125, logz=-13.26, remainder_fraction=99.9863%, Lmin=-10.04, Lmax=-0.46
13:51:31 [ultranest] [DEBUG] iteration=520, ncalls=46125, logz=-12.53, remainder_fraction=99.9729%, Lmin=-9.23, Lmax=-0.46
13:51:31 [ultranest] [DEBUG] iteration=560, ncalls=46125, logz=-11.89, remainder_fraction=99.9464%, Lmin=-8.73, Lmax=-0.46
13:51:32 [ultranest] [DEBUG] iteration=600, ncalls=46125, logz=-11.30, remainder_fraction=99.9038%, Lmin=-7.96, Lmax=-0.46
13:51:32 [ultranest] [DEBUG] iteration=630, ncalls=46125, logz=-10.86, remainder_fraction=99.8564%, Lmin=-7.59, Lmax=-0.45
13:51:32 [ultranest] [DEBUG] iteration=640, ncalls=46125, logz=-10.72, remainder_fraction=99.8373%, Lmin=-7.43, Lmax=-0.45
13:51:32 [ultranest] [DEBUG] iteration=680, ncalls=46125, logz=-10.11, remainder_fraction=99.7050%, Lmin=-6.68, Lmax=-0.45
13:51:32 [ultranest] [DEBUG] iteration=720, ncalls=46125, logz=-9.59, remainder_fraction=99.5115%, Lmin=-6.20, Lmax=-0.45
13:51:32 [ultranest] [DEBUG] iteration=760, ncalls=46125, logz=-9.15, remainder_fraction=99.2361%, Lmin=-5.73, Lmax=-0.39
13:51:32 [ultranest] [DEBUG] iteration=800, ncalls=46125, logz=-8.72, remainder_fraction=98.8527%, Lmin=-5.33, Lmax=-0.33
13:51:32 [ultranest] [DEBUG] iteration=840, ncalls=46125, logz=-8.30, remainder_fraction=98.2992%, Lmin=-4.77, Lmax=-0.33
13:51:32 [ultranest] [DEBUG] iteration=880, ncalls=46125, logz=-7.91, remainder_fraction=97.5320%, Lmin=-4.38, Lmax=-0.33
13:51:32 [ultranest] [DEBUG] iteration=920, ncalls=46125, logz=-7.54, remainder_fraction=96.4367%, Lmin=-3.97, Lmax=-0.26
13:51:32 [ultranest] [DEBUG] iteration=960, ncalls=46125, logz=-7.20, remainder_fraction=94.9681%, Lmin=-3.62, Lmax=-0.26
13:51:32 [ultranest] [DEBUG] iteration=990, ncalls=46125, logz=-6.98, remainder_fraction=93.7590%, Lmin=-3.44, Lmax=-0.26
13:51:32 [ultranest] [DEBUG] iteration=1000, ncalls=46125, logz=-6.91, remainder_fraction=93.3339%, Lmin=-3.41, Lmax=-0.26
13:51:32 [ultranest] [DEBUG] iteration=1040, ncalls=46125, logz=-6.65, remainder_fraction=91.3085%, Lmin=-3.16, Lmax=-0.26
13:51:32 [ultranest] [DEBUG] iteration=1080, ncalls=46125, logz=-6.41, remainder_fraction=89.3956%, Lmin=-2.91, Lmax=-0.21
13:51:32 [ultranest] [DEBUG] iteration=1120, ncalls=46125, logz=-6.21, remainder_fraction=87.2515%, Lmin=-2.80, Lmax=-0.21
13:51:32 [ultranest] [DEBUG] iteration=1160, ncalls=46125, logz=-6.03, remainder_fraction=84.8927%, Lmin=-2.59, Lmax=-0.21
13:51:32 [ultranest] [DEBUG] iteration=1170, ncalls=46125, logz=-5.99, remainder_fraction=84.2771%, Lmin=-2.50, Lmax=-0.21
13:51:32 [ultranest] [DEBUG] iteration=1200, ncalls=46125, logz=-5.86, remainder_fraction=82.1579%, Lmin=-2.38, Lmax=-0.21
13:51:32 [ultranest] [DEBUG] iteration=1240, ncalls=46125, logz=-5.71, remainder_fraction=79.2065%, Lmin=-2.21, Lmax=-0.21
13:51:32 [ultranest] [DEBUG] iteration=1280, ncalls=46125, logz=-5.57, remainder_fraction=75.9271%, Lmin=-2.08, Lmax=-0.21
13:51:32 [ultranest] [DEBUG] iteration=1320, ncalls=46125, logz=-5.44, remainder_fraction=72.5026%, Lmin=-1.94, Lmax=-0.03
13:51:32 [ultranest] [DEBUG] iteration=1360, ncalls=46125, logz=-5.32, remainder_fraction=68.9207%, Lmin=-1.81, Lmax=-0.03
13:51:32 [ultranest] [DEBUG] iteration=1400, ncalls=46125, logz=-5.21, remainder_fraction=65.3345%, Lmin=-1.71, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1440, ncalls=46125, logz=-5.12, remainder_fraction=61.7966%, Lmin=-1.64, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1480, ncalls=46125, logz=-5.04, remainder_fraction=58.4329%, Lmin=-1.56, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1520, ncalls=46125, logz=-4.96, remainder_fraction=55.3254%, Lmin=-1.47, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1560, ncalls=46125, logz=-4.89, remainder_fraction=52.1975%, Lmin=-1.40, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1600, ncalls=46125, logz=-4.83, remainder_fraction=48.9275%, Lmin=-1.34, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1640, ncalls=46125, logz=-4.77, remainder_fraction=45.8320%, Lmin=-1.27, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1680, ncalls=46125, logz=-4.72, remainder_fraction=42.9151%, Lmin=-1.23, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1720, ncalls=46125, logz=-4.67, remainder_fraction=40.0820%, Lmin=-1.17, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1760, ncalls=46125, logz=-4.63, remainder_fraction=37.4712%, Lmin=-1.13, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1800, ncalls=46125, logz=-4.59, remainder_fraction=35.0385%, Lmin=-1.10, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1840, ncalls=46125, logz=-4.55, remainder_fraction=32.6755%, Lmin=-1.04, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1880, ncalls=46125, logz=-4.52, remainder_fraction=30.6079%, Lmin=-1.00, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1890, ncalls=46125, logz=-4.51, remainder_fraction=30.0433%, Lmin=-0.99, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1920, ncalls=46125, logz=-4.49, remainder_fraction=28.4986%, Lmin=-0.95, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=1960, ncalls=46125, logz=-4.47, remainder_fraction=26.5014%, Lmin=-0.91, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=2000, ncalls=46125, logz=-4.44, remainder_fraction=24.6253%, Lmin=-0.87, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=2040, ncalls=46125, logz=-4.42, remainder_fraction=22.8879%, Lmin=-0.83, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
13:51:33 [ultranest] [DEBUG] iteration=2080, ncalls=46125, logz=-4.40, remainder_fraction=21.1788%, Lmin=-0.78, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=2120, ncalls=46125, logz=-4.38, remainder_fraction=19.5983%, Lmin=-0.74, Lmax=-0.03
13:51:33 [ultranest] [DEBUG] iteration=2160, ncalls=46125, logz=-4.36, remainder_fraction=18.1847%, Lmin=-0.71, Lmax=-0.01
13:51:33 [ultranest] [DEBUG] iteration=2200, ncalls=46125, logz=-4.34, remainder_fraction=16.8117%, Lmin=-0.67, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2240, ncalls=46125, logz=-4.33, remainder_fraction=15.5803%, Lmin=-0.64, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
13:51:34 [ultranest] [DEBUG] iteration=2280, ncalls=46125, logz=-4.31, remainder_fraction=14.3684%, Lmin=-0.60, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2320, ncalls=46125, logz=-4.30, remainder_fraction=13.2576%, Lmin=-0.58, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2360, ncalls=46125, logz=-4.29, remainder_fraction=12.2455%, Lmin=-0.55, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2400, ncalls=46125, logz=-4.28, remainder_fraction=11.3105%, Lmin=-0.52, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2430, ncalls=46125, logz=-4.27, remainder_fraction=10.5926%, Lmin=-0.50, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2440, ncalls=46125, logz=-4.27, remainder_fraction=10.3732%, Lmin=-0.49, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2480, ncalls=46125, logz=-4.26, remainder_fraction=9.5317%, Lmin=-0.47, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
13:51:34 [ultranest] [DEBUG] iteration=2520, ncalls=46125, logz=-4.25, remainder_fraction=8.7372%, Lmin=-0.45, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2560, ncalls=46125, logz=-4.24, remainder_fraction=8.0205%, Lmin=-0.43, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2600, ncalls=46125, logz=-4.23, remainder_fraction=7.3461%, Lmin=-0.41, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2640, ncalls=46125, logz=-4.23, remainder_fraction=6.7204%, Lmin=-0.38, Lmax=-0.01
13:51:34 [ultranest] [DEBUG] iteration=2680, ncalls=46125, logz=-4.22, remainder_fraction=6.1488%, Lmin=-0.37, Lmax=-0.01
13:52:16 [ultranest] [DEBUG] iteration=2712, ncalls=47212, logz=-4.22, remainder_fraction=5.7368%, Lmin=-0.35, Lmax=-0.01
13:52:17 [ultranest] [DEBUG] iteration=2720, ncalls=47212, logz=-4.21, remainder_fraction=5.6371%, Lmin=-0.35, Lmax=-0.01
13:52:57 [ultranest] [DEBUG] iteration=2739, ncalls=48306, logz=-4.21, remainder_fraction=5.4041%, Lmin=-0.34, Lmax=-0.01
13:52:57 [ultranest] [DEBUG] iteration=2760, ncalls=48306, logz=-4.21, remainder_fraction=5.1617%, Lmin=-0.33, Lmax=-0.01
13:53:35 [ultranest] [DEBUG] iteration=2763, ncalls=49391, logz=-4.21, remainder_fraction=5.1266%, Lmin=-0.33, Lmax=-0.01
13:53:35 [ultranest] [INFO] Explored until L=-0.01
13:53:35 [ultranest] [INFO] Likelihood function evaluations: 49391
13:53:37 [ultranest] [INFO] Writing samples and results to disk ...
13:53:37 [ultranest] [INFO] Writing samples and results to disk ... done
13:53:37 [ultranest] [DEBUG] did a run_iter pass!
13:53:37 [ultranest] [INFO]   logZ = -4.278 +- 0
13:53:37 [ultranest] [INFO] Effective samples strategy satisfied (ESS = 1744.1, need >400)
13:53:37 [ultranest] [INFO] Posterior uncertainty strategy is satisfied (KL: 0.44+-0.00 nat, need <0.10 nat)
13:53:37 [ultranest] [DEBUG]   conservative estimate says at least 564 live points are needed to reach dlogz goal
13:53:37 [ultranest] [DEBUG]   number of live points vary between 399 and 399, most (1647/1648 iterations) have 398
13:53:37 [ultranest] [INFO] Evidency uncertainty strategy wants 564 minimum live points (dlogz from 0.12 to 0.12, need <0.1)
13:53:37 [ultranest] [INFO]   logZ error budget: single: 0.08 bs:0.00 tail:0.05 total:0.05 required:<0.10
13:53:37 [ultranest] [INFO] Widening roots to 798 live points (have 400 already) ...
13:53:37 [ultranest] [INFO] Sampling 398 live points from prior ...
14:09:28 [ultranest] [DEBUG] ReactiveNestedSampler: dims=5+0, resume=True, log_dir=ultranest, backend=hdf5, vectorized=False, nbootstraps=30, ndraw=128..65536
14:10:10 [ultranest] [DEBUG] Testing resume consistency: [-3.33182397e-01 -2.00685384e-01  0.00000000e+00  4.24530696e-01
  5.48873217e-01  6.50689786e-01  3.33540057e-01  5.45923457e-01
  1.02170218e+02 -2.90225357e+00  5.95206936e-01  8.00372102e+02
  2.41073210e+02]: u=[0.4245307  0.54887322 0.65068979 0.33354006 0.54592346] -> p=[ 1.02170218e+02 -2.90225357e+00  5.95206936e-01  8.00372102e+02
  2.41073210e+02] -> L=-0.20068538434380567
14:10:44 [ultranest] [INFO] Resuming from 3695 stored points
14:10:44 [ultranest] [DEBUG] run_iter dlogz=0.1, dKL=0.1, frac_remain=0.05, Lepsilon=0.0100, min_ess=400
14:10:44 [ultranest] [DEBUG] max_iters=-1, max_ncalls=-1, max_num_improvement_loops=-1, min_num_live_points=400, cluster_num_live_points=40
14:10:44 [ultranest] [DEBUG] minimal_widths_sequence: [(-inf, 400.0), (inf, 400.0)]
14:10:54 [ultranest] [DEBUG] iteration=0, ncalls=49391, logz=-inf, remainder_fraction=100.0000%, Lmin=-3503.33, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=40, ncalls=49391, logz=-266.58, remainder_fraction=100.0000%, Lmin=-243.21, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=80, ncalls=49391, logz=-83.38, remainder_fraction=100.0000%, Lmin=-76.16, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=90, ncalls=49391, logz=-66.15, remainder_fraction=100.0000%, Lmin=-58.15, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=120, ncalls=49391, logz=-33.22, remainder_fraction=100.0000%, Lmin=-28.08, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=160, ncalls=49391, logz=-28.58, remainder_fraction=100.0000%, Lmin=-24.92, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=180, ncalls=49391, logz=-27.11, remainder_fraction=100.0000%, Lmin=-22.77, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=200, ncalls=49391, logz=-25.23, remainder_fraction=100.0000%, Lmin=-21.21, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=240, ncalls=49391, logz=-22.32, remainder_fraction=100.0000%, Lmin=-18.53, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=280, ncalls=49391, logz=-20.25, remainder_fraction=100.0000%, Lmin=-16.54, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=320, ncalls=49391, logz=-18.41, remainder_fraction=99.9999%, Lmin=-14.84, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=360, ncalls=49391, logz=-16.73, remainder_fraction=99.9996%, Lmin=-13.00, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=400, ncalls=49391, logz=-15.23, remainder_fraction=99.9980%, Lmin=-11.65, Lmax=-0.55
14:10:55 [ultranest] [DEBUG] iteration=440, ncalls=49391, logz=-14.11, remainder_fraction=99.9939%, Lmin=-10.71, Lmax=-0.46
14:10:55 [ultranest] [DEBUG] iteration=450, ncalls=49391, logz=-13.87, remainder_fraction=99.9922%, Lmin=-10.49, Lmax=-0.46
14:10:55 [ultranest] [DEBUG] iteration=480, ncalls=49391, logz=-13.26, remainder_fraction=99.9863%, Lmin=-10.04, Lmax=-0.46
14:10:55 [ultranest] [DEBUG] iteration=520, ncalls=49391, logz=-12.53, remainder_fraction=99.9729%, Lmin=-9.23, Lmax=-0.46
14:10:55 [ultranest] [DEBUG] iteration=560, ncalls=49391, logz=-11.89, remainder_fraction=99.9464%, Lmin=-8.73, Lmax=-0.46
14:10:55 [ultranest] [DEBUG] iteration=600, ncalls=49391, logz=-11.30, remainder_fraction=99.9038%, Lmin=-7.96, Lmax=-0.46
14:10:55 [ultranest] [DEBUG] iteration=640, ncalls=49391, logz=-10.72, remainder_fraction=99.8373%, Lmin=-7.43, Lmax=-0.45
14:10:55 [ultranest] [DEBUG] iteration=680, ncalls=49391, logz=-10.11, remainder_fraction=99.7050%, Lmin=-6.68, Lmax=-0.45
14:10:55 [ultranest] [DEBUG] iteration=720, ncalls=49391, logz=-9.59, remainder_fraction=99.5115%, Lmin=-6.20, Lmax=-0.45
14:10:55 [ultranest] [DEBUG] iteration=760, ncalls=49391, logz=-9.15, remainder_fraction=99.2361%, Lmin=-5.73, Lmax=-0.39
14:10:55 [ultranest] [DEBUG] iteration=800, ncalls=49391, logz=-8.72, remainder_fraction=98.8527%, Lmin=-5.33, Lmax=-0.33
14:10:55 [ultranest] [DEBUG] iteration=840, ncalls=49391, logz=-8.30, remainder_fraction=98.2992%, Lmin=-4.77, Lmax=-0.33
14:10:55 [ultranest] [DEBUG] iteration=880, ncalls=49391, logz=-7.91, remainder_fraction=97.5320%, Lmin=-4.38, Lmax=-0.33
14:10:55 [ultranest] [DEBUG] iteration=900, ncalls=49391, logz=-7.72, remainder_fraction=97.0265%, Lmin=-4.18, Lmax=-0.33
14:10:55 [ultranest] [DEBUG] iteration=920, ncalls=49391, logz=-7.54, remainder_fraction=96.4367%, Lmin=-3.97, Lmax=-0.26
14:10:56 [ultranest] [DEBUG] iteration=960, ncalls=49391, logz=-7.20, remainder_fraction=94.9681%, Lmin=-3.62, Lmax=-0.26
14:10:56 [ultranest] [DEBUG] iteration=1000, ncalls=49391, logz=-6.91, remainder_fraction=93.3339%, Lmin=-3.41, Lmax=-0.26
14:10:56 [ultranest] [DEBUG] iteration=1040, ncalls=49391, logz=-6.65, remainder_fraction=91.3085%, Lmin=-3.16, Lmax=-0.26
14:10:56 [ultranest] [DEBUG] iteration=1080, ncalls=49391, logz=-6.41, remainder_fraction=89.3956%, Lmin=-2.91, Lmax=-0.21
14:10:56 [ultranest] [DEBUG] iteration=1120, ncalls=49391, logz=-6.21, remainder_fraction=87.2515%, Lmin=-2.80, Lmax=-0.21
14:10:56 [ultranest] [DEBUG] iteration=1160, ncalls=49391, logz=-6.03, remainder_fraction=84.8927%, Lmin=-2.59, Lmax=-0.21
14:10:56 [ultranest] [DEBUG] iteration=1170, ncalls=49391, logz=-5.99, remainder_fraction=84.2771%, Lmin=-2.50, Lmax=-0.21
14:10:56 [ultranest] [DEBUG] iteration=1200, ncalls=49391, logz=-5.86, remainder_fraction=82.1579%, Lmin=-2.38, Lmax=-0.21
14:10:56 [ultranest] [DEBUG] iteration=1240, ncalls=49391, logz=-5.71, remainder_fraction=79.2065%, Lmin=-2.21, Lmax=-0.21
14:10:56 [ultranest] [DEBUG] iteration=1280, ncalls=49391, logz=-5.57, remainder_fraction=75.9271%, Lmin=-2.08, Lmax=-0.21
14:10:56 [ultranest] [DEBUG] iteration=1320, ncalls=49391, logz=-5.44, remainder_fraction=72.5026%, Lmin=-1.94, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1360, ncalls=49391, logz=-5.32, remainder_fraction=68.9207%, Lmin=-1.81, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1400, ncalls=49391, logz=-5.21, remainder_fraction=65.3345%, Lmin=-1.71, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1440, ncalls=49391, logz=-5.12, remainder_fraction=61.7966%, Lmin=-1.64, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1480, ncalls=49391, logz=-5.04, remainder_fraction=58.4329%, Lmin=-1.56, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1520, ncalls=49391, logz=-4.96, remainder_fraction=55.3254%, Lmin=-1.47, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1560, ncalls=49391, logz=-4.89, remainder_fraction=52.1975%, Lmin=-1.40, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1600, ncalls=49391, logz=-4.83, remainder_fraction=48.9275%, Lmin=-1.34, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1640, ncalls=49391, logz=-4.77, remainder_fraction=45.8320%, Lmin=-1.27, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1680, ncalls=49391, logz=-4.72, remainder_fraction=42.9151%, Lmin=-1.23, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1720, ncalls=49391, logz=-4.67, remainder_fraction=40.0820%, Lmin=-1.17, Lmax=-0.03
14:10:56 [ultranest] [DEBUG] iteration=1760, ncalls=49391, logz=-4.63, remainder_fraction=37.4712%, Lmin=-1.13, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=1800, ncalls=49391, logz=-4.59, remainder_fraction=35.0385%, Lmin=-1.10, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=1840, ncalls=49391, logz=-4.55, remainder_fraction=32.6755%, Lmin=-1.04, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=1880, ncalls=49391, logz=-4.52, remainder_fraction=30.6079%, Lmin=-1.00, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=1890, ncalls=49391, logz=-4.51, remainder_fraction=30.0433%, Lmin=-0.99, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=1920, ncalls=49391, logz=-4.49, remainder_fraction=28.4986%, Lmin=-0.95, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=1960, ncalls=49391, logz=-4.47, remainder_fraction=26.5014%, Lmin=-0.91, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=2000, ncalls=49391, logz=-4.44, remainder_fraction=24.6253%, Lmin=-0.87, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=2040, ncalls=49391, logz=-4.42, remainder_fraction=22.8879%, Lmin=-0.83, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=2080, ncalls=49391, logz=-4.40, remainder_fraction=21.1788%, Lmin=-0.78, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=2120, ncalls=49391, logz=-4.38, remainder_fraction=19.5983%, Lmin=-0.74, Lmax=-0.03
14:10:57 [ultranest] [DEBUG] iteration=2160, ncalls=49391, logz=-4.36, remainder_fraction=18.1847%, Lmin=-0.71, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] iteration=2200, ncalls=49391, logz=-4.34, remainder_fraction=16.8117%, Lmin=-0.67, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] iteration=2240, ncalls=49391, logz=-4.33, remainder_fraction=15.5803%, Lmin=-0.64, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
14:10:57 [ultranest] [DEBUG] iteration=2280, ncalls=49391, logz=-4.31, remainder_fraction=14.3684%, Lmin=-0.60, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] iteration=2320, ncalls=49391, logz=-4.30, remainder_fraction=13.2576%, Lmin=-0.58, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] iteration=2360, ncalls=49391, logz=-4.29, remainder_fraction=12.2455%, Lmin=-0.55, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] iteration=2400, ncalls=49391, logz=-4.28, remainder_fraction=11.3105%, Lmin=-0.52, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] iteration=2430, ncalls=49391, logz=-4.27, remainder_fraction=10.5926%, Lmin=-0.50, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] iteration=2440, ncalls=49391, logz=-4.27, remainder_fraction=10.3732%, Lmin=-0.49, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] iteration=2480, ncalls=49391, logz=-4.26, remainder_fraction=9.5317%, Lmin=-0.47, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] clustering found some stray points [need_accept=False] (array([1, 2]), array([399,   1]))
14:10:57 [ultranest] [DEBUG] iteration=2520, ncalls=49391, logz=-4.25, remainder_fraction=8.7372%, Lmin=-0.45, Lmax=-0.01
14:10:57 [ultranest] [DEBUG] iteration=2560, ncalls=49391, logz=-4.24, remainder_fraction=8.0205%, Lmin=-0.43, Lmax=-0.01
14:10:58 [ultranest] [DEBUG] iteration=2600, ncalls=49391, logz=-4.23, remainder_fraction=7.3461%, Lmin=-0.41, Lmax=-0.01
14:10:58 [ultranest] [DEBUG] iteration=2640, ncalls=49391, logz=-4.23, remainder_fraction=6.7204%, Lmin=-0.38, Lmax=-0.01
14:10:58 [ultranest] [DEBUG] iteration=2680, ncalls=49391, logz=-4.22, remainder_fraction=6.1488%, Lmin=-0.37, Lmax=-0.01
14:10:58 [ultranest] [DEBUG] iteration=2720, ncalls=49391, logz=-4.21, remainder_fraction=5.6371%, Lmin=-0.35, Lmax=-0.01
14:10:58 [ultranest] [DEBUG] iteration=2760, ncalls=49391, logz=-4.21, remainder_fraction=5.1617%, Lmin=-0.33, Lmax=-0.01
14:10:58 [ultranest] [INFO] Explored until L=-0.01
14:10:58 [ultranest] [INFO] Likelihood function evaluations: 49391
14:10:59 [ultranest] [INFO] Writing samples and results to disk ...
14:11:00 [ultranest] [INFO] Writing samples and results to disk ... done
14:11:00 [ultranest] [DEBUG] did a run_iter pass!
14:11:00 [ultranest] [INFO]   logZ = -4.074 +- 0
14:11:00 [ultranest] [INFO] Effective samples strategy satisfied (ESS = 1744.1, need >400)
14:11:00 [ultranest] [INFO] Posterior uncertainty strategy is satisfied (KL: 0.44+-0.00 nat, need <0.10 nat)
14:11:00 [ultranest] [INFO] Evidency uncertainty strategy is satisfied (dlogz=0.05, need <0.1)
14:11:00 [ultranest] [INFO]   logZ error budget: single: 0.08 bs:0.00 tail:0.05 total:0.05 required:<0.10
14:11:00 [ultranest] [INFO] Widening roots to 798 live points (have 400 already) ...
14:11:00 [ultranest] [INFO] Sampling 398 live points from prior ...

Same happened with 0190fcc version (after #43 was merged)

I will try on 3.3.0 as well, but I will have to limit the number of nodes to avoid #42 bug, so it will take longer...

keyword missing when plotting trace with ReactiveNestedSampler results

  • UltraNest version: 3.3.0
  • Python version: 3.9.6
  • Operating System: MacOSX Mojave 10.14.6

I am trying to generate the trace plot using the ultranest.plot.traceplot function after running the ReactiveNestedSampler. But calling:
ultranest.plot.traceplot(result) send me an error.

~/.local/lib/python3.9/site-packages/ultranest/plot.py in traceplot(results, span, quantiles, smooth, post_color, post_kwargs, kde, nkde, trace_cmap, trace_color, trace_kwargs, connect, connect_highlight, connect_color, connect_kwargs, max_n_ticks, use_math_text, labels, label_kwargs, show_titles, title_fmt, title_kwargs, truths, truth_color, truth_kwargs, verbose, fig)
    549     # Extract weighted samples.
    550     samples = results['samples']
--> 551     logvol = results['logvol']
    552     weights = results['weights']
    553 

KeyError: 'logvol'

After checking result keys, it seems that this is indeed missing. A way to add it or bypass/ignore? Interestingly, the sampler.plot_trace() does work!

Why do I want this? I use ultranest into my code (thanks for that amazing piece of work). And I am generating various diagnostic plots, but I want a bit more control over it.

Thanks!

`UnicodeEncodeError` when saving results for parameter names with Ξ±, Ξ² and Ξ³

  • UltraNest version: 3.2.0
  • Python version: 3.9.5
  • Operating System: Fedora 33

Description

I've been trying UltraNest for a research problem and found that some of the output wasn't written to the logging directory, I believe because I've used some "special" characters in my parameter names. e.g. α₁.

I've reproduced this in the small example below, for a unit 3-d Gaussian.

What I Did

#!/usr/bin/env python3                                                                                                                                                                                                                                        

import numpy as np
import ultranest

def prior_transform(cube):
    return 20.*cube - 10

def log_likelihood(params):
    return -0.5*np.sum(params**2)

names = ['Ξ±', 'Ξ²', 'Ξ³']                                                                                                                                                                                                                                     

S = ultranest.ReactiveNestedSampler(names, log_likelihood, prior_transform, log_dir='encoding')
r = S.run(min_num_live_points=400)

When I run this in my terminal, it crashes when writing output with the message:

...
Ξ±:      -1.0|                                                                     -0.3  * * * ********************************************************************  * *  +0.3                                                                      |     +1.0
Ξ²:      -1.0|                                                                     -0.3  * * ***********************************************************************  +0.3                                                                          |     +1.0
Ξ³:      -1.0|                                                                       -0.3  *************************************************************************** *  +0.3                                                                      |     +1.0

[ultranest] Explored until L=-0.0009  .0555..-0.0553]*| it/evals=4360/7565 eff=60.8514% N=400 
[ultranest] Likelihood function evaluations: 7613
[ultranest] Writing samples and results to disk ...
Traceback (most recent call last):
  File "/home/wball/.local/lib/python3.9/site-packages/numpy/lib/npyio.py", line 1354, in first_write
    self.write_normal(v)
  File "/home/wball/.local/lib/python3.9/site-packages/numpy/lib/npyio.py", line 1350, in write_normal
    self.fh.write(asunicode(v))
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wball/try/ultranest/encoding_bug.py", line 15, in <module>
    r = S.run(min_num_live_points=400)
  File "/home/wball/.local/lib/python3.9/site-packages/ultranest/integrator.py", line 2124, in run
    for result in self.run_iter(
  File "/home/wball/.local/lib/python3.9/site-packages/ultranest/integrator.py", line 2477, in run_iter
    self._update_results(main_iterator, saved_logl, saved_nodeids)
  File "/home/wball/.local/lib/python3.9/site-packages/ultranest/integrator.py", line 2599, in _update_results
    np.savetxt(
  File "<__array_function__ internals>", line 5, in savetxt
  File "/home/wball/.local/lib/python3.9/site-packages/numpy/lib/npyio.py", line 1421, in savetxt
    fh.write(comments + header + newline)
  File "/home/wball/.local/lib/python3.9/site-packages/numpy/lib/npyio.py", line 1341, in write
    self.do_write(v)
  File "/home/wball/.local/lib/python3.9/site-packages/numpy/lib/npyio.py", line 1358, in first_write
    self.write_bytes(v)
  File "/home/wball/.local/lib/python3.9/site-packages/numpy/lib/npyio.py", line 1347, in write_bytes
    self.fh.write(v.encode(self.encoding))
UnicodeEncodeError: 'latin-1' codec can't encode character '\u03b1' in position 1: ordinal not in range(256)

I noticed that many data files are written successfully, even with these characters (e.g. the weighted sample points).

Number of live points decreases below `min_num_live_points` parameter

  • UltraNest version: 3.3.0
  • Python version: 3.9.6
  • Operating System: Fedora 33

Description

I'm running an experiment and finding that immediate after I start a run, the number of live points appears to drop from the value I provide (usually 400) to around ~80, where it remains for the rest of the run (unless an improvement loop later decides to increase it). I'm not sure if this is expected for some reason but it isn't what the documentation implies.

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

What I Did

I haven't devised a MWE yet and my example involves dependencies on a lot of yet-unreleased code and a few hundred MB of data, but this is what the main block looks like

S = ultranest.ReactiveNestedSampler(names, log_likelihood, prior_transform,
                                    log_dir=log_dir, ndraw_min=512,
                                    num_test_samples=50)
S.stepsampler = ultranest.stepsampler.RegionSliceSampler(nsteps=2*D) # D=12

r = S.run(min_num_live_points=400, dKL=0.5, dlogz=0.5)
S.print_results()

The first running summary lines of terminal output already end with N=84, where I'd expect at least N=400.

Runtime Warning & Difficulty Recovering Fiducials

  • UltraNest version: 3.2.0
  • Python version: 3.8.3
  • Operating System: macOS Catalina 10.15.6

Description

I'm attempting to benchmark the performance of UltraNest for the sake of a comparison to another nested sampling technique, but I'm having a lot of difficulty in recovering the fiducial parameter values of my model even when the error is very low. This is a six dimensional problem with monomodal posteriors and the other nested sampling technique has no problem solving it, but the true parameter values do not fall anywhere near the 2-sigma range of the posteriors found by UltraNest. I've been racking my mind on how I can improve these results, I've double checked that the prior and likelihood functions return what I expect, but I can't find a way to recover the true parameter values. I've encountered a runtime warning which occurs each time the live point display is printed out, and I wonder if this is a cause of the problem:

/Users/nsusemie/opt/anaconda3/lib/python3.8/site-packages/ultranest/integrator.py:1921: RuntimeWarning: invalid value encountered in sqrt
  tregion.create_ellipsoid()

Is it possible that this warning is an indication of a larger problem? Would you be able to offer any advice that could help me solve this problem?

I'm certainly no expert, so please let me know if any of the above needs to be clarified or if I can provide additional details. Thank you in advance.

Totally Silent Running

  • UltraNest version: 2.1.2
  • Python version: 3.7
  • Operating System: Mac OSX 10.14

Description

While I can turn off the dynamic visualization when performing a run, there are still other logging messages being output to stdout. I'd like to be able to run completely silently (on stdout) since I have a larger number of models to fit.

AssertionError: Error in loglikelihood function: returned non-finite number:

  • UltraNest version:2.1.0
  • Python version:Python 2.7.14 |Anaconda, Inc.| (default, Oct 16 2017, 17:29:19)
    [GCC 7.2.0] on linux2
  • Operating System:Red Hat Enterprise Linux Server release 6.10 (Santiago)

AssertionError: Error in loglikelihood function: returned non-finite number:

Using the same likelihood function that yielded expected results on MultiNest, I ran it using UltraNest. I'm getting the assertion error that a non-finite number is returned.

What I Did

I modified the likelihood to account for NaN

    if math.isnan(lnprobval):
        return -np.inf
    else:
        return lnprobval

Here's the traceback without modification:

Traceback (most recent call last):
  File "testing_ultranest.py", line 516, in <module>
    resume=True, # whether to resume from there (otherwise start from scratch)
  File "/storage/home/sxx15/.conda/envs/envsam/lib/python2.7/site-packages/ultranest/integrator.py", line 723, in __init__
    self._set_likelihood_function(transform, loglike, num_test_samples)
  File "/storage/home/sxx15/.conda/envs/envsam/lib/python2.7/site-packages/ultranest/integrator.py", line 765, in _set_likelihood_function
    assert np.isfinite(logl).all(), ("Error in loglikelihood function: returned non-finite number: %s for input u=%s p=%s" % (logl, u, p))
AssertionError: Error in loglikelihood function: returned non-finite number: [nan nan] for input u=[[0.15287676 0.02828641 0.38913538 0.94604033 0.01679531 0.16236183
  0.99140184 0.18091045]
 [0.13509187 0.91037108 0.40966697 0.84476043 0.21779403 0.16916286
  0.13342418 0.99614286]] p=[[-2.38849296 -4.91514076 -1.44345849 -2.161879   -2.93281876 -3.67527633
   0.96560737 -3.6381791 ]
 [-2.45963253 -2.26888676 -1.36133212 -2.46571871 -2.12882389 -3.66167427
  -2.46630329 -2.00771427]]

With modification:
Traceback (most recent call last):

  File "testing_ultranest.py", line 519, in <module>
    resume=True, # whether to resume from there (otherwise start from scratch)
  File "/storage/home/sxx15/.conda/envs/envsam/lib/python2.7/site-packages/ultranest/integrator.py", line 723, in __init__
    self._set_likelihood_function(transform, loglike, num_test_samples)
  File "/storage/home/sxx15/.conda/envs/envsam/lib/python2.7/site-packages/ultranest/integrator.py", line 765, in _set_likelihood_function
    assert np.isfinite(logl).all(), ("Error in loglikelihood function: returned non-finite number: %s for input u=%s p=%s" % (logl, u, p))
AssertionError: Error in loglikelihood function: returned non-finite number: [-inf -inf] for input u=[[0.748844   0.1997127  0.36582737 0.61027022 0.04760576 0.99153052
  0.20760386 0.95238083]
 [0.88866919 0.19656596 0.11957994 0.27902825 0.18068189 0.71918241
  0.28413969 0.81962967]] p=[[-0.004624   -4.40086191 -1.53669051 -3.16918935 -2.80957697 -2.01693897
  -2.16958456 -2.09523834]
 [ 0.55467678 -4.41030212 -2.52168023 -4.16291525 -2.27727244 -2.56163519
  -1.86344124 -2.36074067]]


Make debug log more useful

At the moment, the stdout contains useful information about the region, progress, strategy, and sampling efficiency.

Not all users store the stdout, so these diagnostics is lost. The debug.log should store this information, perhaps after every region rebuild.

Enhancement request: blobs - additional output from the loglike function

log_likelihood function often requires extensive calculations. As a byproduct, some intermediate values are being calculated during the sampling process. These intermediate values often are of scientific interest. Since the output from the log_likelihood function consist of a single number, all of the intermediate values have to be discarded and recalculated after the sampling process, which could have comparable duration to the sampling itself.

It would be of great help, if every calculated point could also have some arbitrary vector returned from loglike function and stored beside its likelihood in the final sample.

This feature is analogous to the "blobs" feature in emcee package: https://emcee.readthedocs.io/en/stable/user/blobs/

Increase speed by reducing overhead

  • UltraNest version: 3.3.3
  • Python version: 3.9.7
  • Operating System: Arch Linux, Kernel 5.14
  • CPU: i7-1185G7

Thank you for UltraNest, which I really like!

I have a question regarding speed. I have a model with 13 free parameters. It is quite simple, and coded in Python / numba for speed. In a simple loop, I can execute 100,000 likelihood evaluations per second on a single core.

When I run the UltraNest ReactiveNestedSampler with this model, I see in the log it/evals=4857/97721 after the first minute. So, UltraNest makes 100,000 function calls per minute. In other words, only ~1% of the time is spent in making model evaluations, and 99% in UltraNest.

I also tried a vectorized version, but it is almost exactly the same: 99% is UltraNest-time, not model-time.

Is there anything I'm missing? Or are 100k evaluations per minute just normal and can't be improved? Is something wrong with my setup? I'd appreciate a baseline from your experience: How many evals per minute can be expected for a fast model with 13 parameters?

Should overcluster data go into log_dir?

  • UltraNest version: 2.02
  • Python version: 3.6.8
  • Operating System: Ubuntu 18

Description

On some problems, ultranest produces a lot of files called overclusted*{.txt, .npz} that don't go into the log_dir directory, and I can't control where they are saved. My guess is that it's these lines

filename = 'overclustered_%d.npz' % nextTransformLayer.nclusters

and that probably that the name should be preceded by log_dir

What I Did

I can make a reproducible example if necessary, but basically I run ultranest on the classic eggbox problem which has lots of modes.

Documentation enhancement request: run_iter

  • UltraNest version: 3.3.2
  • Python version: 3.8
  • Operating System: Win10 / wsl2Ubuntu2004 / RedHat Linux

Description

Hello @JohannesBuchner! I have a question for you.

I am trying to create corner plots during the execution, as it takes a lot of time and I am equally interested in the intermediate results. I want them to be created controllably often. I don't find in the current documentation (https://johannesbuchner.github.io/UltraNest/ultranest.html?highlight=run_iter) how do I do it.

Can I somehow control this? For example, yield next iterator step every N function calls? Is it update_interval_ncall? It is written that it is not used...

Also, I see difference in the defaults of run and run_iter: update_interval_volume_fraction=0.8 | 0.2 -- is it intended?

What I Did

# truncated code
sampler = ultranest.integrator.ReactiveNestedSample(...)
for i, result in enumerate(sampler.run_iter(**kwargs)):
  fig = corner()  # piece of code that analyzes current sampler content and plots a corner plot
  fig.savefig(f"corner_{i:06d}.pdf")  # save current figure with a number

Thank you in advance!

Very high-dimension sampling with decreasing number of live points

  • UltraNest version: 3.3.3
  • Python version: 3.10.2
  • Operating System: CentOS 7.9.2009

Description

I'm trying to model a dataset of a few thousand points and I wrote a likelihood function for GPU in CUDA that uses single precision float. The model has 211 parameters so I'm using a step sampler as shown below with over 2000 live points. Using less live points make the code apparently detect lots of cluster whereas the posterior should be mono-modal. Throughout the run, the number of live points slowly decreases as a large number of plateaux are supposedly found. Until after several hours and a well advanced sampling, only ~350 live points remain, clusters are detected and the code eventually crashes.

Is there a way to force the number of live points to remain fix? Or am I missing something else? Any feedback would be appreciated.

What I Did

sampler = ReactiveNestedSampler(paramnames, model.LogLikelihood_gpu, transform=model.Prior, vectorized=True, log_dir=".", num_test_samples=0, ndraw_min=512)
sampler.stepsampler = stepsampler.RegionSliceSampler(nsteps=200, adaptive_nsteps='move-distance')
sampler.run(min_num_live_points=2048, viz_callback=False)

Output:

[ultranest] Found a lot of clusters: 79 (14 with >1 members)4.1250] | it/evals=306846/450144199 eff=0.0678% N=388
[ultranest] Found a lot of clusters: 108 (19 with >1 members).1250] | it/evals=306933/450281788 eff=0.0678% N=388
[ultranest] Found a lot of clusters: 41 (3 with >1 members)02.9062] | it/evals=307125/450578099 eff=0.0678% N=384
[ultranest] Found a lot of clusters: 47 (4 with >1 members)02.9062] | it/evals=307253/450776283 eff=0.0678% N=383
[ultranest] Found a lot of clusters: 41 (2 with >1 members)63.1016] | it/evals=307585/451267056 eff=0.0678% N=377
[ultranest] Found a lot of clusters: 44 (4 with >1 members)86.0547] | it/evals=307948/451774846 eff=0.0678% N=371
[ultranest] Found a lot of clusters: 68 (11 with >1 members)6.0547] | it/evals=308031/451883729 eff=0.0678% N=371
[ultranest] Found a lot of clusters: 103 (12 with >1 members).0391] | it/evals=308114/451993245 eff=0.0678% N=371
[ultranest] Found a lot of clusters: 134 (27 with >1 members).0391] | it/evals=308197/452095110 eff=0.0678% N=371
[ultranest] Found a lot of clusters: 43 (1 with >1 members)76.6094] | it/evals=308759/452751173 eff=0.0678% N=356
[ultranest] Found a lot of clusters: 37 (3 with >1 members)49.8672] | it/evals=308930/452932084 eff=0.0678% N=354
[ultranest] Found a lot of clusters: 69 (11 with >1 members)9.8672] | it/evals=309009/453014942 eff=0.0678% N=354
Traceback (most recent call last):82369.89 [81876.8125..81949.8672] | it/evals=309042/453049606 eff=0.0678% N=353
  File "/u/gdesvign/precess_cuda.py", line 447, in <module>
    ###sampler.run(min_num_live_points=nlive, viz_callback=False)
  File "/u/gdesvign/conda-envs/pulsar/lib/python3.10/site-packages/ultranest/integrator.py", line 2170, in run
    for result in self.run_iter(
  File "/u/gdesvign/conda-envs/pulsar/lib/python3.10/site-packages/ultranest/integrator.py", line 2382, in run_iter
    region_fresh = self._update_region(
  File "/u/gdesvign/conda-envs/pulsar/lib/python3.10/site-packages/ultranest/integrator.py", line 1827, in _update_region
    _update_region_bootstrap(self.region, nbootstraps, minvol, self.comm if self.use_mpi else None, self.mpi_size)
  File "/u/gdesvign/conda-envs/pulsar/lib/python3.10/site-packages/ultranest/integrator.py", line 390, in _update_region_bootstrap
    raise e
  File "/u/gdesvign/conda-envs/pulsar/lib/python3.10/site-packages/ultranest/integrator.py", line 367, in _update_region_bootstrap
    r, f = region.compute_enlargement(
  File "ultranest/mlfriends.pyx", line 863, in ultranest.mlfriends.MLFriends.compute_enlargement
numpy.linalg.LinAlgError: Distances are not positive

Using PredictionBand with pre-defined axes

  • UltraNest version: 2.1.2
  • Python version: 3.7
  • Operating System: Mac OS X 10.14.6

Description

I have defined multiple axes in matplotlib, and I would like to plot the UltraNest PredictionBand shading on one of those specific axes. Is there a way to pass a specific set of axes to the keywords in PredictionBand to ensure the shading is plotted in the right place? Currently without specifying an axis, the shading is plotted on the last axis that was created.

What I Did

Following on from the intrinsic distribution example here:
https://johannesbuchner.github.io/UltraNest/example-intrinsic-distribution.html

For the last example (in cell 11 on the webpage above) for using PredictionBand, I am looking to plot the shading on ax1 in the following example:

fig = plt.figure(figsize = (14., 7.))
gs = gridspec.GridSpec(1, 2, width_ratios = [1., 1.])
ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[0, 1])

from ultranest.plot import PredictionBand
x = np.linspace(-100, 100, 400)
band = PredictionBand(x)

for params in sampler.results['samples'][:40]:
    mean, scatter = params
    band.add(scipy.stats.norm(mean, scatter).pdf(x))

band.shade(color='k', alpha=0.1) ## this appears on ax2, not ax1
band.line(color='k')

ReactiveNestedSampler finishing on the first iteration

  • UltraNest version: 3.4.4
  • Python version: 3.9.12
  • Operating System: Linux

Description

I am trying to model two observational data: an observed curve, and another physical information (hereafter, curve and physical). The generative model has 22 parameters, and it gives me these two pieces of information separately. Of these parameters, 11 of them are fractions, that must sum to 1 (for which I am using a dirichlet prior), and 11 come from an uniform distribution. I am defining my problem such that the likelihood outside the physical uncertainty is -1e300 (in the example bellow it should be between 0.5 and 0.7).

The problem is that on the first iteration, all the sampled points are not within physical uncertainty limits, so all the live points have same likelihood=-1e300. With that the code is finishing on the very first iteration, and returning:

logZ = -1000000000000000052504760255204420248704468581108159154915854115511802457988908195786371375080447864043704443832883878176942523235360430575644792184786706982848387200926575803737830233794788090059368953234970799945081119038967640880074652742780142494579258788820056842838115669472196386865459400540160.000 +- 0.000
  single instance: logZ = -1000000000000000052504760255204420248704468581108159154915854115511802457988908195786371375080447864043704443832883878176942523235360430575644792184786706982848387200926575803737830233794788090059368953234970799945081119038967640880074652742780142494579258788820056842838115669472196386865459400540160.000 +- nan
  bootstrapped   : logZ = -1000000000000000201206451102982726528510718396098215168041874281451248363566094127380437091120885218560535893448518937156814902254657735621103316739277277761931445311166038382034914278540775484328009936664744486969000697274111361486849523430568151310289152823685865144042626214886587669241994282008576.000 +- 0.000
  tail           : logZ = +- 0.000
insert order U test : converged: True correlation: inf iterations

    0                   0.090 +- 0.083
    1                   0.089 +- 0.082
    2                   0.093 +- 0.084
    3                   0.090 +- 0.080
    4                   0.091 +- 0.082
    5                   0.090 +- 0.082
    6                   0.090 +- 0.081
    7                   0.091 +- 0.083
    8                   0.092 +- 0.082
    9                   0.090 +- 0.082
    10                  0.093 +- 0.085
    11                  : 0.00  β”‚β–†β–‡β–†β–†β–…β–†β–†β–‡β–‡β–†β–†β–„β–†β–†β–†β–†β–‡β–‡β–‡β–†β–†β–…β–†β–†β–‡β–‡β–†β–†β–‡β–‡β–†β–‡β–†β–†β–‡β–†β–†β–‡β–†β”‚1.00      0.51 +- 0.29
    12                  : 0.00  β”‚β–‡β–†β–†β–†β–‡β–†β–‡β–‡β–…β–‡β–†β–†β–‡β–†β–‡β–‡β–‡β–†β–†β–‡β–†β–†β–‡β–†β–‡β–…β–‡β–†β–†β–…β–‡β–†β–†β–‡β–†β–‡β–‡β–†β–†β”‚1.00      0.50 +- 0.29
    13                  : 0.00  β”‚β–…β–‡β–†β–†β–†β–†β–‡β–…β–†β–…β–‡β–‡β–†β–‡β–‡β–†β–†β–†β–‡β–†β–†β–…β–‡β–…β–†β–†β–†β–‡β–†β–†β–†β–‡β–†β–…β–†β–‡β–†β–†β–‡β”‚1.00      0.51 +- 0.29
    14                  : 0.00  β”‚β–†β–‡β–†β–‡β–†β–†β–‡β–‡β–‡β–‡β–‡β–‡β–‡β–†β–‡β–†β–†β–‡β–†β–‡β–‡β–‡β–…β–†β–†β–‡β–‡β–‡β–‡β–‡β–‡β–†β–†β–…β–‡β–‡β–†β–‡β–†β”‚1.00      0.50 +- 0.29
    15                  : 0.00  β”‚β–‡β–‡β–†β–†β–†β–‡β–†β–†β–†β–†β–‡β–‡β–‡β–…β–†β–†β–†β–†β–†β–†β–†β–‡β–†β–‡β–†β–†β–‡β–†β–†β–†β–‡β–†β–…β–‡β–†β–†β–‡β–†β–‡β”‚1.00      0.50 +- 0.29
    16                  : 0.00  β”‚β–†β–‡β–‡β–‡β–‡β–†β–…β–†β–‡β–†β–‡β–‡β–†β–†β–†β–‡β–†β–†β–‡β–†β–†β–‡β–‡β–‡β–‡β–‡β–‡β–‡β–†β–‡β–‡β–‡β–†β–‡β–‡β–‡β–†β–†β–†β”‚1.00      0.50 +- 0.29
    17                  : 0.00  β”‚β–†β–†β–†β–…β–‡β–…β–†β–†β–†β–†β–†β–†β–†β–‡β–†β–‡β–…β–‡β–…β–‡β–†β–‡β–†β–…β–†β–†β–‡β–…β–†β–‡β–…β–†β–†β–‡β–†β–‡β–…β–†β–‡β”‚1.00      0.50 +- 0.29
    18                  : 0.00  β”‚β–‡β–†β–‡β–†β–‡β–†β–‡β–…β–†β–‡β–†β–‡β–†β–‡β–…β–†β–‡β–…β–‡β–‡β–†β–…β–†β–‡β–†β–‡β–‡β–‡β–‡β–†β–†β–‡β–‡β–‡β–†β–‡β–…β–‡β–‡β”‚1.00      0.50 +- 0.29
    19                  : 0.00  β”‚β–†β–†β–†β–†β–†β–†β–…β–†β–‡β–‡β–†β–†β–†β–†β–†β–†β–‡β–†β–†β–†β–†β–…β–†β–†β–†β–†β–†β–†β–†β–‡β–‡β–‡β–†β–‡β–†β–†β–†β–…β–‡β”‚1.00      0.50 +- 0.29
    20                  : 0.00  β”‚β–†β–‡β–†β–‡β–‡β–‡β–‡β–†β–‡β–‡β–‡β–‡β–‡β–‡β–†β–‡β–‡β–†β–‡β–‡β–‡β–†β–‡β–‡β–†β–‡β–†β–†β–…β–‡β–‡β–‡β–†β–…β–…β–‡β–‡β–‡β–†β”‚1.00      0.50 +- 0.29
    21                  : 0.00  β”‚β–‡β–†β–†β–‡β–‡β–‡β–†β–‡β–‡β–†β–‡β–†β–†β–†β–†β–†β–†β–†β–‡β–…β–‡β–†β–…β–‡β–†β–‡β–†β–‡β–‡β–‡β–†β–†β–†β–†β–‡β–‡β–…β–†β–‡β”‚1.00      0.50 +- 0.29

In this case the correct values would be [0, 0.01, 0, 0.98, 0, 0, 0.01, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5], where the first 11 terms sum to 1, and the remaining can be any value within 0 and 1.

What I Did

def likelihood(theta):Β  Β  Β  Β  
        curve, val = generative_model(theta)
Β  Β  Β  Β  if (val >= 0.5) & (val <= 0.7):
Β  Β  Β  Β  Β  Β  log_like = metric(data, curve)
Β  Β  Β  Β  else:
Β  Β  Β  Β  Β  Β  log_like = -1e300
Β  Β  Β  Β  return log_like

def prior(theta):
Β  Β  Β  Β  fraction = theta[:11]
Β  Β  Β  Β  fraction = - np.log(fraction)
Β  Β  Β  Β  theta_fraction = fraction / np.sum(fraction)
Β  Β  Β  Β  other = np.array(theta[11:])
Β  Β  Β  Β  theta = np.concatenate([theta_fraction, other])
Β  Β  Β  Β  return theta```

def run():
        param_names = [str(i) for i in range(22)]
        sampler = ultranest.ReactiveNestedSampler(param_names, likelihood, self.prior_transform)
        
        stepsampler = ultranest.stepsampler.SliceSampler(40, region_filter=True, adaptive_nsteps='move-distance',
                                                               generate_direction=ultranest.stepsampler.generate_cube_oriented_direction)
        sampler.run(min_num_live_points=1000)
        return sampler

I tried different generate_direction funtions and stepsampler classes, but I keep getting the same results. Is there any recommendation to avoid this from happening?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.