Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

**kwargs input and anesthetic.NestedSamples output #90

Merged
merged 95 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
f1f52ed
neighbor spelling (assuming we're sticking to American spelling!)
AdamOrmondroyd May 19, 2022
2f0c339
Merge branch 'PolyChord:master' into master
AdamOrmondroyd May 28, 2022
6efc40c
updated run_poypolychord to use **kwargs rather than PolyChordSettings
AdamOrmondroyd Jul 27, 2022
df7b300
return anesthetic.NestedSamples output if installed
AdamOrmondroyd Jul 27, 2022
3f21a7b
added kwargs to run_pypolychord() docstring
AdamOrmondroyd Jul 27, 2022
85b7dfb
changed examples to use **kwargs
AdamOrmondroyd Jul 27, 2022
8cfcd22
accidental rename of run_polychord()
AdamOrmondroyd Jul 27, 2022
84c30c3
set kwarg defaults separately to run_pypolychord so that they can be …
AdamOrmondroyd Jul 27, 2022
6fe0516
run_polychord creates the paramnames file
AdamOrmondroyd Jul 27, 2022
51928d0
changed other examples paramnames are passed to run_pypolychord
AdamOrmondroyd Jul 27, 2022
da44aa7
mention anesthetic output in docstring (incomplete)
AdamOrmondroyd Jul 27, 2022
617ad12
tidied up grade_dims and nlives argument processing
AdamOrmondroyd Jul 27, 2022
d375810
logx should be logc
AdamOrmondroyd Jul 27, 2022
6270512
missing comma
AdamOrmondroyd Jul 27, 2022
1316fa8
removed settings argument
AdamOrmondroyd Jul 27, 2022
28ee39b
Restored old interface
AdamOrmondroyd Jul 28, 2022
50fa72b
run_polychord -> run
AdamOrmondroyd Jul 28, 2022
ae5c261
reverted Python_Functions/ (apart from logx->logc correction
AdamOrmondroyd Jul 28, 2022
247c51c
put PolyChordSettings back in __init__.py
AdamOrmondroyd Jul 28, 2022
cf54330
run() uses make_resume_file_kwargs_interface
AdamOrmondroyd Jul 28, 2022
dd2cf63
added run to __init__.py
AdamOrmondroyd Jul 28, 2022
7c06066
update nDerived, prior and dumper to kwargs
AdamOrmondroyd Jul 28, 2022
7b79d66
nDims is not a kwarg
AdamOrmondroyd Jul 28, 2022
9698948
add nDerived, prior and dumper to kwargs
AdamOrmondroyd Jul 28, 2022
5117092
use default_kwargs to set the defaults, then use this to see if kwarg…
AdamOrmondroyd Jul 28, 2022
aa64442
separate default_kwargs that refer to other default_kwargs
AdamOrmondroyd Jul 28, 2022
0f153cb
wrong brackets - think it's time to leave this for a moment
AdamOrmondroyd Jul 28, 2022
1ae0da3
removed accidental commas
AdamOrmondroyd Jul 29, 2022
477c796
pass kwargs directly rather than creating dict
AdamOrmondroyd Jul 29, 2022
0b5e998
added anesthetic to install_requires
AdamOrmondroyd Jul 29, 2022
25eb130
anesthetic now assumed to be installed, so new interface always retur…
AdamOrmondroyd Jul 29, 2022
4b4f29f
tidy up plotting to just use anesthetic output
AdamOrmondroyd Jul 29, 2022
8da3f8b
simplified to _make_resume_file(), plus wrapper _legacy_make_resume_f…
AdamOrmondroyd Jul 29, 2022
405f67d
added run_pypolychord_legacy_interface.py
AdamOrmondroyd Jul 29, 2022
78a9ca8
update run() docstring to anesthetic output
AdamOrmondroyd Jul 29, 2022
78654d8
removed unused sqrt from run_pypolychord.py
AdamOrmondroyd Jul 29, 2022
203f117
updated run_pypolychord.ipynb with py2nb
AdamOrmondroyd Jul 29, 2022
0730a18
change requirement to anesthetic==2.0.0b11
AdamOrmondroyd Jul 29, 2022
b963910
removed creation of .paramnames file from run(), added to run_pypolyc…
AdamOrmondroyd Aug 3, 2022
805db75
corrected kwargs error message
AdamOrmondroyd Aug 3, 2022
6b2ead8
exception handling if chains/ already exists
AdamOrmondroyd Aug 3, 2022
07f51e7
update to anesthetic 2.0.0b12
AdamOrmondroyd Sep 16, 2022
72bdea6
rather than repeating PolyChordOutput.make_paramnames_file(), make it…
AdamOrmondroyd Sep 16, 2022
25198cd
changed setup.py to point to github anesthetic as 2.0.0b12 hasn't bee…
AdamOrmondroyd Sep 18, 2022
52d6592
remove unecessary os import
AdamOrmondroyd Sep 22, 2022
5a750fa
removed commented out/empty lines around paramname creation
AdamOrmondroyd Sep 22, 2022
7f67a2a
removed unnecessary kwargs = kwargs.copy()
AdamOrmondroyd Sep 26, 2022
23a766f
double quotes to be more civilised
AdamOrmondroyd Oct 3, 2022
77fe885
change to single quotes to make Lucas happy
AdamOrmondroyd Oct 13, 2022
d05cfd2
Merge branch 'master' into anesthetic_output
williamjameshandley Feb 7, 2023
f860614
Merge branch 'master' into anesthetic_output
AdamOrmondroyd Feb 20, 2023
83597a0
Merge branch 'master' into anesthetic_output
AdamOrmondroyd Jan 9, 2024
6c650ad
update for more recent anesthetic
AdamOrmondroyd Jan 9, 2024
02c3b73
line spacing and remove todo (see pr 110
AdamOrmondroyd Jan 9, 2024
0f073cf
Merge remote-tracking branch 'upstream/master' into anesthetic_output
AdamOrmondroyd Jan 9, 2024
aed15cf
get anesthetic from pypi instead of gh
AdamOrmondroyd Jan 9, 2024
bd763d4
might as well do some formatting
AdamOrmondroyd Jan 9, 2024
bd6dff1
also fix wrap_loglikelihood for new interface (#110)
AdamOrmondroyd Jan 9, 2024
f6adbb5
Merge remote-tracking branch 'upstream/master' into anesthetic_output
AdamOrmondroyd Jan 9, 2024
34488e7
anesthetic back to optional, return None if not installed
AdamOrmondroyd Jan 9, 2024
a7c3347
version bump to 1.22.0
AdamOrmondroyd Jan 9, 2024
9852ba3
py2nb run_pypolychord.py
AdamOrmondroyd Jan 9, 2024
5503a09
Fix names of run scripts/notebooks
AdamOrmondroyd Jan 9, 2024
5b962d4
remove testing print statement
AdamOrmondroyd Jan 9, 2024
ca9c0c8
remove sqrt import, who knows where this came from
AdamOrmondroyd Jan 9, 2024
89ed507
Updated with new recommended interface
williamjameshandley Jan 9, 2024
eac2ffb
Merge branch 'anesthetic_output' of github.com:AdamOrmondroyd/PolyCho…
williamjameshandley Jan 9, 2024
7c8eae9
anesthetic root is deprecated
AdamOrmondroyd Jan 9, 2024
2e3208d
Update README.rst
williamjameshandley Jan 9, 2024
e54ad78
more anesthetic 2 madness
AdamOrmondroyd Jan 9, 2024
b6c50ca
update notebooks
AdamOrmondroyd Jan 9, 2024
e646727
remove () from dict
AdamOrmondroyd Jan 9, 2024
0937387
play around with tests
AdamOrmondroyd Jan 9, 2024
f0cdfdb
add anesthetic to CI install step
AdamOrmondroyd Jan 9, 2024
ddff239
only run tests on python>=3.8
AdamOrmondroyd Jan 9, 2024
2dabeef
test likelihood without derived parameters
AdamOrmondroyd Jan 9, 2024
ae0bb6d
some test housekeeping
AdamOrmondroyd Jan 9, 2024
be5e7c9
Merge remote-tracking branch 'upstream/master' into anesthetic_output
AdamOrmondroyd Jan 10, 2024
8143c0a
use or between the two loglikelihood return options
AdamOrmondroyd Jan 10, 2024
3465c20
use pathlib.Path to save OSError nonsense
AdamOrmondroyd Jan 10, 2024
9885121
explain paramnames more clearly
AdamOrmondroyd Jan 10, 2024
82add9d
check that grade_dims add up to nDims and test
AdamOrmondroyd Jan 10, 2024
b9cc4fe
update run docstring anesthetic stuff
AdamOrmondroyd Jan 10, 2024
2cae544
correct run_pypolychord return
AdamOrmondroyd Jan 10, 2024
9b4be33
correct missing blank lines in run() docstring
AdamOrmondroyd Jan 10, 2024
45e9f8c
add cluster_dir to kwargs, since technically it could be changed in P…
AdamOrmondroyd Jan 10, 2024
387b0d0
remove os entirely in favour of pathlib
AdamOrmondroyd Jan 10, 2024
4f5270f
fix line too long
AdamOrmondroyd Jan 10, 2024
a17d78d
update date
AdamOrmondroyd Jan 10, 2024
cdaf063
fix default grade_frac
AdamOrmondroyd Jan 10, 2024
40cb559
remove pytest-mpi requirement from CI
AdamOrmondroyd Jan 10, 2024
d420526
remove unecessary cast to set
AdamOrmondroyd Jan 25, 2024
cc807f5
don't use ac shorthand, but also don't clutter the namespace with log…
AdamOrmondroyd Jan 27, 2024
6d735e5
Revert "don't use ac shorthand, but also don't clutter the namespace …
AdamOrmondroyd Jan 28, 2024
5d9dadf
from anesthetic import make_2d_axes
AdamOrmondroyd Jan 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Python_Functions/run_pypolychord_eggbox.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from numpy import log, prod, cos
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

#EGGBOX
Expand Down Expand Up @@ -28,15 +27,17 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived)
settings.file_root = functionName
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)

kwargs = {
"file_root": functionName,
"do_clustering": True,
"read_resume": False,
"paramnames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
16 changes: 8 additions & 8 deletions Python_Functions/run_pypolychord_gaussian.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from numpy import pi, log, sqrt
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

nDims = 3
Expand Down Expand Up @@ -31,15 +30,16 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived) #settings is an object
settings.file_root = functionName #string
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)
kwargs = {
"file_root": functionName, #string
"do_clustering": True,
"read_resume": False,
"paramnames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
16 changes: 8 additions & 8 deletions Python_Functions/run_pypolychord_gaussian_shell.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from numpy import pi, log, sqrt, zeros
from scipy.special import loggamma
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

nDims = 3
Expand Down Expand Up @@ -48,15 +47,16 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived) #settings is an object
settings.file_root = functionName #string
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)
kwargs = {
"file_root": functionName, #string
"do_clustering": True,
"read_resume": False,
"paramnames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
19 changes: 10 additions & 9 deletions Python_Functions/run_pypolychord_gaussian_shells.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from xml.dom.expatbuilder import parseFragmentString
from numpy import pi, log, sqrt, logaddexp, exp, zeros
from scipy.special import loggamma
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

nDims = 3
Expand Down Expand Up @@ -41,7 +41,7 @@ def likelihood(theta):
r2 = 0


def logincexp(loga,logb,logx=None):
def logincexp(loga,logb,logc=None):
if (loga>logb):
loga = loga + log(exp(logb-loga) + 1)
else:
Expand Down Expand Up @@ -70,15 +70,16 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived) #settings is an object
settings.file_root = functionName #string
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)
kwargs = {
"file_root": functionName, #string
"do_clustering": True,
"read_resume": False,
"paramnames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
17 changes: 9 additions & 8 deletions Python_Functions/run_pypolychord_half_gaussian.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from numpy import pi, log, sqrt
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

nDims = 3
Expand Down Expand Up @@ -33,15 +32,17 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived) #settings is an object
settings.file_root = functionName #string
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)

kwargs = {
"file_root": functionName, #string
"do_clustering": True,
"read_resume": False,
"paramnmames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
17 changes: 9 additions & 8 deletions Python_Functions/run_pypolychord_himmelblau.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from numpy import pi, log, sqrt
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

nDims = 3
Expand All @@ -27,15 +26,17 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived) #settings is an object
settings.file_root = functionName #string
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)

kwargs = {
"file_root": functionName, #string
"do_clustering": True,
"read_resume": False,
"paramnames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
17 changes: 9 additions & 8 deletions Python_Functions/run_pypolychord_pyramidal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from numpy import log, exp, sqrt, pi
from scipy.special import loggamma
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

#EGGBOX
Expand Down Expand Up @@ -43,15 +42,17 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived)
settings.file_root = functionName
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)

kwargs = {
"file_root": functionName,
"do_clustering": True,
"read_resume": False,
"paramnames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
17 changes: 9 additions & 8 deletions Python_Functions/run_pypolychord_random_gaussian.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from numpy import pi, log, sqrt
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

nDims = 3
Expand Down Expand Up @@ -31,15 +30,17 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived) #settings is an object
settings.file_root = functionName #string
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)

kwargs = {
"file_root": functionName, #string
"do_clustering": True,
"read_resume": False,
"paramnames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
17 changes: 9 additions & 8 deletions Python_Functions/run_pypolychord_rastrigin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from numpy import pi, log, sqrt, cos
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

nDims = 3
Expand Down Expand Up @@ -30,15 +29,17 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived) #settings is an object
settings.file_root = functionName #string
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)

kwargs = {
"file_root": functionName, #string
"do_clustering": True,
"read_resume": False,
"paramnames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
17 changes: 9 additions & 8 deletions Python_Functions/run_pypolychord_rosenbrock.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from numpy import pi, log, sqrt
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

nDims = 3
Expand Down Expand Up @@ -36,15 +35,17 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived) #settings is an object
settings.file_root = functionName #string
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)

kwargs = {
"file_root": functionName, #string
"do_clustering": True,
"read_resume": False,
"paramnames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
17 changes: 9 additions & 8 deletions Python_Functions/run_pypolychord_twin_gaussian.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from numpy import pi, log, sqrt, logaddexp, exp
import pypolychord
from pypolychord.settings import PolyChordSettings
from pypolychord.priors import UniformPrior

nDims = 3
Expand Down Expand Up @@ -56,15 +55,17 @@ def prior(hypercube):
def dumper(live, dead, logweights, logZ, logZerr):
print("Last dead point:", dead[-1]) # prints last element of dead (wich is an array)

settings = PolyChordSettings(nDims, nDerived) #settings is an object
settings.file_root = functionName #string
settings.do_clustering = True
settings.read_resume = False

output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)
paramnames = [('p%i' % i, r'\theta_%i' % i) for i in range(nDims)]
paramnames += [('r*', 'r')]
output.make_paramnames_files(paramnames)

kwargs = {
"file_root": functionName, #string
"do_clustering": True,
"read_resume": False,
"paramnames": paramnames,
}

output = pypolychord.run_polychord(likelihood, nDims, nDerived, prior, dumper, **kwargs)

try:
import getdist.plots
Expand Down
1 change: 0 additions & 1 deletion pypolychord/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
__version__ = "1.20.1"
from pypolychord.settings import PolyChordSettings
from pypolychord.polychord import run_polychord
Loading